Skip to content

Commit 1c92fe1

Browse files
committed
scripts/bootstrap-prefix: try and fix cyclic deps for nghttp2
bring back the old code which used a minimal set of USE-flags to mask which is necessary to break cycles such as one involving nghttp2 and curl. Signed-off-by: Fabian Groffen <[email protected]>
1 parent e3ce0db commit 1c92fe1

File tree

1 file changed

+59
-89
lines changed

1 file changed

+59
-89
lines changed

scripts/bootstrap-prefix.sh

+59-89
Original file line numberDiff line numberDiff line change
@@ -2447,11 +2447,14 @@ bootstrap_stage3() {
24472447
fi
24482448

24492449
# Avoid installing git or encryption just for fun while completing @system
2450-
# e.g. bug #901101
2451-
export USE="${DISABLE_USE[*]}"
2450+
# e.g. bug #901101, this is a reduced (e.g. as minimal as possible)
2451+
# set of DISABLE_USE, to set the stage for solving circular
2452+
# dependencies, such as:
2453+
# - nghttp2 -> cmake -> curl -> nghttp2
2454+
export USE="-git -crypt -http2"
24522455

24532456
# Portage should figure out itself what it needs to do, if anything.
2454-
local eflags=( "@system" )
2457+
local eflags=( "--deep" "--update" "--changed-use" "@system" )
24552458
einfo "running emerge ${eflags[*]}"
24562459
estatus "stage3: emerge ${eflags[*]}"
24572460
emerge --color n -v "${eflags[@]}" || return 1
@@ -2461,12 +2464,57 @@ bootstrap_stage3() {
24612464
# from happening, add to the worldfile #936629#c5
24622465
emerge --color n --noreplace sys-devel/binutils
24632466

2467+
# Remove the stage2 hack from above. A future emerge run will
2468+
# get env-update to happen.
2469+
rm "${ROOT}"/etc/env.d/98stage2
2470+
24642471
# now try and get things in the way they should be according to the
24652472
# default USE-flags
24662473
unset USE
24672474

2468-
# Portage should figure out itself what it needs to do, if anything.
2469-
eflags=( "--deep" "--update" "--changed-use" "@world" )
2475+
# do some sanity USE-flag enabling based on CPU, use cpuid2cpuflags
2476+
# if keyworded for this arg, else see if there's fallbacks to be
2477+
# made
2478+
mkdir -p "${ROOT}/etc/portage/package.use"
2479+
if emerge --color n --oneshot -v cpuid2cpuflags ; then
2480+
hash -r
2481+
echo "*/* $(cpuid2cpuflags)" \
2482+
> "${ROOT}/etc/portage/package.use/00cpu-flags"
2483+
else
2484+
case "${CHOST}" in
2485+
arm64-*darwin*)
2486+
# https://github.com/RustCrypto/utils/issues/378
2487+
local flags=( "aes" "sha1" "sha2" )
2488+
local line
2489+
sysctl hw.optional | while read -r line ; do
2490+
line=${line#hw.optional.}
2491+
[[ ${line%%*: } == "1" ]] || continue
2492+
line=${line%: *}
2493+
case "${line}" in
2494+
"neon")
2495+
flags+=( "${line}" )
2496+
;;
2497+
"armv8_"*)
2498+
line=${line#armv8_}
2499+
case "${line}" in
2500+
"crc32")
2501+
flags+=( "${line}" )
2502+
;;
2503+
"2_sha"*)
2504+
flags+=( "${line#2_}" )
2505+
;;
2506+
esac
2507+
;;
2508+
esac
2509+
done
2510+
echo "*/* CPU_FLAGS_ARM: ${flags}" \
2511+
> "${ROOT}/etc/portage/package.use/00cpu-flags"
2512+
;;
2513+
esac
2514+
fi
2515+
2516+
# re-emerge anything hopefully not running into circular deps
2517+
eflags=( "--deep" "--changed-use" "@world" )
24702518
einfo "running emerge ${eflags[*]}"
24712519
estatus "stage3: emerge ${eflags[*]}"
24722520
emerge --color n -v "${eflags[@]}" || return 1
@@ -2480,10 +2528,6 @@ bootstrap_stage3() {
24802528
# (--depclean may fail, which is ok)
24812529
sed -i -e 's/resume/cleared/' "${ROOT}"/var/cache/edb/mtimedb
24822530

2483-
# Remove the stage2 hack from above. A future emerge run will
2484-
# get env-update to happen.
2485-
rm "${ROOT}"/etc/env.d/98stage2
2486-
24872531
estatus "stage3 finished"
24882532
einfo "stage3 successfully finished"
24892533
}
@@ -3145,7 +3189,7 @@ OK! I'm going to give it a try, this is what I have collected sofar:
31453189
I'm now going to make an awful lot of noise going through a sequence of
31463190
stages to make your box as groovy as I am myself, setting up your
31473191
Prefix. In short, I'm going to run stage1, stage2, stage3, followed by
3148-
an emerge to do a final update to your system. If any of these stages
3192+
installing a package to enter your Prefix. If any of these stages
31493193
fail, both you and me are in deep trouble. So let's hope that doesn't
31503194
happen.
31513195
EOF
@@ -3304,87 +3348,13 @@ EOF
33043348

33053349
[[ ${STOP_BOOTSTRAP_AFTER} == stage3 ]] && exit 0
33063350

3307-
# do some sanity USE-flag enabling based on CPU, use cpuid2cpuflags
3308-
# if keyworded for this arg, else see if there's fallbacks to be
3309-
# made
3310-
mkdir -p "${EPREFIX}/etc/portage/package.use"
3311-
if emerge -1v cpuid2cpuflags ; then
3312-
hash -r
3313-
echo "*/* $(cpuid2cpuflags)" \
3314-
> "${EPREFIX}/etc/portage/package.use/00cpu-flags"
3315-
else
3316-
case "${CHOST}" in
3317-
arm64-*darwin*)
3318-
# https://github.com/RustCrypto/utils/issues/378
3319-
local flags=( "aes" "sha1" "sha2" )
3320-
local line
3321-
sysctl hw.optional | while read -r line ; do
3322-
line=${line#hw.optional.}
3323-
[[ ${line%%*: } == "1" ]] || continue
3324-
line=${line%: *}
3325-
case "${line}" in
3326-
"neon")
3327-
flags+=( "${line}" )
3328-
;;
3329-
"armv8_"*)
3330-
line=${line#armv8_}
3331-
case "${line}" in
3332-
"crc32")
3333-
flags+=( "${line}" )
3334-
;;
3335-
"2_sha"*)
3336-
flags+=( "${line#2_}" )
3337-
;;
3338-
esac
3339-
;;
3340-
esac
3341-
done
3342-
echo "*/* CPU_FLAGS_ARM: ${flags}" \
3343-
> "${EPREFIX}/etc/portage/package.use/00cpu-flags"
3344-
;;
3345-
esac
3351+
# Now, we've got everything in $ROOT, we can get rid of /tmp
3352+
if [[ -d ${EPREFIX}/tmp/var/tmp ]] ; then
3353+
rm -Rf "${EPREFIX}"/tmp || return 1
3354+
mkdir -p "${EPREFIX}"/tmp || return 1
33463355
fi
33473356

3348-
local cmd="emerge -v --deep --update --changed-use @world"
3349-
if [[ -e ${EPREFIX}/var/cache/edb/mtimedb ]] && \
3350-
grep -q resume "${EPREFIX}"/var/cache/edb/mtimedb ;
3351-
then
3352-
cmd="emerge -v --resume"
3353-
fi
3354-
einfo "running ${cmd}"
3355-
if ${cmd} ; then
3356-
# Now, we've got everything in $ROOT, we can get rid of /tmp
3357-
if [[ -d ${EPREFIX}/tmp/var/tmp ]] ; then
3358-
rm -Rf "${EPREFIX}"/tmp || return 1
3359-
mkdir -p "${EPREFIX}"/tmp || return 1
3360-
fi
3361-
3362-
hash -r # tmp/* stuff is removed in stage3
3363-
else
3364-
# emerge @world fail
3365-
cat << EOF
3366-
3367-
Oh yeah, I thought I was almost there, and then this! I did
3368-
${cmd}
3369-
and it failed at some point :( Details might be found in the build log:
3370-
EOF
3371-
for log in "${EPREFIX}"/var/tmp/portage/*/*/temp/build.log ; do
3372-
[[ -e ${log} ]] || continue
3373-
echo " ${log}"
3374-
done
3375-
[[ -e ${log} ]] || echo " (no build logs found?!?)"
3376-
cat << EOF
3377-
I have no clue, really. Please find friendly folks in #gentoo-prefix on
3378-
irc.gentoo.org, [email protected] mailing list, or file a bug
3379-
at bugs.gentoo.org under Gentoo/Alt, Prefix Support.
3380-
You know, I got the feeling you just started to like me, but I guess
3381-
that's all gone now. I'll bother you no longer.
3382-
3383-
CHOST: ${CHOST}
3384-
IDENT: ${CHOST_IDENTIFY}
3385-
EOF
3386-
exit 1
3387-
fi
3357+
hash -r # tmp/* stuff is removed in stage3
33883358

33893359
if ! bash "${BASH_SOURCE[0]}" "${EPREFIX}" startscript ; then
33903360
# startscript fail?

0 commit comments

Comments
 (0)