From a66bded4ce244f87efbaf7ff3168be31c2e7377c Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Wed, 13 Jul 2022 15:43:15 +0200 Subject: [PATCH] install_cross_libs: fix toolchain dependency installation `./setup_board --nousepkg --nogetbinpkg` currently fails with a circular dependency due to pulling in the whole systemd-cryptsetup-udev dependency chain. This is due to several issue: * `emerge --root=$ROOT --emptytree` considers ROOT=/ to also be empty, so it pulls in all host packages. This must've not always been the case. So we need to pipe the dependency package list through `egrep $ROOT` to filter only those that would get installed into the desired ROOT * if SYSROOT=/ and not SYSROOT=ROOT, then virtual/os-headers is missing from $ROOT package list * the final filter expression tries to previously looked like this: (=sys-devel/gcc|sys-devel/binutils-0.9) which also matches sys-devel/gcc-config and sys-devel/binutils-config, which are necessary dependencies. Rework the match expression to not filter those out. --- build_library/toolchain_util.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build_library/toolchain_util.sh b/build_library/toolchain_util.sh index 7315ef6780..f9328b4345 100644 --- a/build_library/toolchain_util.sh +++ b/build_library/toolchain_util.sh @@ -262,8 +262,9 @@ _get_dependency_list() { PORTAGE_CONFIGROOT="$ROOT" emerge "$@" --pretend \ --emptytree --root-deps=rdeps --onlydeps --quiet | \ + egrep "$ROOT" | sed -e 's/[^]]*\] \([^ :]*\).*/=\1/' | - egrep -v "(=$(echo "${pkgs[*]}")-[0-9])" + egrep -v "=($(echo "${pkgs[*]}"))-[0-9]" } # Configure a new ROOT @@ -392,7 +393,7 @@ install_cross_libs() { # In order to get a dependency list we must calculate it before # updating package.provided. Otherwise portage will no-op. $sudo rm -f "${package_provided}/cross-${cross_chost}" - local cross_deps=$(ROOT="$ROOT" _get_dependency_list \ + local cross_deps=$(ROOT="$ROOT" SYSROOT="$ROOT" _get_dependency_list \ "$@" "${TOOLCHAIN_PKGS[@]}" | $sudo tee \ "$ROOT/etc/portage/cross-${cross_chost}-depends")