parallel_emerge: Fix builds when PORTAGE_BINHOST is unset

BUG=none
TEST=Try building for a branch new board overlay that doesn't already have a binhost setup.

Review URL: http://codereview.chromium.org/2870068
This commit is contained in:
Olof Johansson 2010-07-28 17:20:16 -05:00
parent ffff7d76cc
commit 8ce8312e43

View File

@ -744,17 +744,24 @@ class DepGraphGenerator(object):
if this_pkg["action"] == "nomerge":
this_pkg["action"] = "merge"
def RemotePackageDatabase():
def RemotePackageDatabase(binhost_url):
"""Grab the latest binary package database from the prebuilt server.
We need to know the modification times of the prebuilt packages so that we
know when it is OK to use these packages and when we should rebuild them
instead.
Args:
binhost_url: Base URL of remote packages (PORTAGE_BINHOST).
Returns:
A dict mapping package identifiers to modification times.
"""
url = self.emerge.settings["PORTAGE_BINHOST"] + "/Packages"
if not binhost_url:
return {}
url = binhost_url + "/Packages"
prebuilt_pkgs = {}
f = urllib2.urlopen(url)
@ -953,7 +960,7 @@ class DepGraphGenerator(object):
cycles = FindCycles()
if self.rebuild:
local_pkgs = LocalPackageDatabase()
remote_pkgs = RemotePackageDatabase()
remote_pkgs = RemotePackageDatabase(emerge.settings["PORTAGE_BINHOST"])
AutoRebuildDeps(local_pkgs, remote_pkgs, cycles)
# We need to remove installed packages so that we can use the dependency