From 8877d7adcdd58ae505fa09450e4a42f63270069c Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Thu, 22 Apr 2021 15:39:20 +0200 Subject: [PATCH] bootstrap_sdk: use local SDK ebuilds for stage1 This change uses portage-stable and coreos-overlay from the local SDK chroot (from /var/lib/gentoo/repos) in the stage 1 SDK bootstrap build. This is part 2 of the SDK bootstrap stage 1 fix (part 1 is covered in 64d8a73ac09853a4b9b813b53299d37569c35071), which ensures stage 1 does not introduce any changes in its ebuilds over the seed SDK. The change also introduces an option to consciously divert from the above enforcement by use of command line parameters: --stage1_overlay_ref will check out coreos-overlay and use for stage 1 instead of the local SDK's /var/lib/gentoo/repos/coreos-overlay --stage1_portage_ref will check out portage-stable and use for stage 1 instead of the local SDK's /var/lib/gentoo/repos/gentoo Signed-off-by: Thilo Fromm --- bootstrap_sdk | 132 +++++++++++++++++++++++++++++--------------------- 1 file changed, 78 insertions(+), 54 deletions(-) diff --git a/bootstrap_sdk b/bootstrap_sdk index ccfba3720e..f3fb419e12 100755 --- a/bootstrap_sdk +++ b/bootstrap_sdk @@ -11,33 +11,36 @@ # For reference the procedure it performs is this: # # 1. snapshot: Grab a snapshot of the portage-stable repo from -# third_party/... . coreoy-overlay is used as-is from the same source. +# the current SDK's /var/lib/gentoo/repos/gentoo. +# Alternatively, check out a git ref specified via --portage-ref. # # 2. stage1: Using a "seed" tarball as a build environment, build a -# minimal root file system into a clean directory using ROOT=... -# and USE=-* The restricted USE flags are key be small and avoid -# circular dependencies. Tarball is built from the current SDK's -# portage-stable and coreos-overlay instead of the ones from stage1 -# since stage1 must not contain updated ebuilds (see build_stage1 below). -# This stage uses: -# - portage-stable from the SDK's /var/lib/gentoo/repos/gentoo -# - a fresh check-out of coreos-overlay at the revision used to build the SDK +# minimal root file system into a clean directory using ROOT=... +# and USE=-* The restricted USE flags are key be small and avoid +# circular dependencies. +# This stage uses: +# - portage-stable from the SDK's /var/lib/gentoo/repos/gentoo +# or a git ref via --stage1_portage_ref command line option +# - coreos-overlay from the SDK's /var/lib/gentoo/repos/coreos-overlay +# or a git ref via --stage1_overlay_ref command line option +# Command line option refs need caution though, since +# stage1 must not contain updated ebuilds (see build_stage1 below). # # 3. stage2: Run portage-stable/scripts/bootstrap.sh -# This rebuilds the toolchain using Gentoo bootstrapping, ensuring it's not linked -# to or otherwise influenced by whatever was in the "seed" tarball. -# The toolchain rebuild may contain updated package ebuilds from -# third_party/(portage-stable|coreos-overlay). -# This and all following stages use portage-stable and coreos-overlay -# from third_party/... (see 1.) +# This rebuilds the toolchain using Gentoo bootstrapping, ensuring it's not linked +# to or otherwise influenced by whatever was in the "seed" tarball. +# The toolchain rebuild may contain updated package ebuilds from +# third_party/(portage-stable|coreos-overlay). +# This and all following stages use portage-stable and coreos-overlay +# from third_party/... (see 1.) # # 4. stage3: Run emerge -e system to rebuild everything using the fresh updated -# toolchain from 3., using the normal USE flags provided by the profile. This -# will also pull in assorted base system packages that weren't included -# in the minimal environment stage1 created. +# toolchain from 3., using the normal USE flags provided by the profile. This +# will also pull in assorted base system packages that weren't included +# in the minimal environment stage1 created. # # 5. stage4: Install any extra packages or other desired tweaks. For the -# sdk we just install all the packages normally make_chroot.sh does. +# sdk we just install all the packages normally make_chroot.sh does. # # Usage: bootstrap_sdk [stage1 stage2 etc] # By default all four stages will be built using the latest stage4 as a seed. @@ -52,6 +55,13 @@ TYPE="flatcar-sdk" # include upload options . "${BUILD_LIBRARY_DIR}/release_util.sh" || exit 1 + +DEFINE_string stage1_portage_ref "" \ + "Custom portage repo git ref to use in stage 1 (USE WITH CAUTION)" +DEFINE_string stage1_overlay_ref "" \ + "Custom overlay repo git ref to use in stage 1 (USE WITH CAUTION)" + + ## Define the stage4 config template catalyst_stage4() { cat <>"$TEMPDIR/stage1.spec" + fi + # Finally, build stage 1 build_stage stage1 "$SEED" "$TEMPDIR/catalyst-stage1.conf" }