diff --git a/bootstrap_sdk b/bootstrap_sdk index bf094e28a7..36bda6ecca 100755 --- a/bootstrap_sdk +++ b/bootstrap_sdk @@ -4,30 +4,19 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # -# This uses Gentoo's catalyst for very thoroughly building images from -# scratch. Using images based on this will eliminate some of the hackery -# in make_chroot.sh for building up the sdk from a stock stage3 tarball. -# +# This uses Gentoo's catalyst for very thoroughly building images from scratch. # For reference the procedure it performs is this: # -# 1. snapshot: Grab a snapshot of the portage-stable repo from -# the current SDK's /var/lib/gentoo/repos/gentoo. -# Alternatively, check out a git ref specified via --portage-ref. +# 1. seed: Take a recent SDK, dev container, or custom tarball as a seed to +# build stage 1 with. Before proceeding, update relevant packages that have +# changed sub-slot to avoid missing library issues later in the build. # -# 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. +# 2. stage1: Using the above 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. # NOTE that stage1 LACKS PROPER STAGE ISOLATION. Binaries produced in stage1 -# will be linked against the SEED SDK libraries, NOT against libraries -# built in stage 1. See "stage_repo()" documentation further below for more. -# This stage uses: -# - portage-stable from the SDK's /var/lib/gentoo/repos/gentoo -# or a custom path via --stage1_portage_path command line option -# - coreos-overlay from the SDK's /var/lib/gentoo/repos/coreos-overlay -# or a custom path via --stage1_overlay_path command line option -# Command line option refs need caution though, since -# stage1 must not contain updated ebuilds (see build_stage1 below). +# will be linked against the SEED SDK libraries, NOT against libraries built +# in stage 1. # # 3. stage2: Run portage-stable/scripts/bootstrap.sh # This rebuilds the toolchain using Gentoo bootstrapping, ensuring it's not linked @@ -59,12 +48,6 @@ TYPE="flatcar-sdk" . "${BUILD_LIBRARY_DIR}/release_util.sh" || exit 1 -DEFINE_string stage1_portage_path "" \ - "Path to custom portage ebuilds tree to use in stage 1 (DANGEROUS; USE WITH CAUTION)" -DEFINE_string stage1_overlay_path "" \ - "Path to custom overlay ebuilds tree to use in stage 1 (DANGEROUS; USE WITH CAUTION)" - - ## Define the stage4 config template catalyst_stage4() { cat <>"$TEMPDIR/stage1.spec" - fi - - rm -f "${update_seed_file}" - - # Finally, build stage 1 - build_stage stage1 -} - -if [[ "$STAGES" =~ stage1 ]]; then - build_stage1 - STAGES="${STAGES/stage1/}" - SEED="${TYPE}/stage1-${ARCH}-latest" -fi - catalyst_build if [[ "$STAGES" =~ stage4 ]]; then diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index 4abef8f0ef..7712141c36 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -365,7 +365,7 @@ get_metadata() { local mirror="$(echo "${v}" | grep mirror:// | cut -d '/' -f 3)" if [ -n "${mirror}" ]; then # Take only first mirror, those not working should be removed - local location="$(grep "^${mirror}"$'\t' /var/gentoo/repos/gentoo/profiles/thirdpartymirrors | cut -d $'\t' -f 2- | cut -d ' ' -f 1 | tr -d $'\t')" + local location="$(grep "^${mirror}"$'\t' /mnt/host/source/src/third_party/portage-stable/profiles/thirdpartymirrors | cut -d $'\t' -f 2- | cut -d ' ' -f 1 | tr -d $'\t')" v="$(echo "${v}" | sed "s#mirror://${mirror}/#${location}#g")" fi new_val+="${v} " @@ -490,8 +490,7 @@ EOF license_list="$(jq -r '.[] | "\(.licenses | .[])"' "${json_input}" | sort | uniq)" local license_dirs=( "/mnt/host/source/src/third_party/coreos-overlay/licenses/" - "/mnt/host/source/src/third_party/portage-stable/" - "/var/gentoo/repos/gentoo/licenses/" + "/mnt/host/source/src/third_party/portage-stable/licenses/" "none" ) for license_file in ${license_list}; do diff --git a/build_library/catalyst.sh b/build_library/catalyst.sh index ef08aa5f8b..fab4a947c1 100644 --- a/build_library/catalyst.sh +++ b/build_library/catalyst.sh @@ -104,7 +104,8 @@ catalyst_stage1() { cat <"${update_seed_file}" diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/0001-update-profile-coreos-overlay.sh b/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/0001-update-profile-coreos-overlay.sh deleted file mode 100755 index e9a01036ae..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/0001-update-profile-coreos-overlay.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -set -x -set -euo pipefail - -stage1_repo="${1}" -new_repo="${2}" -parent_file='profiles/coreos/amd64/parent' -old_parent_line='portage-stable:default/linux/amd64/17.0/no-multilib/hardened' -stage1_parent="${stage1_repo}/${parent_file}" -new_parent="${new_repo}/${parent_file}" - -if [[ ! -e "${new_parent}" ]]; then - echo "no file '${parent_file}' in new repo, nothing to do" - exit 0 -fi - -if [[ ! -e "${stage1_parent}" ]]; then - echo "no file '${parent_file}' in stage1 repo, nothing to do" - exit 0 -fi - -if grep --quiet --fixed-strings --line-regexp --regexp="${old_parent_line}" -- "${stage1_parent}"; then - rm -f "${stage1_parent}" - cp -a "${new_parent}" "${stage1_parent}" -fi diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/0002-glibc-crypt-coreos-overlay.sh b/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/0002-glibc-crypt-coreos-overlay.sh deleted file mode 100755 index e8891c76a3..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/0002-glibc-crypt-coreos-overlay.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -set -x -set -euo pipefail - -stage1_repo=${1} -new_repo=${2} -update_seed_file=${3} - -base_profile_dir='profiles/coreos/base' - -declare -A fixups_old=( - ['package.mask']='>=virtual/libcrypt-2' - ['package.unmask']='=virtual/libcrypt-1-r1' - ['package.use.force']='sys-libs/glibc crypt' - ['package.use.mask']='sys-libs/glibc -crypt' -) - -declare -A fixups_new=( - ['package.mask']='>=virtual/libcrypt-2' - ['package.unmask']='"${ff}" - done - echo x >"${update_seed_file}" - exit 0 -done diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/README.md b/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/README.md deleted file mode 100644 index d31163fe6c..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/README.md +++ /dev/null @@ -1,18 +0,0 @@ -The scripts in this directory are called by the SDK bootstrapping -script when setting up the portage-stable and coreos-overlay repos for -the stage1 build. The scripts are invoked with two arguments - a path -to the stage1 repository, and a path to the current repository. The -difference between the two is that the stage1 repository is a copy of -a repository saved in the seed SDK (thus it's going to be an older -version of the repository), whereas the current repository is a -repository that will be a base of the new SDK. The idea here is that -something in the stage1 repository may be too old, thus it should be -replaced with its equivalent from the current repository. - -For more information about the bootstrap process, please see the -`bootstrap_sdk` script in [the scripts -repository](https://github.com/flatcar/scripts). - -The script for portage-stable should end with `-portage-stable.sh`, -and the script for coreos-overlay with '-coreos-overlay.sh`. For -example: `0000-replace-ROOTPATH-coreos-overlay.sh`.