build_packages: Restrict revdep calculation to known bad packages
Rather than calculating reverse dependencies on all packages, rely on
the subslot logic in cros-workon.eclass to trigger rebuilds for most
packages. Restrict the reverse dependency calculation only to certain
packages that we know don't (or can't) declare their dependencies and
subslots correctly.
BUG=chromium:1071530
TEST=`build_packages`
Change-Id: Iaa75a4979a626f62880a6e7a35819af3dff2efcb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2248407
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Chris McDonald <cjmcdonald@chromium.org>
Commit-Queue: Chris McDonald <cjmcdonald@chromium.org>
diff --git a/build_packages b/build_packages
index 0e391ad..fe1477a 100755
--- a/build_packages
+++ b/build_packages
@@ -324,6 +324,19 @@
)
fi
+ # cros-workon packages are always going to be force reinstalled, so we add
+ # the forced reinstall behavior to the modified package calculation. This is
+ # necessary to include when a user has already installed a 9999 ebuild and is
+ # now reinstalling that package with additional local changes, because
+ # otherwise the modified package calculation would not see that a 'new'
+ # package is being installed.
+ if [[ ${#CROS_WORKON_PKGS[@]} -gt 0 ]]; then
+ SIM_EMERGE_FLAGS+=(
+ --reinstall-atoms="${CROS_WORKON_PKGS[*]}"
+ --usepkg-exclude="${CROS_WORKON_PKGS[*]}"
+ )
+ fi
+
# Calculate only the ebuild changes from the emerge simulation ignoring
# the virtual packages and the forced rebuild of autotest-all package.
# The lines of the following block do the following operations:
@@ -331,19 +344,19 @@
# 2. Filter to only packages that will be installed to the board sysroot.
# 3. Filter to only packages that would be built from source and rewrite the
# line from Portage's full output to only $CATEGORY/$PACKAGE
- # 4. Remove any package that starts with 'virtual' or matches
- # 'chromeos-base/autotest-all'.
+ # 4. Filter the list of packages to a heuristic set of packages known to have
+ # incorrectly specified dependencies.
# 5. Sort the output and remove any duplicate entries.
BASE_INSTALL_PKGS=( $( \
sudo -E "${EMERGE_CMD[@]}" "${SIM_EMERGE_FLAGS[@]}" "${PACKAGES[@]}" | \
grep -e 'to /build/' | \
sed -n -E '/^\[ebuild /{s:^[^]]+\] +::;s: .*::;p}' | \
- grep -v -e '^virtual/' -e '^chromeos-base/autotest-all' | \
+ grep -E '/(chromeos-config.*|coreboot-private-files.*|tast-build-deps)$' | \
sort -u ) )
MOD_PKGS=()
if [[ "${#BASE_INSTALL_PKGS[@]}" -gt 0 ]]; then
- info "New packages being installed: ${BASE_INSTALL_PKGS[*]}."
+ info "Forced rebuild packages detected: ${BASE_INSTALL_PKGS[*]}."
# Convert specific versions into base package names
MOD_PKGS+=( $(\
equery-${FLAGS_board} list -p -o --format='$category/$name' \