From 6e6a0a4967001523061cf3007d324f235d1c880f Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Mon, 30 Mar 2015 14:02:20 -0700 Subject: [PATCH] toolchain_util: include repos.conf in bootstrap build environments This is required for the eventual removal of `$PORTDIR` and `$PORTDIR_OVERLAY` and ensures toolchain rebuilds/updates with `./build_packages --nousepkg` don't erroniously try to use ebuilds from `/usr/portage` inside of the SDK. In order to fix up the build_toolchains script the crossdev overlay needs to be setup properly, previously only setup_board did it. Overall silences a lot of warnings and fixes an issue with crossdev: /usr/bin/emerge-wrapper: line 48: /eclass/toolchain-funcs.eclass: No such file or directory /usr/bin/emerge-wrapper: line 49: tc-arch: command not found --- build_library/catalyst.sh | 33 +++++++++++++++++----- build_library/catalyst_toolchains.sh | 3 +- build_library/toolchain_util.sh | 42 +++++++++++++++++++++++++++- update_chroot | 11 +------- 4 files changed, 69 insertions(+), 20 deletions(-) diff --git a/build_library/catalyst.sh b/build_library/catalyst.sh index 74fe5cf182..84894caa82 100644 --- a/build_library/catalyst.sh +++ b/build_library/catalyst.sh @@ -80,11 +80,28 @@ export PORTAGE_GRPNAME=portage EOF } +repos_conf() { +cat < "$TEMPDIR/catalyst.conf" - info " $TEMPDIR/catalystrc" + info " catalystrc" catalystrc > "$TEMPDIR/catalystrc" - info " $TEMPDIR/stage1.spec" + info " portage/repos.conf/coreos.conf" + repos_conf > "$TEMPDIR/portage/repos.conf/coreos.conf" + info " stage1.spec" catalyst_stage1 > "$TEMPDIR/stage1.spec" - info " $TEMPDIR/stage2.spec" + info " stage2.spec" catalyst_stage2 > "$TEMPDIR/stage2.spec" - info " $TEMPDIR/stage3.spec" + info " stage3.spec" catalyst_stage3 > "$TEMPDIR/stage3.spec" - info " $TEMPDIR/stage4.spec" + info " stage4.spec" catalyst_stage4 > "$TEMPDIR/stage4.spec" } diff --git a/build_library/catalyst_toolchains.sh b/build_library/catalyst_toolchains.sh index 4106b6af42..07428f7350 100644 --- a/build_library/catalyst_toolchains.sh +++ b/build_library/catalyst_toolchains.sh @@ -32,8 +32,7 @@ build_target_toolchain() { run_merge -u --root="$ROOT" "${TOOLCHAIN_PKGS[@]}" } -mkdir -p "/tmp/crossdev" -export PORTDIR_OVERLAY="/tmp/crossdev $(portageq envvar PORTDIR_OVERLAY)" +configure_crossdev_overlay / /tmp/crossdev for cross_chost in $(get_chost_list); do echo "Building cross toolchain for ${cross_chost}" diff --git a/build_library/toolchain_util.sh b/build_library/toolchain_util.sh index 388a7c58fa..f6e0bafa73 100644 --- a/build_library/toolchain_util.sh +++ b/build_library/toolchain_util.sh @@ -172,6 +172,35 @@ get_binonly_args() { ### Toolchain building utilities ### +# Create the crossdev overlay and repos.conf entry. +# crossdev will try to setup this itself but doesn't do everything needed +# to make the newer repos.conf based configuration system happy. This can +# probably go away if crossdev itself is improved. +configure_crossdev_overlay() { + local root="$1" + local location="$2" + + # may be called from either catalyst (root) or update_chroot (user) + local sudo="env" + if [[ $(id -u) -ne 0 ]]; then + sudo="sudo -E" + fi + + $sudo mkdir -p "${root}${location}/"{profiles,metadata} + echo "x-crossdev" | \ + $sudo tee "${root}${location}/profiles/repo_name" > /dev/null + $sudo tee "${root}${location}/metadata/layout.conf" > /dev/null < /dev/null </dev/null <&2 + return 1 + fi + # Only call crossdev to regenerate configs if something has changed if ! cmp --quiet - "${cross_cfg}" <<<"${cross_cfg_data}" then diff --git a/update_chroot b/update_chroot index 44f170d242..ac1c4248af 100755 --- a/update_chroot +++ b/update_chroot @@ -125,16 +125,7 @@ sudo eselect profile set --force "$(get_sdk_profile)" # Create crossdev repo_name and metadata info "Setting up crossdev..." -sudo mkdir -p "${FLAGS_chroot}/${CROSSDEV_OVERLAY}/profiles" -echo "x-crossdev" | \ - sudo tee "/${CROSSDEV_OVERLAY}/profiles/repo_name" > /dev/null - -sudo mkdir -p "/${CROSSDEV_OVERLAY}/metadata" -sudo tee "/${CROSSDEV_OVERLAY}/metadata/layout.conf" > /dev/null <