diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-06-25 02:35:55 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-06-25 02:35:55 +0000 |
commit | 035e266a3680f26c20f8811b91ef2ffbf7cbd8b1 (patch) | |
tree | d04aa24c91c9940a69ccbed7c599f75c11f3b3b3 | |
parent | f34afe9802e1b68e53a2e1084e16d9ec5693c05b (diff) | |
download | portage-035e266a3680f26c20f8811b91ef2ffbf7cbd8b1.tar.gz portage-035e266a3680f26c20f8811b91ef2ffbf7cbd8b1.tar.bz2 portage-035e266a3680f26c20f8811b91ef2ffbf7cbd8b1.zip |
For bug #175891, support ${FETCHCOMMAND}_${PROTOCOL} in binarytree.gettbz2().
svn path=/main/trunk/; revision=7016
-rw-r--r-- | pym/portage/dbapi/bintree.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 5151b8ae6..a007106c9 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -850,10 +850,12 @@ class binarytree(object): print "Fetching '"+str(pkgname)+"'" mysplit = pkgname.split("/") tbz2name = mysplit[1]+".tbz2" + resume = False if not self.isremote(pkgname): if (tbz2name not in self.invalids): return else: + resume = True writemsg("Resuming download of this tbz2, but it is possible that it is corrupt.\n", noiselevel=-1) tbz2_path = self.getname(pkgname) @@ -862,17 +864,22 @@ class binarytree(object): os.makedirs(mydest, 0775) except (OSError, IOError): pass - from urlparse import urljoin - fcmd = self.settings["RESUMECOMMAND"] + from urlparse import urljoin, urlparse if self._remote_has_index: rel_url = self._remotepkgs[pkgname].get("PATH") if not rel_url: rel_url = pkgname+".tbz2" url = urljoin(self._remote_base_uri, rel_url) - success = portage.getbinpkg.file_get(url, mydest, fcmd=fcmd) else: url = urljoin(self.settings["PORTAGE_BINHOST"], tbz2name) - success = portage.getbinpkg.file_get(url, mydest, fcmd=fcmd) + protocol = urlparse(url)[0] + fcmd_prefix = "FETCHCOMMAND" + if resume: + fcmd_prefix = "RESUMECOMMAND" + fcmd = self.settings.get(fcmd_prefix + "_" + protocol.upper()) + if not fcmd: + fcmd = self.settings.get(fcmd_prefix) + success = portage.getbinpkg.file_get(url, mydest, fcmd=fcmd) if success and "strict" in self.settings.features: metadata = self._remotepkgs[pkgname] digests = {} |