summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-06-24 23:47:03 +0000
committerZac Medico <zmedico@gentoo.org>2007-06-24 23:47:03 +0000
commit4146e3875105fb4dae02f279395aac94a1fa838a (patch)
tree3f5a7943ece02190394d331f63fc3ca2da72659a /pym
parent9e14f11d112f3085ff66bf6405b13f8d26160ad8 (diff)
downloadportage-4146e3875105fb4dae02f279395aac94a1fa838a.tar.gz
portage-4146e3875105fb4dae02f279395aac94a1fa838a.tar.bz2
portage-4146e3875105fb4dae02f279395aac94a1fa838a.zip
Fix binarytree.isremote() to be consistent with binarytree.gettbz2() logic wrt partially downloaded files.
svn path=/main/trunk/; revision=7012
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dbapi/bintree.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index a2ce78b0c..5151b8ae6 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -829,10 +829,15 @@ class binarytree(object):
return os.path.join(self.pkgdir, mypath)
def isremote(self, pkgname):
- "Returns true if the package is kept remotely."
- remote = pkgname in self._remotepkgs and \
- not os.path.exists(self.getname(pkgname))
- return remote
+ """Returns true if the package is kept remotely and it has not been
+ downloaded (or it is only partially downloaded)."""
+ if pkgname not in self._remotepkgs:
+ return False
+ pkg_path = self.getname(pkgname)
+ 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):
writemsg("deprecated use of binarytree.get_use()," + \
@@ -840,7 +845,8 @@ class binarytree(object):
return self.dbapi.aux_get(pkgname, ["USE"])[0].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"