diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-10-16 22:55:46 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-10-16 22:55:46 +0000 |
commit | 37a03b74e830e3ad18cbcab776121cdcf57ee8b8 (patch) | |
tree | d87e2338d5da1c5f05324b4526a7899fa5f9ad75 | |
parent | 32c6549b6cef314706a4e139c7c3bff576dc2ef8 (diff) | |
download | portage-37a03b74e830e3ad18cbcab776121cdcf57ee8b8.tar.gz portage-37a03b74e830e3ad18cbcab776121cdcf57ee8b8.tar.bz2 portage-37a03b74e830e3ad18cbcab776121cdcf57ee8b8.zip |
Bug #242304 - When a zero-byte distfile is detected inside fetch(), discard
the digests and attempt to fetch the file if possible. This code is triggered
via digestgen() when appropriate, so it fixes all digestgen() callers,
including repoman.
svn path=/main/trunk/; revision=11695
-rw-r--r-- | pym/portage/__init__.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index e03753196..29251ddcd 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -3319,6 +3319,9 @@ def _check_distfile(filename, digests, eout, show_errors=1): if size is not None: eout.ebegin("%s %s ;-)" % (os.path.basename(filename), "size")) eout.eend(0) + elif st.st_size == 0: + # Zero-byte distfiles are always invalid. + return (False, st) else: if _check_digests(filename, digests, show_errors=show_errors): eout.ebegin("%s %s ;-)" % (os.path.basename(filename), @@ -3636,6 +3639,10 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", orig_digests = mydigests.get(myfile, {}) size = orig_digests.get("size") + if size == 0: + # Zero-byte distfiles are always invalid, so discard their digests. + orig_digests.clear() + size = None pruned_digests = orig_digests if parallel_fetchonly: pruned_digests = {} @@ -3650,7 +3657,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", else: # check if there is enough space in DISTDIR to completely store myfile # overestimate the filesize so we aren't bitten by FS overhead - if hasattr(os, "statvfs"): + if size is not None and hasattr(os, "statvfs"): vfs_stat = os.statvfs(mysettings["DISTDIR"]) try: mysize = os.stat(myfile_path).st_size @@ -3659,8 +3666,7 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks", raise del e mysize = 0 - if myfile in mydigests \ - and (mydigests[myfile]["size"] - mysize + vfs_stat.f_bsize) >= \ + if (size - mysize + vfs_stat.f_bsize) >= \ (vfs_stat.f_bsize * vfs_stat.f_bavail): writemsg("!!! Insufficient space to store %s in %s\n" % (myfile, mysettings["DISTDIR"]), noiselevel=-1) has_space = False |