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
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