commit:     6987586f278fd5eb1683fa7e49d75dd7016278fb
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Jan  3 09:21:08 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Jan  3 09:23:53 2019 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=6987586f

scripts/bootstrap-prefix: ensure USE is picked up in stage3

Portage seems to ignore USE= environment for build dependencies in a
different location.  Since we need this to be respected in order to
avoid many cycles, temporarily encode the requested USE-flags in
use.mask and use.force.  We use the profiles/ location which should get
wiped out hereafter, but also remove the files used whilst emerging to
reduce the risk of leaving this behind in someone's setup.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 scripts/bootstrap-prefix.sh | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index d393c4d498..9f4f1bbb38 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -1452,6 +1452,22 @@ do_emerge_pkgs() {
                done
                myuse=( ${myuse} )
 
+               # Portage seems to ignore USE= for build dependencies.  Since
+               # that's what we're more or less doing all the time, encode the
+               # USE-flags in profiles/use.mask and profiles/use.force which
+               # normally do not exist.
+               rm -f "${EPREFIX}"/usr/portage/profiles/use.{mask,force}
+               for use in "${myuse[@]}" ; do
+                       case "${use}" in
+                               -*) echo "${use#-}" \
+                                               >> 
"${EPREFIX}"/usr/portage/profiles/use.mask
+                                       ;;
+                               *)  echo "${use}" \
+                                               >> 
"${EPREFIX}"/usr/portage/profiles/use.force
+                                       ;;
+                               esac
+               done
+
                # Disable the STALE warning because the snapshot frequently 
gets stale.
                #
                # Need need to spam the user about news until the emerge -e 
system
@@ -1472,6 +1488,7 @@ do_emerge_pkgs() {
                        emerge -v --oneshot --root-deps ${opts} "${pkg}" 
                )
                [[ $? -eq 0 ]] || return 1
+               rm -f "${EPREFIX}"/usr/portage/profiles/use.{mask,force}
 
                case ${pkg},${CHOST} in
                app-shells/bash,*-cygwin*)
@@ -1663,7 +1680,7 @@ bootstrap_stage3() {
                # PORTAGE_OVERRIDE_EPREFIX as BROOT is needed.
                PREROOTPATH="${ROOT}"$(echo 
/{,tmp/}{usr/,}{,lib/llvm/{10,9,8,7,6,5}/}{s,}bin | sed "s, ,:${ROOT},g") \
                EPREFIX="${ROOT}" PORTAGE_TMPDIR="${PORTAGE_TMPDIR}" \
-               PORTAGE_OVERRIDE_EPREFIX="$(rapx "${ROOT}" "${ROOT}/tmp")" \
+               PORTAGE_OVERRIDE_EPREFIX="$(rapx "${ROOT}" "${ROOT}"/tmp)" \
                FEATURES="${FEATURES} force-prefix $(rapx "" stacked-prefix)" \
                EMERGE_LOG_DIR="${ROOT}"/var/log \
                do_emerge_pkgs "$@"
@@ -1816,7 +1833,7 @@ bootstrap_stage3() {
                app-admin/eselect
                $( [[ ${CHOST} == *-cygwin* ]] && echo sys-libs/cygwin-crypt )
        )
-       # for grep we need to do a little workaround as we use llvm-3.4
+       # for grep we need to do a little workaround as we might use llvm-3.4
        # here, which doesn't necessarily grok the system headers on newer
        # OSX, confusing the buildsystem
        ac_cv_c_decl_report=warning \
@@ -1824,7 +1841,8 @@ bootstrap_stage3() {
        emerge_pkgs "" "${pkgs[@]}" || return 1
 
        if [[ ! -x "${ROOT}"/sbin/openrc-run ]]; then
-               echo "We need openrc-run at ${ROOT}/sbin to merge rsync." > 
"${ROOT}"/sbin/openrc-run
+               echo "We need openrc-run at ${ROOT}/sbin to merge rsync." \
+                       > "${ROOT}"/sbin/openrc-run
                chmod +x "${ROOT}"/sbin/openrc-run
        fi
 

Reply via email to