flatcar-scripts/build_library/catalyst_sdk.sh
James Le Cuirot 872ea6d14d
Don't use repo snapshots for stage1 by updating seed the new way
This is what upstream Gentoo does. They would previously update the
entire seed, but this took a long time. Our seeds are much bigger, so we
kept repo snapshots to build stage1 against these instead. The new
method of only rebuilding packages with changed sub-slots is a good
compromise and removes the need to write stage1 hooks that selectively
catch the repository up.

This also avoids some conflicts by adding the `--ignore-world` option.
Gentoo seeds have nothing in @world. We have much more, but none of that
is needed for stage1.

This continues to exclude cross-*-cros-linux-gnu/* as that is not needed
for stage1. It now also excludes dev-lang/rust, because it is never a
DEPEND, so it would not break other packages in this way. It may fail to
run due to a sub-slot change in one of its own dependencies, but it is
also unlikely to be needed in stage1 and it is not configured to use the
system LLVM. If needs be, we could improve the behaviour of Portage's
@changed-subslot to respect `--with-bdeps`.

In my testing, it was unable to handle an SDK from 17 months ago, but
one from 7 months ago did work. In practise, we will always use a much
more recent one, which is far more likely to work.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-07-15 14:28:03 +01:00

23 lines
682 B
Bash

#!/bin/bash
set -e
source /tmp/chroot-functions.sh
source /tmp/toolchain_util.sh
echo "Double checking everything is fresh and happy."
run_merge -uDN --with-bdeps=y world
echo "Setting the default Python interpreter"
eselect python update
echo "Building cross toolchain for the SDK."
configure_crossdev_overlay / /usr/local/portage/crossdev
for cross_chost in $(get_chost_list); do
echo "Building cross toolchain for ${cross_chost}"
PKGDIR="$(portageq envvar PKGDIR)/crossdev" \
install_cross_toolchain "${cross_chost}" ${clst_myemergeopts}
PKGDIR="$(portageq envvar PKGDIR)/crossdev" \
install_cross_rust "${cross_chost}" ${clst_myemergeopts}
done