From 999e09f5c42d25650fa6418b81743c7d7585f70b Mon Sep 17 00:00:00 2001 From: David James Date: Tue, 4 Jan 2011 15:15:02 -0800 Subject: [PATCH] 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 --- parallel_emerge | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/parallel_emerge b/parallel_emerge index 930f53dcd6..6f98f41dfa 100755 --- a/parallel_emerge +++ b/parallel_emerge @@ -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")