mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-26 16:11:56 +02:00
Fix bug 10466: parallel_emerge use flag calculation favors local binhost.
When we merge a package, we need to keep track of the use flags associated with the package, so that we don't merge a package with the wrong use flags. In some cases, there might be two copies of the same binary package: One local copy, and one remote copy. Our current logic for grabbing the use flags favors the local copy. But Portage itself favors the remote copy. To reconcile this difference, we just reuse the logic from Portage here. BUG=chromium-os:10466 TEST= 1. Run build_packages with a correct binhost 2. Switch to a binhost with different use flags for some of the packages, but the same version number and package name. 3. Run EXTRA_BOARD_FLAGS=--emptytree build_packages 4. Run build_image Also test #3 with --oldchromebinary. Change-Id: I9b917d8b8d902e0581d5a5d23ad20940930b114a Review URL: http://codereview.chromium.org/6055004
This commit is contained in:
parent
50744ba57c
commit
999e09f5c4
@ -1192,41 +1192,23 @@ class DepGraphGenerator(object):
|
||||
"""Update packages that can use prebuilts to do so."""
|
||||
start = time.time()
|
||||
|
||||
# The bintree is the database of binary packages. By default, it's
|
||||
# empty.
|
||||
bintree = emerge.trees[root]["bintree"]
|
||||
bindb = bintree.dbapi
|
||||
root_config = emerge.root_config
|
||||
pkgsettings = emerge.depgraph._frozen_config.pkgsettings[root]
|
||||
prebuilt_pkgs = {}
|
||||
|
||||
# Populate the DB with packages
|
||||
bintree.populate("--getbinpkg" in emerge.opts,
|
||||
"--getbinpkgonly" in emerge.opts)
|
||||
|
||||
# Build list of prebuilt packages
|
||||
prebuilt_pkgs = {}
|
||||
for pkg, info in deps_map.iteritems():
|
||||
if info and info["action"] == "merge":
|
||||
if (not info["force_remote_binary"] and info["mandatory_source"] or
|
||||
"--usepkgonly" not in emerge.opts and pkg not in remote_pkgs):
|
||||
continue
|
||||
|
||||
db_keys = list(bindb._aux_cache_keys)
|
||||
try:
|
||||
db_vals = bindb.aux_get(pkg, db_keys + ["MTIME"])
|
||||
except KeyError:
|
||||
# No binary package
|
||||
continue
|
||||
|
||||
mtime = int(db_vals.pop() or 0)
|
||||
metadata = zip(db_keys, db_vals)
|
||||
db_pkg = Package(built=True, cpv=pkg, installed=False,
|
||||
metadata=metadata, onlydeps=False, mtime=mtime,
|
||||
operation="merge", root_config=root_config,
|
||||
type_name="binary")
|
||||
db_pkg = emerge.depgraph._pkg(pkg, "binary", emerge.root_config)
|
||||
if info["force_remote_binary"]:
|
||||
# Undo our earlier hacks to the use flags so that the use flags
|
||||
# display correctly.
|
||||
db_pkg.use.enabled = db_pkg.metadata["USE"].split()
|
||||
prebuilt_pkgs[pkg] = db_pkg
|
||||
|
||||
# Calculate what packages need to be rebuilt due to changes in use flags.
|
||||
pkgsettings = emerge.depgraph._frozen_config.pkgsettings[root]
|
||||
for pkg, db_pkg in prebuilt_pkgs.iteritems():
|
||||
if not self.CheckUseFlags(pkgsettings, db_pkg, self.package_db[pkg]):
|
||||
MergeChildren(pkg, "mandatory_source")
|
||||
|
Loading…
x
Reference in New Issue
Block a user