summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-12-09 23:32:33 +0000
committerZac Medico <zmedico@gentoo.org>2008-12-09 23:32:33 +0000
commit265d4c5f01c2674faf4639b28f81c2f690a9e8f1 (patch)
tree472860b9be9a7ca6e23cdf443f53e7b149c1490c
parent2517d4e948a8bbaeb6c6264b0fe5bcb6f798c2fb (diff)
downloadportage-265d4c5f01c2674faf4639b28f81c2f690a9e8f1.tar.gz
portage-265d4c5f01c2674faf4639b28f81c2f690a9e8f1.tar.bz2
portage-265d4c5f01c2674faf4639b28f81c2f690a9e8f1.zip
Simplify the code from bug #250166.
svn path=/main/trunk/; revision=12187
-rw-r--r--pym/portage/__init__.py43
1 files changed, 15 insertions, 28 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 1ca0404b9..860eea38b 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -4244,7 +4244,7 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None
required_hash_types.add("size")
required_hash_types.add(portage.const.MANIFEST2_REQUIRED_HASH)
dist_hashes = mf.fhashdict.get("DIST", {})
- missing_hashes = set()
+
# To avoid accidental regeneration of digests with the incorrect
# files (such as partially downloaded files), trigger the fetch
# code if the file exists and it's size doesn't match the current
@@ -4252,45 +4252,32 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None
# digest to change, `ebuild --force digest` can be used to avoid
# triggering this code (or else the old digests can be manually
# removed from the Manifest).
- wrong_size_files = set()
+ missing_files = []
for myfile in distfiles_map:
myhashes = dist_hashes.get(myfile)
if not myhashes:
- missing_hashes.add(myfile)
- continue
- if required_hash_types.difference(myhashes):
- missing_hashes.add(myfile)
+ missing_files.append(myfile)
continue
- if myhashes["size"] == 0:
- missing_hashes.add(myfile)
+ size = myhashes.get("size")
+ if size == 0:
+ missing_files.append(myfile)
continue
+
try:
st = os.stat(os.path.join(mysettings["DISTDIR"], myfile))
except OSError, e:
if e.errno != errno.ENOENT:
raise
del e
- continue
- if st.st_size == 0 or st.st_size != myhashes["size"]:
- wrong_size_files.add(myfile)
- continue
-
- if missing_hashes or wrong_size_files:
- missing_files = []
- for myfile in missing_hashes:
- try:
- st = os.stat(os.path.join(mysettings["DISTDIR"], myfile))
- except OSError, e:
- if e.errno != errno.ENOENT:
- raise
- del e
+ if required_hash_types.difference(myhashes):
missing_files.append(myfile)
- else:
- # If the file is empty then it's obviously invalid.
- if st.st_size == 0:
- missing_files.append(myfile)
- missing_files.extend(wrong_size_files)
- if missing_files:
+ continue
+ else:
+ if st.st_size == 0 or size is not None and size != st.st_size:
+ missing_files.append(myfile)
+ continue
+
+ if missing_files:
mytree = os.path.realpath(os.path.dirname(
os.path.dirname(mysettings["O"])))
fetch_settings = config(clone=mysettings)