Fix chromite symlink in make_chroot
Gentoo's stage3 does not contain the python2.x. When make_chroot.sh tries to
create a link to chromite in /usr/lib/python2.*/site-packages/, the path doesn't
get expanded and chromite is not in the python path.
This CL moves the symlink creation until after we uninstall python3 and install
python 2.
BUG=None
TEST=cbuildbot local: chromite is in the path and can be used.
TEST=remote trybot on chromiumos-sdk
Change-Id: I9a3579f5e89ca85240e0d7cb97efe46d4b065b6b
Reviewed-on: https://chromium-review.googlesource.com/213270
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index 5022dda..e1c9988 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -245,13 +245,6 @@
PORTAGE_USERNAME=${SUDO_USER}
EOF
- # Add chromite into python path.
- for python_path in "${FLAGS_chroot}/usr/lib/"python2.*; do
- python_path+="/site-packages"
- sudo mkdir -p "${python_path}"
- sudo ln -s "${CHROOT_TRUNK_DIR}"/chromite "${python_path}"
- done
-
# TODO(zbehan): Configure stuff that is usually configured in postinst's,
# but wasn't. Fix the postinst's.
info "Running post-inst configuration hacks"
@@ -444,6 +437,15 @@
early_enter_chroot eselect python set 1
early_enter_chroot env CLEAN_DELAY=0 emerge -qC =dev-lang/python-3* || true
+# Add chromite into python path.
+# This needs to happen after the python update or the correct /usr/lib/python2.*
+# may not exist.
+for python_path in "${FLAGS_chroot}/usr/lib/"python2.*; do
+ python_path+="/site-packages"
+ sudo mkdir -p "${python_path}"
+ sudo ln -s -fT "${CHROOT_TRUNK_DIR}"/chromite "${python_path}"/chromite
+done
+
# 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).