summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-06-02 04:45:39 +0000
committerZac Medico <zmedico@gentoo.org>2007-06-02 04:45:39 +0000
commited7ce3c71016c5378bd3e3300c93afec6b329488 (patch)
tree58469d1e8e3690ba41c36117ed3a7d363858afbd
parentcb4f3d54bc79c967116d67c6a077601154b50ac2 (diff)
downloadportage-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
-rw-r--r--man/make.conf.519
-rw-r--r--pym/portage/dbapi/bintree.py12
2 files changed, 24 insertions, 7 deletions
diff --git a/man/make.conf.5 b/man/make.conf.5
index dc75f97f1..cc8241637 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -322,13 +322,26 @@ Defaults to /usr/portage/packages.
This variable defines the directory in which per\-ebuild logs are kept.
Logs are created only when this is set and writable.
.TP
-\fBPORTAGE_BINHOST\fR = \fI"ftp://login:pass@grp.mirror.site/pub/grp/i686/athlon\-xp"\fR
+\fBPORTAGE_BINHOST\fR = \fI"ftp://login:pass@grp.mirror.site/pub/grp/i686/athlon\-xp/"\fR
This is the host from which portage will grab prebuilt\-binary packages.
The list is a single entry specifying the full address of the directory
serving the tbz2's for your system. This is only used when running with
the get binary pkg options are given to \fBemerge\fR. Review \fBemerge\fR(1)
-for more information. Note that it should point to the 'All' directory on
-the host that creates the binary packages and not to the root of the \fBPKGDIR\fR.
+for more information. For versions of portage less that 2.2, this variable
+should point to the 'All' directory on the host that creates the binary
+packages and not to the root of the \fBPKGDIR\fR. Starting with portage 2.2,
+it should point to a directory containing a 'Packages' index file. If
+${PORTAGE_BINHOST}/Packages does not exist then portage will attempt to use
+the older protocol.
+.TP
+\fBPORTAGE_BINHOST_HEADER_URI\fR = \fI"ftp://login:pass@grp.mirror.site/pub/grp/i686/athlon\-xp/"\fR
+This variable only makes sense on a system that will serve as a binhost and
+build packages for clients. It defines the URI header field for the package
+index file which is located at ${PKGDIR}/Packages. Clients that have
+\fBPORTAGE_BINHOST\fR properly configured will be able to fetch the index and
+use the URI header field as a base URI for fetching binary packages. If the URI
+header field is not defined then the client will use it's ${PORTAGE_BINHOST}
+setting as the base URI.
.TP
\fBPORTAGE_COMPRESS\fR = \fI"bzip2"\fR
This variable contains the command used to compress documentation during the
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")