cros_setup_toolchains: Add a comment, revise clean-up error.
The comment says it all. Using porttree/bintree is more correct here,
but less practical. The comment serves to document this implementation
choice so future developers don't have to spend time trying to fix it.
BUG=brillo:918
TEST=None
Change-Id: Id041bab682f88d5d7fe6d7c8eb488a478290236b
Reviewed-on: https://chromium-review.googlesource.com/272932
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
diff --git a/scripts/cros_setup_toolchains.py b/scripts/cros_setup_toolchains.py
index 3551b42..25a2e8b 100644
--- a/scripts/cros_setup_toolchains.py
+++ b/scripts/cros_setup_toolchains.py
@@ -435,9 +435,16 @@
pkg = GetPortagePackage(target, package)
current = GetInstalledPackageVersions(pkg)
desired = GetDesiredPackageVersions(target, package)
+ # NOTE: This refers to installed packages (vartree) rather than the
+ # Portage version (porttree and/or bintree) when determining the current
+ # version. While this isn't the most accurate thing to do, it is probably
+ # a good simple compromise, which should have the desired result of
+ # uninstalling everything but the latest installed version. In
+ # particular, using the bintree (--usebinpkg) requires a non-trivial
+ # binhost sync and is probably more complex than useful.
desired_num = VersionListToNumeric(target, package, desired, True)
if not set(desired_num).issubset(current):
- print('Some packages have been held back, skipping clean!')
+ print('Error detecting stable version for %s, skipping clean!' % pkg)
return
unmergemap[pkg] = set(current).difference(desired_num)