update_chroot: Don't reinstall binpkgs based on date
The combination of --update, --usepkgonly, and --deep causes emerge to
reinstall all binpkgs that have a newer BUILD_TIME. Since we upload new
prebuilts when the SDK builder runs, this causes a large fraction of the
entire chroot to get reinstalled every couple of days.
What we really want is for changed/updated packages and their
dependencies to be reinstalled, so --deep is still needed. Pass
--rebuilt-binaries=n to avoid reinstalling packages where the only
change is the build timestamp.
BUG=b:218731092
FIXES=b:218731092
TEST=./update_chroot installs 8 packages instead of 485
Change-Id: Ia3f8f5a9251cdcbe463dd03bda5ed7e54633f3d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/3456584
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Tested-by: Benjamin Gordon <bmgordon@chromium.org>
Commit-Queue: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/update_chroot b/update_chroot
index 9868484..15e1158 100755
--- a/update_chroot
+++ b/update_chroot
@@ -140,7 +140,8 @@
# Install post cross packages if binary pkgs are available.
if [ "${FLAGS_usepkg}" -eq "${FLAGS_TRUE}" ]; then
# Use --usepkgonly to ensure that packages are not built from source.
- EMERGE_FLAGS=( -uNv --with-bdeps=y --oneshot --getbinpkg --deep --usepkgonly )
+ EMERGE_FLAGS=( -uNv --with-bdeps=y --oneshot --getbinpkg --deep )
+ EMERGE_FLAGS+=( --usepkgonly --rebuilt-binaries=n )
EMERGE_FLAGS+=(
$("${CHROMITE_BIN}/cros_setup_toolchains" --show-packages host-post-cross)
)
@@ -148,7 +149,8 @@
# Install nobdeps packages only when binary pkgs are available, since we don't
# want to accidentally pull in build deps for a rebuild.
- EMERGE_FLAGS=( -uNv --with-bdeps=n --oneshot --getbinpkg --deep --usepkgonly )
+ EMERGE_FLAGS=( -uNv --with-bdeps=n --oneshot --getbinpkg --deep )
+ EMERGE_FLAGS+=( --usepkgonly --rebuilt-binaries=n )
info_run sudo -E "${EMERGE_CMD}" "${EMERGE_FLAGS[@]}" \
virtual/target-sdk-nobdeps
fi