summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Haubenwallner <haubi@gentoo.org>2019-06-12 17:16:13 +0200
committerSam James <sam@gentoo.org>2023-05-26 07:03:42 +0100
commit0a201892be6563e321f3364d8db32a832d981e88 (patch)
treedb7be2d26bde9573fbff4fdc84328fe16d3c7c94
parentapp-portage/prefix-toolkit: revbump (diff)
downloadprefix-toolkit-3.tar.gz
prefix-toolkit-3.tar.bz2
prefix-toolkit-3.zip
app-portage/prefix-toolkit(prefix-stack-setup): accept --chost argumentprefix-toolkit-3
Allow to override the CHOST value for the stacked Prefix. Require the --chost argument if the profile does not set CHOST. Package-Manager: Portage-2.3.67-prefix, Repoman-2.3.14 Signed-off-by: Michael Haubenwallner <haubi@gentoo.org> (cherry picked from commit 7c05ed37cfc125aa8c66fc8dd98811a5e8c64414)
-rw-r--r--prefix-stack-setup37
-rw-r--r--prefix-toolkit-3.ebuild (renamed from prefix-toolkit-2.ebuild)37
2 files changed, 70 insertions, 4 deletions
diff --git a/prefix-stack-setup b/prefix-stack-setup
index 9fa4a1b..2d7ec10 100644
--- a/prefix-stack-setup
+++ b/prefix-stack-setup
@@ -6,6 +6,7 @@ PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
CHILD_EPREFIX=
CHILD_PROFILE=
+CHILD_CHOST=
#
# get ourselfs the functions.sh script for ebegin/eend/etc.
@@ -29,8 +30,9 @@ fi
for arg in "$@"; do
case "${arg}" in
- --eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
- --profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+ --eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
+ --profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+ --chost=*) CHILD_CHOST="${arg#--chost=}" ;;
--help)
einfo "$0 usage:"
@@ -38,6 +40,8 @@ for arg in "$@"; do
einfo " where this script is installed (${PARENT_EPREFIX})"
einfo " --profile=[PATH] The absolute path to the profile to use. This path"
einfo " must point to a directory within ${PARENT_EPREFIX}"
+ einfo " --chost=[CHOST] The CHOST to use for the new EPREFIX, required if"
+ einfo " the profile does not set CHOST, or to override."
exit 0
;;
esac
@@ -52,6 +56,32 @@ test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1
test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+if [[ -z ${CHILD_CHOST} ]]
+then
+ my_lsprofile() {
+ (
+ cd -P "${1:-.}" || exit 1
+ [[ -r ./parent ]] &&
+ for p in $(<parent)
+ do
+ my_lsprofile "${p}" || exit 1
+ done
+ pwd -P
+ )
+ }
+
+ for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
+ do
+ if [[ ${profile} == missing ]]
+ then
+ eerror "profile does not set CHOST, need --chost argument"
+ exit 1
+ fi
+ [[ -s "${profile}/make.defaults" ]] || continue
+ grep -q '^[ ]*CHOST@=@' "${profile}/make.defaults" && break
+ done
+fi
+
einfo "creating stacked prefix ${CHILD_EPREFIX}"
#
@@ -101,6 +131,9 @@ ebegin "creating make.conf"
echo "EPREFIX=\"${CHILD_EPREFIX}\""
echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
echo "BROOT=\"${PARENT_EPREFIX}\""
+ if [[ -n ${CHILD_CHOST} ]] ; then
+ echo "CHOST=\"${CHILD_CHOST}\""
+ fi
) > "${CHILD_EPREFIX}"/etc/portage/make.conf
eend_exit $?
diff --git a/prefix-toolkit-2.ebuild b/prefix-toolkit-3.ebuild
index 21c1721..e4719f8 100644
--- a/prefix-toolkit-2.ebuild
+++ b/prefix-toolkit-3.ebuild
@@ -320,6 +320,7 @@ PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
CHILD_EPREFIX=
CHILD_PROFILE=
+CHILD_CHOST=
#
# get ourselfs the functions.sh script for ebegin/eend/etc.
@@ -343,8 +344,9 @@ fi
for arg in "$@"; do
case "${arg}" in
- --eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
- --profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+ --eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
+ --profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+ --chost=*) CHILD_CHOST="${arg#--chost=}" ;;
--help)
einfo "$0 usage:"
@@ -352,6 +354,8 @@ for arg in "$@"; do
einfo " where this script is installed (${PARENT_EPREFIX})"
einfo " --profile=[PATH] The absolute path to the profile to use. This path"
einfo " must point to a directory within ${PARENT_EPREFIX}"
+ einfo " --chost=[CHOST] The CHOST to use for the new EPREFIX, required if"
+ einfo " the profile does not set CHOST, or to override."
exit 0
;;
esac
@@ -366,6 +370,32 @@ test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1
test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+if [[ -z ${CHILD_CHOST} ]]
+then
+ my_lsprofile() {
+ (
+ cd -P "${1:-.}" || exit 1
+ [[ -r ./parent ]] &&
+ for p in $(<parent)
+ do
+ my_lsprofile "${p}" || exit 1
+ done
+ pwd -P
+ )
+ }
+
+ for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
+ do
+ if [[ ${profile} == missing ]]
+ then
+ eerror "profile does not set CHOST, need --chost argument"
+ exit 1
+ fi
+ [[ -s "${profile}/make.defaults" ]] || continue
+ grep -q '^[ ]*CHOST@=@' "${profile}/make.defaults" && break
+ done
+fi
+
einfo "creating stacked prefix ${CHILD_EPREFIX}"
#
@@ -415,6 +445,9 @@ ebegin "creating make.conf"
echo "EPREFIX=\"${CHILD_EPREFIX}\""
echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
echo "BROOT=\"${PARENT_EPREFIX}\""
+ if [[ -n ${CHILD_CHOST} ]] ; then
+ echo "CHOST=\"${CHILD_CHOST}\""
+ fi
) > "${CHILD_EPREFIX}"/etc/portage/make.conf
eend_exit $?