diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-06-24 23:52:16 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-06-24 23:52:16 +0000 |
commit | a8f01f071456e4621903c6a6939a4b1a626ebcad (patch) | |
tree | 451fb17086a9586b5a93d8377c2a3f8f4d08d6a9 /pym/portage.py | |
parent | 10ad16bede53aed8315139ccaa562f9d41005d0e (diff) | |
download | portage-a8f01f071456e4621903c6a6939a4b1a626ebcad.tar.gz portage-a8f01f071456e4621903c6a6939a4b1a626ebcad.tar.bz2 portage-a8f01f071456e4621903c6a6939a4b1a626ebcad.zip |
Fix binarytree.isremote() to be consistent with binarytree.gettbz2() logic wrt partially downloaded files. (trunk r7012)
svn path=/main/branches/2.1.2/; revision=7013
Diffstat (limited to 'pym/portage.py')
-rw-r--r-- | pym/portage.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/pym/portage.py b/pym/portage.py index d517fa37c..5dca355b7 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6781,11 +6781,16 @@ class binarytree(object): self._pkg_paths[mycpv] = mypath # cache for future lookups return os.path.join(self.pkgdir, mypath) - def isremote(self,pkgname): - "Returns true if the package is kept remotely." - mysplit=pkgname.split("/") - remote = (not os.path.exists(self.getname(pkgname))) and self.remotepkgs.has_key(mysplit[1]+".tbz2") - return remote + def isremote(self, pkgname): + """Returns true if the package is kept remotely and it has not been + downloaded (or it is only partially downloaded).""" + pkg_path = self.getname(pkgname) + if os.path.basename(pkg_path) not in self.remotepkgs: + return False + if os.path.exists(pkg_path) and \ + os.path.basename(pkg_path) not in self.invalids: + return False + return True def get_use(self,pkgname): mysplit=pkgname.split("/") @@ -6795,7 +6800,8 @@ class binarytree(object): return tbz2.getfile("USE").split() def gettbz2(self,pkgname): - "fetches the package from a remote site, if necessary." + """Fetches the package from a remote site, if necessary. Attempts to + resume if the file appears to be partially downloaded.""" print "Fetching '"+str(pkgname)+"'" mysplit = pkgname.split("/") tbz2name = mysplit[1]+".tbz2" |