summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dbapi/porttree.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 238db8319..07a7b0c62 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -785,10 +785,15 @@ class portdbapi(dbapi):
return {}
filesdict={}
myfiles = self.getFetchMap(mypkg, useflags=useflags)
+ ro_distdirs = [x for x in \
+ shlex_split(self.settings.get("PORTAGE_RO_DISTDIRS", "")) \
+ if os.path.isdir(x)]
#XXX: maybe this should be improved: take partial downloads
# into account? check checksums?
for myfile in myfiles:
- if myfile not in checksums:
+ try:
+ fetch_size = int(checksums[myfile]["size"])
+ except (KeyError, ValueError):
if debug:
writemsg(_("[bad digest]: missing %(file)s for %(pkg)s\n") % {"file":myfile, "pkg":mypkg})
continue
@@ -800,9 +805,18 @@ class portdbapi(dbapi):
pass
if mystat is None:
existing_size = 0
+ for x in ro_distdirs:
+ try:
+ mystat = os.stat(os.path.join(x, myfile))
+ except OSError:
+ pass
+ else:
+ if mystat.st_size == fetch_size:
+ existing_size = fetch_size
+ break
else:
existing_size = mystat.st_size
- remaining_size = int(checksums[myfile]["size"]) - existing_size
+ remaining_size = fetch_size - existing_size
if remaining_size > 0:
# Assume the download is resumable.
filesdict[myfile] = remaining_size