mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-06 04:26:59 +02:00
Upgrade to Catalyst 4
Catalyst 4 has totally changed the way repositories are handled. It only works when the name of the directory containing the repository matches the configured name of that repository. This was not the case for us, with the coreos repository residing in the coreos-overlay directory. We wanted to move and rename our repositories anyway, but this is a big change, so we'll do separately. For now, this just renames coreos to coreos-overlay. Catalyst 4 also ingests the main repository snapshot as a squashfs rather than a tarball. It features a utility to generate such a snapshot, but it doesn't fit Flatcar well, particularly because it expects each ebuild repository to reside at the top level of its own git repository. It was very easy to call tar2sqfs manually though. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This commit is contained in:
parent
8d8be98228
commit
1d7d53fad9
@ -7,9 +7,9 @@
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
@ -68,15 +68,14 @@ DEFINE_string stage1_overlay_path "" \
|
||||
## Define the stage4 config template
|
||||
catalyst_stage4() {
|
||||
cat <<EOF
|
||||
target: stage4
|
||||
pkgcache_path: $BINPKGS
|
||||
stage4/packages: coreos-devel/sdk-depends
|
||||
stage4/fsscript: ${BUILD_LIBRARY_DIR}/catalyst_sdk.sh
|
||||
stage4/root_overlay: ${ROOT_OVERLAY}
|
||||
stage4/empty: /etc/portage/repos.conf /root /usr/portage /var/cache/edb
|
||||
stage4/empty: /root /var/cache/edb
|
||||
stage4/rm: /etc/machine-id /etc/resolv.conf
|
||||
EOF
|
||||
catalyst_stage_default
|
||||
catalyst_stage_default 4
|
||||
}
|
||||
|
||||
# Switch to HTTP because early boostrap stages do not have SSL support.
|
||||
@ -118,7 +117,7 @@ cp "${BUILD_LIBRARY_DIR}/toolchain_util.sh" "${ROOT_OVERLAY}/tmp"
|
||||
#
|
||||
# No package updates must happen in stage 1, so we use the portage-stable and
|
||||
# coreos-overlay paths included with the current SDK (from the SDK chroot's
|
||||
# /var/lib/gentoo/repos/). "Current SDK" refers to the SDK we entered with
|
||||
# /var/gentoo/repos/). "Current SDK" refers to the SDK we entered with
|
||||
# 'cork enter', i.e. the SDK we run ./bootstrap_sdk in.
|
||||
#
|
||||
# Using ebuilds from the above mentioned sources will ensure that stage 1 builds
|
||||
@ -148,39 +147,39 @@ stage_repo() {
|
||||
local path=${2}
|
||||
local dest=${3}
|
||||
local update_seed_file=${4}
|
||||
local gitname="$repo"
|
||||
|
||||
if [ "$gitname" = "gentoo" ] ; then
|
||||
gitname="portage-stable"
|
||||
fi
|
||||
mkdir "$dest/$repo"
|
||||
|
||||
if [ -z "$path" ]; then
|
||||
cp -R "/var/gentoo/repos/${repo}" "$dest"
|
||||
info "Using local SDK's ebuild repo '$repo' ('$gitname') in stage 1."
|
||||
case "$repo" in
|
||||
portage-stable) path=gentoo ;;
|
||||
*) path=${repo} ;;
|
||||
esac
|
||||
cp -R --reflink=auto "/var/gentoo/repos/${path}/"* "$dest/${repo}/"
|
||||
info "Using local SDK's ebuild repo '$repo' in stage 1."
|
||||
else
|
||||
mkdir "$dest/$repo"
|
||||
cp -R "${path}/"* "$dest/${repo}/"
|
||||
info "Using custom path '$path' for ebuild repo '$repo' ('$gitname') in stage 1."
|
||||
cp -R --reflink=auto "${path}/"* "$dest/${repo}/"
|
||||
info "Using custom path '$path' for ebuild repo '$repo' in stage 1."
|
||||
info "This may break stage 2. YOU HAVE BEEN WARNED. You break it, you keep it."
|
||||
fi
|
||||
(
|
||||
set -euo pipefail
|
||||
local repo_var hook name
|
||||
|
||||
# FLAGS_coreos_overlay for gitname coreos-overlay
|
||||
repo_var="FLAGS_${gitname//-/_}"
|
||||
# FLAGS_coreos_overlay for coreos-overlay
|
||||
repo_var="FLAGS_${repo//-/_}"
|
||||
shopt -s nullglob
|
||||
for hook in "${FLAGS_coreos_overlay}/coreos/stage1_hooks/"*"-${gitname}.sh"; do
|
||||
for hook in "${FLAGS_coreos_overlay}/coreos/stage1_hooks/"*"-${repo}.sh"; do
|
||||
name=${hook##*/}
|
||||
name=${name%"-${gitname}.sh"}
|
||||
info "Invoking stage1 ${gitname} hook ${name} on ${dest}/${repo}"
|
||||
name=${name%"-${repo}.sh"}
|
||||
info "Invoking stage1 ${repo} hook ${name} on ${dest}/${repo}"
|
||||
"${hook}" "${dest}/${repo}" "${!repo_var}" "${update_seed_file}"
|
||||
done
|
||||
)
|
||||
}
|
||||
|
||||
build_stage1() {
|
||||
# First, write out the default 4-stage catalyst configuration files
|
||||
# First, write out the default catalyst configuration files
|
||||
write_configs
|
||||
|
||||
# Prepare local copies of both the "known-good" portage-stable and the
|
||||
@ -196,22 +195,16 @@ build_stage1() {
|
||||
|
||||
# prepare ebuild repos for stage 1, either from the local SDK (default)
|
||||
# or from custom paths specified via command line flags
|
||||
stage_repo "gentoo" "${FLAGS_stage1_portage_path}" "$stage1_repos" "${update_seed_file}"
|
||||
stage_repo "portage-stable" "${FLAGS_stage1_portage_path}" "$stage1_repos" "${update_seed_file}"
|
||||
stage_repo "coreos-overlay" "${FLAGS_stage1_overlay_path}" "$stage1_repos" "${update_seed_file}"
|
||||
|
||||
# Create a snapshot of "known-good" portage-stable repo copy for use in stage 1
|
||||
# This requires us to create a custom catalyst config to point it to the
|
||||
# repo copy we just created, for snapshotting.
|
||||
catalyst_conf > "$TEMPDIR/catalyst-stage1.conf"
|
||||
sed -i "s:^portdir.*:portdir=\"$stage1_repos/gentoo\":" \
|
||||
"$TEMPDIR/catalyst-stage1.conf"
|
||||
# take the "portage directory" (portage-stable copy) snapshot
|
||||
build_snapshot "${TEMPDIR}/catalyst-stage1.conf" "${FLAGS_version}-stage1"
|
||||
build_snapshot "$stage1_repos/portage-stable" "${FLAGS_version}-stage1"
|
||||
|
||||
# Update the stage 1 spec to use the "known-good" portage-stable snapshot
|
||||
# and coreos-overlay copy repository versions from above.
|
||||
sed -i -e "s/^snapshot:.*/snapshot: $FLAGS_version-stage1/" \
|
||||
-e "s,^portage_overlay:.*,portage_overlay: $stage1_repos/coreos-overlay," \
|
||||
sed -i -e "s/^snapshot_treeish:.*/snapshot_treeish: $FLAGS_version-stage1/" \
|
||||
-e "s,^repos:.*,repos: $stage1_repos/coreos-overlay," \
|
||||
"$TEMPDIR/stage1.spec"
|
||||
|
||||
# If we are to use a custom path for either ebuild repo we want to update the stage1 seed SDK
|
||||
@ -220,10 +213,11 @@ build_stage1() {
|
||||
echo "update_seed_command: --update --deep --newuse --complete-graph --rebuild-if-new-ver --rebuild-exclude cross-*-cros-linux-gnu/* sys-devel/gcc " \
|
||||
>>"$TEMPDIR/stage1.spec"
|
||||
fi
|
||||
|
||||
rm -f "${update_seed_file}"
|
||||
|
||||
# Finally, build stage 1
|
||||
build_stage stage1 "$SEED" "$TEMPDIR/catalyst-stage1.conf"
|
||||
build_stage stage1
|
||||
}
|
||||
|
||||
if [[ "$STAGES" =~ stage1 ]]; then
|
||||
|
@ -55,17 +55,15 @@ DEFINE_boolean debug ${FLAGS_FALSE} "Enable verbose output from catalyst."
|
||||
catalyst_conf() {
|
||||
cat <<EOF
|
||||
# catalyst.conf
|
||||
contents="auto"
|
||||
digests="md5 sha1 sha512 whirlpool"
|
||||
hash_function="crc32"
|
||||
options="pkgcache"
|
||||
digests=["md5", "sha1", "sha512", "blake2b"]
|
||||
options=["pkgcache"]
|
||||
sharedir="/usr/share/catalyst"
|
||||
storedir="$CATALYST_ROOT"
|
||||
distdir="$DISTDIR"
|
||||
envscript="$TEMPDIR/catalystrc"
|
||||
port_logdir="$CATALYST_ROOT/log"
|
||||
portdir="$FLAGS_portage_stable"
|
||||
snapshot_cache="$CATALYST_ROOT/tmp/snapshot_cache"
|
||||
repo_basedir="/mnt/host/source/src/third_party"
|
||||
repo_name="portage-stable"
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -82,61 +80,48 @@ export ac_cv_posix_semaphores_enabled=yes
|
||||
EOF
|
||||
}
|
||||
|
||||
repos_conf() {
|
||||
cat <<EOF
|
||||
[DEFAULT]
|
||||
main-repo = portage-stable
|
||||
|
||||
[coreos]
|
||||
location = /var/gentoo/repos/local
|
||||
|
||||
[portage-stable]
|
||||
location = /var/gentoo/repos/gentoo
|
||||
EOF
|
||||
}
|
||||
|
||||
# Common values for all stage spec files
|
||||
catalyst_stage_default() {
|
||||
cat <<EOF
|
||||
target: stage$1
|
||||
subarch: $ARCH
|
||||
rel_type: $TYPE
|
||||
portage_confdir: $TEMPDIR/portage
|
||||
portage_overlay: $FLAGS_coreos_overlay
|
||||
repos: $FLAGS_coreos_overlay
|
||||
keep_repos: portage-stable coreos-overlay
|
||||
profile: $FLAGS_profile
|
||||
snapshot: $FLAGS_version
|
||||
snapshot_treeish: $FLAGS_version
|
||||
version_stamp: $FLAGS_version
|
||||
cflags: -O2 -pipe
|
||||
cxxflags: -O2 -pipe
|
||||
ldflags: -Wl,-O2 -Wl,--as-needed
|
||||
source_subpath: ${SEED}
|
||||
EOF
|
||||
}
|
||||
|
||||
# Config values for each stage
|
||||
catalyst_stage1() {
|
||||
cat <<EOF
|
||||
target: stage1
|
||||
# stage1 packages aren't published, save in tmp
|
||||
pkgcache_path: ${TEMPDIR}/stage1-${ARCH}-packages
|
||||
update_seed: no
|
||||
EOF
|
||||
catalyst_stage_default
|
||||
catalyst_stage_default 1
|
||||
}
|
||||
|
||||
catalyst_stage2() {
|
||||
cat <<EOF
|
||||
target: stage2
|
||||
# stage2 packages aren't published, save in tmp
|
||||
pkgcache_path: ${TEMPDIR}/stage2-${ARCH}-packages
|
||||
EOF
|
||||
catalyst_stage_default
|
||||
catalyst_stage_default 2
|
||||
}
|
||||
|
||||
catalyst_stage3() {
|
||||
cat <<EOF
|
||||
target: stage3
|
||||
pkgcache_path: $BINPKGS
|
||||
EOF
|
||||
catalyst_stage_default
|
||||
catalyst_stage_default 3
|
||||
}
|
||||
|
||||
catalyst_stage4() {
|
||||
@ -207,8 +192,8 @@ catalyst_init() {
|
||||
# so far so good, expand path to work with weird comparison code below
|
||||
FLAGS_seed_tarball=$(readlink -f "$FLAGS_seed_tarball")
|
||||
|
||||
if [[ ! "$FLAGS_seed_tarball" =~ .*\.tar\.bz2 ]]; then
|
||||
die_notrace "Seed tarball doesn't end in .tar.bz2 :-/"
|
||||
if [[ ! "$FLAGS_seed_tarball" =~ .\.tar\.(bz2|xz) ]]; then
|
||||
die_notrace "Seed tarball doesn't end in .tar.bz2 or .tar.xz :-/"
|
||||
fi
|
||||
|
||||
# catalyst is obnoxious and wants the $TYPE/stage3-$VERSION part of the
|
||||
@ -216,49 +201,41 @@ catalyst_init() {
|
||||
# directory under $TEMPDIR instead, aka the SEEDCACHE feature.)
|
||||
if [[ "$FLAGS_seed_tarball" =~ "$CATALYST_ROOT/builds/".* ]]; then
|
||||
SEED="${FLAGS_seed_tarball#$CATALYST_ROOT/builds/}"
|
||||
SEED="${SEED%.tar.bz2}"
|
||||
SEED="${SEED%.tar.*}"
|
||||
else
|
||||
mkdir -p "$CATALYST_ROOT/builds/seed"
|
||||
cp -n "$FLAGS_seed_tarball" "$CATALYST_ROOT/builds/seed"
|
||||
SEED="seed/${FLAGS_seed_tarball##*/}"
|
||||
SEED="${SEED%.tar.bz2}"
|
||||
SEED="${SEED%.tar.*}"
|
||||
fi
|
||||
}
|
||||
|
||||
write_configs() {
|
||||
info "Creating output directories..."
|
||||
mkdir -m 775 -p "$TEMPDIR/portage/repos.conf" "$DISTDIR"
|
||||
mkdir -m 775 -p "$DISTDIR"
|
||||
chown portage:portage "$DISTDIR"
|
||||
info "Writing out catalyst configs..."
|
||||
info " catalyst.conf"
|
||||
catalyst_conf > "$TEMPDIR/catalyst.conf"
|
||||
info " catalystrc"
|
||||
catalystrc > "$TEMPDIR/catalystrc"
|
||||
info " portage/repos.conf/coreos.conf"
|
||||
repos_conf > "$TEMPDIR/portage/repos.conf/coreos.conf"
|
||||
info " stage1.spec"
|
||||
catalyst_stage1 > "$TEMPDIR/stage1.spec"
|
||||
info " stage2.spec"
|
||||
catalyst_stage2 > "$TEMPDIR/stage2.spec"
|
||||
info " stage3.spec"
|
||||
catalyst_stage3 > "$TEMPDIR/stage3.spec"
|
||||
info " stage4.spec"
|
||||
catalyst_stage4 > "$TEMPDIR/stage4.spec"
|
||||
info "Putting a symlink to user patches..."
|
||||
ln -sfT '/var/gentoo/repos/local/coreos/user-patches' \
|
||||
"$TEMPDIR/portage/patches"
|
||||
|
||||
info "Configuring Portage..."
|
||||
cp -r "${BUILD_LIBRARY_DIR}"/portage/ "${TEMPDIR}/"
|
||||
|
||||
ln -sfT '/var/gentoo/repos/coreos-overlay/coreos/user-patches' \
|
||||
"${TEMPDIR}"/portage/patches
|
||||
}
|
||||
|
||||
build_stage() {
|
||||
local stage srcpath catalyst_conf target_tarball
|
||||
local stage catalyst_conf target_tarball
|
||||
|
||||
stage="$1"
|
||||
srcpath="$2"
|
||||
catalyst_conf="$3"
|
||||
catalyst_conf="$TEMPDIR/catalyst.conf"
|
||||
target_tarball="${stage}-${ARCH}-${FLAGS_version}.tar.bz2"
|
||||
|
||||
[ -z "$catalyst_conf" ] && catalyst_conf="$TEMPDIR/catalyst.conf"
|
||||
|
||||
if [[ -f "$BUILDS/${target_tarball}" && $FLAGS_rebuild == $FLAGS_FALSE ]]
|
||||
then
|
||||
info "Skipping $stage, $target_tarball already exists."
|
||||
@ -270,8 +247,7 @@ build_stage() {
|
||||
"${DEBUG[@]}" \
|
||||
--verbose \
|
||||
--config "$TEMPDIR/catalyst.conf" \
|
||||
--file "$TEMPDIR/${stage}.spec" \
|
||||
--cli "source_subpath=$srcpath"
|
||||
--file "$TEMPDIR/${stage}.spec"
|
||||
# Catalyst does not clean up after itself...
|
||||
rm -rf "$TEMPDIR/$stage-${ARCH}-${FLAGS_version}"
|
||||
ln -sf "$stage-${ARCH}-${FLAGS_version}.tar.bz2" \
|
||||
@ -280,46 +256,19 @@ build_stage() {
|
||||
}
|
||||
|
||||
build_snapshot() {
|
||||
local catalyst_conf snapshot snapshots_dir snapshot_base snapshot_path
|
||||
local repo_dir snapshot snapshots_dir snapshot_path
|
||||
|
||||
catalyst_conf=${1:-"${TEMPDIR}/catalyst.conf"}
|
||||
repo_dir=${1:-"${FLAGS_portage_stable}"}
|
||||
snapshot=${2:-"${FLAGS_version}"}
|
||||
snapshots_dir="${CATALYST_ROOT}/snapshots"
|
||||
snapshot_base="${snapshots_dir}/gentoo-${snapshot}"
|
||||
snapshot_path="${snapshot_base}.tar.bz2"
|
||||
if [[ -f "${snapshot_path}" && $FLAGS_rebuild == $FLAGS_FALSE ]]
|
||||
snapshot_path="${snapshots_dir}/portage-stable-${snapshot}.sqfs"
|
||||
if [[ -f ${snapshot_path} && $FLAGS_rebuild == $FLAGS_FALSE ]]
|
||||
then
|
||||
info "Skipping snapshot, ${snapshot_path} exists"
|
||||
else
|
||||
info "Creating snapshot ${snapshot_path}"
|
||||
catalyst \
|
||||
"${DEBUG[@]}" \
|
||||
--verbose \
|
||||
--config "${catalyst_conf}" \
|
||||
--snapshot "${snapshot}"
|
||||
fi
|
||||
local f
|
||||
local to_remove=()
|
||||
# This will expand to at least our just built snapshot tarball, so
|
||||
# no nullglob is needed here.
|
||||
for f in "${snapshot_base}".*; do
|
||||
case "${f}" in
|
||||
"${snapshot_path}")
|
||||
# Our snapshot, keep it as is.
|
||||
:
|
||||
;;
|
||||
*.CONTENTS|*.CONTENTS.gz|*.DIGESTS)
|
||||
# These can stay, catalyst is not bothered by those.
|
||||
:
|
||||
;;
|
||||
*)
|
||||
to_remove+=("${f}")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
if [[ ${#to_remove[@]} -gt 0 ]]; then
|
||||
info "$(printf '%s\n' 'Found spurious files in snapshots directory that may confuse Catalyst, removing them:' "${to_remove[@]}")"
|
||||
rm -rf "${to_remove[@]}"
|
||||
mkdir -p "${snapshot_path%/*}"
|
||||
tar -c -C "${repo_dir}" . | tar2sqfs "${snapshot_path}" -q -f -j1 -c gzip
|
||||
fi
|
||||
}
|
||||
|
||||
@ -335,7 +284,7 @@ catalyst_build() {
|
||||
|
||||
used_seed=0
|
||||
if [[ "$STAGES" =~ stage1 ]]; then
|
||||
build_stage stage1 "$SEED"
|
||||
build_stage stage1
|
||||
used_seed=1
|
||||
fi
|
||||
|
||||
@ -343,7 +292,9 @@ catalyst_build() {
|
||||
if [[ $used_seed -eq 1 ]]; then
|
||||
SEED="${TYPE}/stage1-${ARCH}-latest"
|
||||
fi
|
||||
build_stage stage2 "$SEED"
|
||||
info " stage2.spec"
|
||||
catalyst_stage2 > "$TEMPDIR/stage2.spec"
|
||||
build_stage stage2
|
||||
used_seed=1
|
||||
fi
|
||||
|
||||
@ -351,7 +302,9 @@ catalyst_build() {
|
||||
if [[ $used_seed -eq 1 ]]; then
|
||||
SEED="${TYPE}/stage2-${ARCH}-latest"
|
||||
fi
|
||||
build_stage stage3 "$SEED"
|
||||
info " stage3.spec"
|
||||
catalyst_stage3 > "$TEMPDIR/stage3.spec"
|
||||
build_stage stage3
|
||||
used_seed=1
|
||||
fi
|
||||
|
||||
@ -359,10 +312,12 @@ catalyst_build() {
|
||||
if [[ $used_seed -eq 1 ]]; then
|
||||
SEED="${TYPE}/stage3-${ARCH}-latest"
|
||||
fi
|
||||
build_stage stage4 "$SEED"
|
||||
info " stage4.spec"
|
||||
catalyst_stage4 > "$TEMPDIR/stage4.spec"
|
||||
build_stage stage4
|
||||
used_seed=1
|
||||
fi
|
||||
|
||||
# Cleanup snapshots, we don't use them
|
||||
rm -rf "$CATALYST_ROOT/snapshots/gentoo-${FLAGS_version}.tar.bz2"*
|
||||
rm -rf "$CATALYST_ROOT/snapshots/${FLAGS_portage_stable##*/}-${FLAGS_version}.sqfs"*
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ echo "Setting the default Python interpreter"
|
||||
eselect python update
|
||||
|
||||
echo "Building cross toolchain for the SDK."
|
||||
configure_crossdev_overlay / /tmp/crossdev
|
||||
configure_crossdev_overlay / /usr/local/portage/crossdev
|
||||
|
||||
for cross_chost in $(get_chost_list); do
|
||||
echo "Building cross toolchain for ${cross_chost}"
|
||||
@ -21,10 +21,11 @@ for cross_chost in $(get_chost_list); do
|
||||
install_cross_rust "${cross_chost}" ${clst_myemergeopts}
|
||||
done
|
||||
|
||||
echo "Saving snapshot of coreos-overlay repo for future SDK bootstraps"
|
||||
# Copy coreos-overlay, which is in /var/gentoo/repos/local/, into a
|
||||
# local directory. /var/gentoo/repos/local/ is removed before archiving
|
||||
# and we want to keep a snapshot. This snapshot is used - alongside
|
||||
# /var/gentoo/repos/gentoo - by stage 1 of future bootstraps.
|
||||
mkdir -p /var/gentoo/repos/coreos-overlay
|
||||
cp -R /var/gentoo/repos/local/* /var/gentoo/repos/coreos-overlay
|
||||
echo "Saving snapshot of repos for future SDK bootstraps"
|
||||
# Copy portage-stable and coreos-overlay, which are under
|
||||
# /mnt/host/source/src/third_party, into a local directory because they are
|
||||
# removed before archiving and we want to keep snapshots. These snapshots are
|
||||
# used by stage 1 in future bootstraps.
|
||||
mkdir -p /var/gentoo/repos/{gentoo,coreos-overlay}
|
||||
cp -R /mnt/host/source/src/third_party/portage-stable/* /var/gentoo/repos/gentoo/
|
||||
cp -R /mnt/host/source/src/third_party/coreos-overlay/* /var/gentoo/repos/coreos-overlay/
|
||||
|
@ -37,7 +37,7 @@ build_target_toolchain() {
|
||||
run_merge -u --root="$ROOT" --sysroot="$ROOT" "${TOOLCHAIN_PKGS[@]}"
|
||||
}
|
||||
|
||||
configure_crossdev_overlay / /tmp/crossdev
|
||||
configure_crossdev_overlay / /usr/local/portage/crossdev
|
||||
|
||||
for board in $(get_board_list); do
|
||||
echo "Building native toolchain for ${board}"
|
||||
|
@ -42,22 +42,24 @@ PORTAGE_BINHOST="$(get_binhost_url "${binhost}" "${update_group}" 'pkgs')
|
||||
$(get_binhost_url "${binhost}" "${update_group}" 'toolchain')"
|
||||
EOF
|
||||
|
||||
sudo_clobber "${root_fs_dir}/etc/portage/repos.conf/coreos.conf" <<EOF
|
||||
sudo_clobber "${root_fs_dir}/etc/portage/repos.conf/portage-stable.conf" <<EOF
|
||||
[DEFAULT]
|
||||
main-repo = portage-stable
|
||||
|
||||
[coreos]
|
||||
location = /var/lib/portage/coreos-overlay
|
||||
|
||||
[portage-stable]
|
||||
location = /var/lib/portage/portage-stable
|
||||
EOF
|
||||
|
||||
sudo_clobber "${root_fs_dir}/etc/portage/repos.conf/coreos-overlay.conf" <<EOF
|
||||
[coreos-overlay]
|
||||
location = /var/lib/portage/coreos-overlay
|
||||
EOF
|
||||
|
||||
# Now set the correct profile, we do not use the eselect tool - it
|
||||
# does not seem to be usable outside of the chroot without using
|
||||
# deprecated PORTDIR and PORTDIR_OVERLAY environment variables.
|
||||
local profile_name=$(get_board_profile "${BOARD}")
|
||||
# Turn coreos:coreos/amd64/generic into coreos/amd64/generic/dev
|
||||
# Turn coreos-overlay:coreos/amd64/generic into coreos/amd64/generic/dev
|
||||
profile_name="${profile_name#*:}/dev"
|
||||
local profile_directory="${root_fs_dir}/var/lib/portage/coreos-overlay/profiles/${profile_name}"
|
||||
if [[ ! -d "${profile_directory}" ]]; then
|
||||
|
@ -0,0 +1,10 @@
|
||||
# need this here because of stage1
|
||||
app-alternatives/awk gawk
|
||||
app-alternatives/bc gnu
|
||||
app-alternatives/bzip2 reference
|
||||
app-alternatives/cpio gnu
|
||||
app-alternatives/gzip reference
|
||||
app-alternatives/lex flex
|
||||
app-alternatives/sh bash
|
||||
app-alternatives/tar gnu
|
||||
app-alternatives/yacc bison
|
@ -14,18 +14,18 @@ TOOLCHAIN_PKGS=(
|
||||
# This is only used as an intermediate step to be able to use the cross
|
||||
# compiler to build a full native toolchain. Packages are not uploaded.
|
||||
declare -A CROSS_PROFILES
|
||||
CROSS_PROFILES["x86_64-cros-linux-gnu"]="coreos:coreos/amd64/generic"
|
||||
CROSS_PROFILES["aarch64-cros-linux-gnu"]="coreos:coreos/arm64/generic"
|
||||
CROSS_PROFILES["x86_64-cros-linux-gnu"]="coreos-overlay:coreos/amd64/generic"
|
||||
CROSS_PROFILES["aarch64-cros-linux-gnu"]="coreos-overlay:coreos/arm64/generic"
|
||||
|
||||
# Map board names to CHOSTs and portage profiles. This is the
|
||||
# definitive list, there is assorted code new and old that either
|
||||
# guesses or hard-code these. All that should migrate to this list.
|
||||
declare -A BOARD_CHOSTS BOARD_PROFILES
|
||||
BOARD_CHOSTS["amd64-usr"]="x86_64-cros-linux-gnu"
|
||||
BOARD_PROFILES["amd64-usr"]="coreos:coreos/amd64/generic"
|
||||
BOARD_PROFILES["amd64-usr"]="coreos-overlay:coreos/amd64/generic"
|
||||
|
||||
BOARD_CHOSTS["arm64-usr"]="aarch64-cros-linux-gnu"
|
||||
BOARD_PROFILES["arm64-usr"]="coreos:coreos/arm64/generic"
|
||||
BOARD_PROFILES["arm64-usr"]="coreos-overlay:coreos/arm64/generic"
|
||||
|
||||
BOARD_NAMES=( "${!BOARD_CHOSTS[@]}" )
|
||||
|
||||
@ -169,7 +169,7 @@ get_sdk_arch() {
|
||||
}
|
||||
|
||||
get_sdk_profile() {
|
||||
echo "coreos:coreos/$(get_sdk_arch)/sdk"
|
||||
echo "coreos-overlay:coreos/$(get_sdk_arch)/sdk"
|
||||
}
|
||||
|
||||
get_sdk_libdir() {
|
||||
@ -244,7 +244,7 @@ configure_crossdev_overlay() {
|
||||
echo "x-crossdev" | \
|
||||
"${sudo[@]}" tee "${root}${location}/profiles/repo_name" > /dev/null
|
||||
"${sudo[@]}" tee "${root}${location}/metadata/layout.conf" > /dev/null <<EOF
|
||||
masters = portage-stable coreos
|
||||
masters = portage-stable coreos-overlay
|
||||
use-manifests = true
|
||||
thin-manifests = true
|
||||
EOF
|
||||
@ -271,7 +271,7 @@ _get_dependency_list() {
|
||||
|
||||
# Configure a new ROOT
|
||||
# Values are copied from the environment or the current host configuration.
|
||||
# Usage: CBUILD=foo-bar-linux-gnu ROOT=/foo/bar SYSROOT=/foo/bar configure_portage coreos:some/profile
|
||||
# Usage: CBUILD=foo-bar-linux-gnu ROOT=/foo/bar SYSROOT=/foo/bar configure_portage coreos-overlay:some/profile
|
||||
# Note: if using portageq to get CBUILD it must be called before CHOST is set.
|
||||
_configure_sysroot() {
|
||||
local profile="$1"
|
||||
@ -287,7 +287,7 @@ _configure_sysroot() {
|
||||
"${sudo[@]}" eselect profile set --force "$profile"
|
||||
|
||||
local coreos_path
|
||||
coreos_path=$(portageq get_repo_path "${ROOT}" coreos)
|
||||
coreos_path=$(portageq get_repo_path "${ROOT}" coreos-overlay)
|
||||
"${sudo[@]}" ln -sfT "${coreos_path}/coreos/user-patches" "${ROOT}/etc/portage/patches"
|
||||
|
||||
echo "Writing make.conf for the sysroot ${SYSROOT}, root ${ROOT}"
|
||||
|
@ -553,7 +553,7 @@ install_oem_sysext() {
|
||||
--metapkgs="${metapkg}"
|
||||
)
|
||||
local overlay_path mangle_fs
|
||||
overlay_path=$(portageq get_repo_path / coreos)
|
||||
overlay_path=$(portageq get_repo_path / coreos-overlay)
|
||||
mangle_fs="${overlay_path}/${metapkg}/files/manglefs.sh"
|
||||
if [[ -x "${mangle_fs}" ]]; then
|
||||
build_sysext_flags+=(
|
||||
|
@ -18,13 +18,12 @@ FORCE_STAGES="stage4"
|
||||
## Define the stage4 config template
|
||||
catalyst_stage4() {
|
||||
cat <<EOF
|
||||
target: stage4
|
||||
pkgcache_path: $BINPKGS
|
||||
stage4/packages: @system
|
||||
stage4/fsscript: ${BUILD_LIBRARY_DIR}/catalyst_toolchains.sh
|
||||
stage4/root_overlay: ${ROOT_OVERLAY}
|
||||
EOF
|
||||
catalyst_stage_default
|
||||
catalyst_stage_default 4
|
||||
}
|
||||
create_provenance_overlay() {
|
||||
local root_overlay="$1"
|
||||
|
1
changelog/changes/2024-07-15-repo-rename.md
Normal file
1
changelog/changes/2024-07-15-repo-rename.md
Normal file
@ -0,0 +1 @@
|
||||
- As part of the update to Catalyst 4 (used to build the SDK), the coreos package repository has been renamed to coreos-overlay to match its directory name. This will be reflected in package listings and package manager output. ([flatcar/scripts#2115](https://github.com/flatcar/scripts/pull/2115))
|
@ -7,6 +7,9 @@
|
||||
# Gentoo upstream package stabilisation
|
||||
# (the following packages are "unstable" upstream; we're stabilising these)
|
||||
|
||||
# Catalyst 4 is not stable yet, but earlier versions are masked now.
|
||||
dev-util/catalyst ~amd64 ~arm64
|
||||
|
||||
=app-containers/containerd-1.7.19 ~amd64 ~arm64 # DO NOT EDIT THIS LINE. Added by containerd-apply-patch.sh on 2024-07-05 08:17:23
|
||||
=app-containers/cri-tools-1.27.0 ~amd64 ~arm64
|
||||
=app-containers/runc-1.1.13 ~amd64 ~arm64
|
||||
|
@ -2,7 +2,3 @@
|
||||
# with rust so far, so keep using 1.70.0.
|
||||
~dev-lang/rust-1.79.0
|
||||
~virtual/rust-1.79.0
|
||||
|
||||
# portage-stable masked catalyst-3, and has not provided a stable way to
|
||||
# update to catalyst-4 so overriding the change for now to use catalyst-3
|
||||
<dev-util/catalyst-4
|
||||
|
@ -1,8 +1,8 @@
|
||||
# We don't ship GnuTLS by default, and smartcard has a dep loop
|
||||
app-crypt/gnupg smartcard ssl
|
||||
|
||||
# not needed, requires dev-lang/python-exec
|
||||
sys-apps/util-linux python
|
||||
# Our ISOs are not built with Catalyst.
|
||||
dev-util/catalyst iso
|
||||
|
||||
# not needed, requires lots of Perl
|
||||
sys-boot/syslinux perl
|
||||
|
@ -0,0 +1,2 @@
|
||||
# Only needed by Catalyst in the SDK, requires dev-lang/python-exec.
|
||||
sys-apps/util-linux python
|
@ -1,3 +1,6 @@
|
||||
# Needed by Catalyst.
|
||||
sys-apps/util-linux python
|
||||
|
||||
coreos-base/update_engine delta_generator
|
||||
|
||||
dev-vcs/git pcre
|
||||
|
@ -1 +1 @@
|
||||
coreos
|
||||
coreos-overlay
|
||||
|
@ -1,4 +1,3 @@
|
||||
repo-name = portage-stable
|
||||
use-manifests = strict
|
||||
thin-manifests = true
|
||||
cache-format = md5-dict
|
||||
|
@ -1 +1 @@
|
||||
gentoo
|
||||
portage-stable
|
||||
|
@ -233,7 +233,7 @@ fi
|
||||
|
||||
info "Configuring portage in ${BOARD_ROOT}"
|
||||
sudo mkdir -p "${BOARD_ETC}/portage/"{profile,repos.conf}
|
||||
sudo ln -sfT "$(portageq get_repo_path / coreos)/coreos/user-patches" \
|
||||
sudo ln -sfT "$(portageq get_repo_path / coreos-overlay)/coreos/user-patches" \
|
||||
"${BOARD_ETC}/portage/patches"
|
||||
sudo cp /etc/portage/repos.conf/* "${BOARD_ETC}"/portage/repos.conf/
|
||||
sudo ROOT="${BOARD_ROOT}" eselect profile set --force "${PORTAGE_PROFILE}"
|
||||
|
@ -103,17 +103,19 @@ EMERGE_DEFAULT_OPTS="--verbose --oneshot"
|
||||
source "/etc/portage/make.conf.user"
|
||||
EOF
|
||||
|
||||
sudo_clobber "/etc/portage/repos.conf/coreos.conf" <<EOF
|
||||
sudo_clobber "/etc/portage/repos.conf/portage-stable.conf" <<EOF
|
||||
[DEFAULT]
|
||||
main-repo = portage-stable
|
||||
|
||||
[coreos]
|
||||
location = ${COREOS_OVERLAY}
|
||||
|
||||
[portage-stable]
|
||||
location = ${PORTAGE_STABLE_OVERLAY}
|
||||
EOF
|
||||
|
||||
sudo_clobber "/etc/portage/repos.conf/coreos-overlay.conf" <<EOF
|
||||
[coreos-overlay]
|
||||
location = ${COREOS_OVERLAY}
|
||||
EOF
|
||||
|
||||
# Automatically symlink any provided portage repo configurations into
|
||||
# the appropriate destination directory from "config/portage/repos".
|
||||
# CAUTON: Any repo configuration files with the same name, will be silently
|
||||
@ -132,13 +134,13 @@ if [[ -n $(sudo find /mnt/host/source/config/portage/repos \
|
||||
if [[ -n $(sudo find /mnt/host/source/config/portage/repos \
|
||||
-maxdepth 3 -mindepth 3 -path "*/repos.conf/*" -type f) ]]; then
|
||||
info "Symlinking portage repo configuration files into repos.conf dir..."
|
||||
# Do not name any of your repo configs "coreos.conf" bad things will happen.
|
||||
# We abort if any file matches config/portage/repos/*/repos.conf/coreos.conf
|
||||
# Do not name any of your repo configs "coreos-overlay.conf" bad things will happen.
|
||||
# We abort if any file matches config/portage/repos/*/repos.conf/coreos-overlay.conf
|
||||
if [[ -n $(sudo find /mnt/host/source/config/portage/repos \
|
||||
-maxdepth 3 -mindepth 3 -path "*/repos.conf/*" -name "coreos.conf") ]]; then
|
||||
-maxdepth 3 -mindepth 3 -path "*/repos.conf/*" -name "coreos-overlay.conf") ]]; then
|
||||
die_notrace "One of the portage repo configuration files to be symlinked is " \
|
||||
"named \"coreos.conf\" which will conflict with the main configuation file " \
|
||||
"called \"coreos.conf\" which is created during the chroot build process."
|
||||
"named \"coreos-overlay.conf\" which will conflict with the main configuation file " \
|
||||
"called \"coreos-overlay.conf\" which is created during the chroot build process."
|
||||
fi
|
||||
# We run through all the other files matching config/portage/repos/*/repos.conf/*
|
||||
# and symlink them to the right place for portage.
|
||||
|
@ -26,7 +26,7 @@ eval set -- "${FLAGS_ARGV}"
|
||||
switch_to_strict_mode
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
eval set -- portage-stable coreos
|
||||
eval set -- portage-stable coreos-overlay
|
||||
fi
|
||||
|
||||
GSUTIL_OPTS=
|
||||
|
@ -16,7 +16,7 @@ eval set -- "${FLAGS_ARGV}"
|
||||
switch_to_strict_mode
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
eval set -- portage-stable coreos
|
||||
eval set -- portage-stable coreos-overlay
|
||||
fi
|
||||
|
||||
update_overlay() {
|
||||
|
Loading…
Reference in New Issue
Block a user