diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-06-02 04:45:39 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-06-02 04:45:39 +0000 |
commit | ed7ce3c71016c5378bd3e3300c93afec6b329488 (patch) | |
tree | 58469d1e8e3690ba41c36117ed3a7d363858afbd /pym | |
parent | cb4f3d54bc79c967116d67c6a077601154b50ac2 (diff) | |
download | portage-ed7ce3c71016c5378bd3e3300c93afec6b329488.tar.gz portage-ed7ce3c71016c5378bd3e3300c93afec6b329488.tar.bz2 portage-ed7ce3c71016c5378bd3e3300c93afec6b329488.zip |
Use the PORTAGE_BINHOST_HEADER_URI environment variable to define the URI header field for the Packages index. If the URI header field is defined then the client will use it as a base URI for fetching packages.
svn path=/main/trunk/; revision=6725
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage/dbapi/bintree.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 51bef5769..e535f7f93 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -130,6 +130,7 @@ class binarytree(object): self.populated = 0 self.tree = {} self._remote_has_index = False + self._remote_base_uri = None self._remotepkgs = None # remote metadata indexed by cpv self.remotepkgs = {} # indexed by tbz2 name (deprecated) self.invalids = [] @@ -574,6 +575,7 @@ class binarytree(object): if pkgindex: self._remotepkgs = pkgindex.packages self._remote_has_index = True + self._remote_base_uri = pkgindex.header.get("URI", base_url) self.remotepkgs = {} for cpv in self._remotepkgs: self.dbapi.cpv_inject(cpv) @@ -743,9 +745,11 @@ class binarytree(object): profile_path = profile_path.lstrip(profiles_base) header["PROFILE"] = profile_path header["VERSION"] = str(self._pkgindex_version) - binhost = self.settings.get("PORTAGE_BINHOST") - if binhost: - header["URI"] = binhost + base_uri = self.settings.get("PORTAGE_BINHOST_HEADER_URI") + if base_uri: + header["URI"] = base_uri + else: + header.pop("URI", None) for k in self._pkgindex_header_keys: v = self.settings.get(k, None) if v: @@ -836,7 +840,7 @@ class binarytree(object): except (OSError, IOError): pass from urlparse import urljoin - base_url = self.settings["PORTAGE_BINHOST"] + base_url = self._remote_base_uri fcmd = self.settings["RESUMECOMMAND"] if self._remote_has_index: rel_url = self._remotepkgs[pkgname].get("PATH") |