make_chroot: auto downgrade python as needed
Newer Gentoo stages come with python-3 only. We aren't ready for that,
so automatically downgrade to python-2 if it isn't already installed.
BUG=chromium:218085
TEST=`cbuildbot chromiumos-sdk` passes
Change-Id: I4ad538629788c84b06e3e62278ee89d18a4ea1d6
Reviewed-on: https://gerrit.chromium.org/gerrit/46232
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index e5a1d62..bea08ce 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -428,6 +428,14 @@
info "Updating portage"
early_enter_chroot emerge -uNv --quiet portage
+# Make sure we have python-2.x available.
+if [[ -z $(ls "${FLAGS_chroot}"/usr/bin/python2* 2>/dev/null) ]]; then
+ info "Installing python-2.x"
+ early_enter_chroot emerge -uNvq =dev-lang/python-2*
+ early_enter_chroot eselect python set 1
+ early_enter_chroot env CLEAN_DELAY=0 emerge -qC =dev-lang/python-3*
+fi
+
# Packages that inherit cros-workon commonly get a circular dependency
# curl->openssl->git->curl that is broken by emerging an early version of git
# without curl (and webdav that depends on it).