1 |
commit: 7f84548b516d30de43118d58e6bc03c8739a0967 |
2 |
Author: David James <davidjames <AT> google <DOT> com> |
3 |
AuthorDate: Wed Jan 26 22:45:43 2011 +0000 |
4 |
Commit: Thomas Sachau <tommy <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 27 01:01:31 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7f84548b |
7 |
|
8 |
Update Portage to support multiple binhosts. |
9 |
|
10 |
BUG=chromium-os:11295 |
11 |
TEST=Build x86-mario with multiple binhosts (board binhost, preflight binhost) |
12 |
and verify that binaries are picked up from both binhosts. Also verify |
13 |
that if one of the binhosts fails, the other binhost is used correctly. |
14 |
|
15 |
Review URL: http://codereview.chromium.org/6329022 |
16 |
|
17 |
Change-Id: I095f28c82e3effbc25105af6ac89e42c335e6381 |
18 |
|
19 |
--- |
20 |
pym/_emerge/BinpkgFetcher.py | 4 ++-- |
21 |
pym/portage/dbapi/bintree.py | 34 +++++++++++++++++++--------------- |
22 |
2 files changed, 21 insertions(+), 17 deletions(-) |
23 |
|
24 |
diff --git a/pym/_emerge/BinpkgFetcher.py b/pym/_emerge/BinpkgFetcher.py |
25 |
index 942bcdf..221d9a7 100644 |
26 |
--- a/pym/_emerge/BinpkgFetcher.py |
27 |
+++ b/pym/_emerge/BinpkgFetcher.py |
28 |
@@ -57,8 +57,8 @@ class BinpkgFetcher(SpawnProcess): |
29 |
rel_uri = bintree._remotepkgs[pkg.cpv].get("PATH") |
30 |
if not rel_uri: |
31 |
rel_uri = pkg.cpv + ".tbz2" |
32 |
- uri = bintree._remote_base_uri.rstrip("/") + \ |
33 |
- "/" + rel_uri.lstrip("/") |
34 |
+ remote_base_uri = bintree._remotepkgs[pkg.cpv]["BASE_URI"] |
35 |
+ uri = remote_base_uri.rstrip("/") + "/" + rel_uri.lstrip("/") |
36 |
else: |
37 |
uri = settings["PORTAGE_BINHOST"].rstrip("/") + \ |
38 |
"/" + pkg.pf + ".tbz2" |
39 |
|
40 |
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py |
41 |
index 2da7799..cc6203a 100644 |
42 |
--- a/pym/portage/dbapi/bintree.py |
43 |
+++ b/pym/portage/dbapi/bintree.py |
44 |
@@ -224,7 +224,6 @@ class binarytree(object): |
45 |
self.populated = 0 |
46 |
self.tree = {} |
47 |
self._remote_has_index = False |
48 |
- self._remote_base_uri = None |
49 |
self._remotepkgs = None # remote metadata indexed by cpv |
50 |
self.__remotepkgs = {} # indexed by tbz2 name (deprecated) |
51 |
self.invalids = [] |
52 |
@@ -242,7 +241,7 @@ class binarytree(object): |
53 |
["BUILD_TIME", "CHOST", "DEPEND", "DESCRIPTION", "EAPI", |
54 |
"IUSE", "KEYWORDS", "LICENSE", "PDEPEND", "PROPERTIES", |
55 |
"PROVIDE", "RDEPEND", "repository", "SLOT", "USE", "DEFINED_PHASES", |
56 |
- "REQUIRED_USE"] |
57 |
+ "REQUIRED_USE", "BASE_URI"] |
58 |
self._pkgindex_aux_keys = list(self._pkgindex_aux_keys) |
59 |
self._pkgindex_use_evaluated_keys = \ |
60 |
("LICENSE", "RDEPEND", "DEPEND", |
61 |
@@ -728,8 +727,12 @@ class binarytree(object): |
62 |
writemsg(_("!!! PORTAGE_BINHOST unset, but use is requested.\n"), |
63 |
noiselevel=-1) |
64 |
|
65 |
- if getbinpkgs and 'PORTAGE_BINHOST' in self.settings: |
66 |
- base_url = self.settings["PORTAGE_BINHOST"] |
67 |
+ if not getbinpkgs or 'PORTAGE_BINHOST' not in self.settings: |
68 |
+ self.populated=1 |
69 |
+ return |
70 |
+ self._remotepkgs = {} |
71 |
+ self.__remotepkgs = {} |
72 |
+ for base_url in self.settings["PORTAGE_BINHOST"].split(): |
73 |
parsed_url = urlparse(base_url) |
74 |
host = parsed_url.netloc |
75 |
port = parsed_url.port |
76 |
@@ -857,13 +860,12 @@ class binarytree(object): |
77 |
# file, but that's alright. |
78 |
if pkgindex: |
79 |
# Organize remote package list as a cpv -> metadata map. |
80 |
- self._remotepkgs = _pkgindex_cpv_map_latest_build(pkgindex) |
81 |
+ remotepkgs = _pkgindex_cpv_map_latest_build(pkgindex) |
82 |
+ self._remotepkgs.update(remotepkgs) |
83 |
self._remote_has_index = True |
84 |
- self._remote_base_uri = pkgindex.header.get("URI", base_url) |
85 |
- self.__remotepkgs = {} |
86 |
- for cpv in self._remotepkgs: |
87 |
+ remote_base_uri = pkgindex.header.get("URI", base_url) |
88 |
+ for cpv in remotepkgs: |
89 |
self.dbapi.cpv_inject(cpv) |
90 |
- self.populated = 1 |
91 |
if True: |
92 |
# Remote package instances override local package |
93 |
# if they are not identical. |
94 |
@@ -872,6 +874,7 @@ class binarytree(object): |
95 |
remote_metadata = self._remotepkgs.get(cpv) |
96 |
if remote_metadata is None: |
97 |
continue |
98 |
+ remote_metadata["BASE_URI"] = remote_base_uri |
99 |
# Use digests to compare identity. |
100 |
identical = True |
101 |
for hash_name in hash_names: |
102 |
@@ -893,8 +896,7 @@ class binarytree(object): |
103 |
# Local package instances override remote instances. |
104 |
for cpv in metadata: |
105 |
self._remotepkgs.pop(cpv, None) |
106 |
- return |
107 |
- self._remotepkgs = {} |
108 |
+ continue |
109 |
try: |
110 |
chunk_size = long(self.settings["PORTAGE_BINHOST_CHUNKSIZE"]) |
111 |
if chunk_size < 8: |
112 |
@@ -905,11 +907,12 @@ class binarytree(object): |
113 |
writemsg_stdout( |
114 |
colorize("GOOD", _("Fetching bininfo from ")) + \ |
115 |
re.sub(r'//(.+):.+@(.+)/', r'//\1:*password*@\2/', base_url) + "\n") |
116 |
- self.__remotepkgs = portage.getbinpkg.dir_get_metadata( |
117 |
- self.settings["PORTAGE_BINHOST"], chunk_size=chunk_size) |
118 |
+ remotepkgs = portage.getbinpkg.dir_get_metadata( |
119 |
+ base_url, chunk_size=chunk_size) |
120 |
+ self.__remotepkgs.update(remotepkgs) |
121 |
#writemsg(green(" -- DONE!\n\n")) |
122 |
|
123 |
- for mypkg in list(self.__remotepkgs): |
124 |
+ for mypkg in list(remotepkgs): |
125 |
if "CATEGORY" not in self.__remotepkgs[mypkg]: |
126 |
#old-style or corrupt package |
127 |
writemsg(_("!!! Invalid remote binary package: %s\n") % mypkg, |
128 |
@@ -1233,7 +1236,8 @@ class binarytree(object): |
129 |
rel_url = self._remotepkgs[pkgname].get("PATH") |
130 |
if not rel_url: |
131 |
rel_url = pkgname+".tbz2" |
132 |
- url = self._remote_base_uri.rstrip("/") + "/" + rel_url.lstrip("/") |
133 |
+ remote_base_uri = self._remotepkgs[pkgname]["BASE_URI"] |
134 |
+ url = remote_base_uri.rstrip("/") + "/" + rel_url.lstrip("/") |
135 |
else: |
136 |
url = self.settings["PORTAGE_BINHOST"].rstrip("/") + "/" + tbz2name |
137 |
protocol = urlparse(url)[0] |