summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-07-28 04:58:45 +0000
committerZac Medico <zmedico@gentoo.org>2006-07-28 04:58:45 +0000
commit83dda008fba7d8dad213de5636b1847338ac8737 (patch)
tree0f396d8a40f70cc5ae97edc935892e97fd79d307 /pym/portage_manifest.py
parentSimplify permissions adjustment after a file is fetched. (diff)
downloadportage-multirepo-83dda008fba7d8dad213de5636b1847338ac8737.tar.gz
portage-multirepo-83dda008fba7d8dad213de5636b1847338ac8737.tar.bz2
portage-multirepo-83dda008fba7d8dad213de5636b1847338ac8737.zip
Add a --force option for `ebuild digest` so that the user doesn't have to manually remove the Manifest and files/digest-* files when upstream changes the identity of distfiles. See bug #141843.
svn path=/main/trunk/; revision=4041
Diffstat (limited to 'pym/portage_manifest.py')
-rw-r--r--pym/portage_manifest.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/pym/portage_manifest.py b/pym/portage_manifest.py
index ee9b4b83..8fbe6bc6 100644
--- a/pym/portage_manifest.py
+++ b/pym/portage_manifest.py
@@ -219,15 +219,14 @@ class Manifest(object):
for cpv in cpvlist:
dname = os.path.join(self.pkgdir, "files", "digest-%s" % self._catsplit(cpv)[1])
distlist = self._getCpvDistfiles(cpv)
- have_all_checksums = True
+ missing_digests = set()
for f in distlist:
if f not in self.fhashdict["DIST"] or len(self.fhashdict["DIST"][f]) == 0:
- have_all_checksums = False
- break
- if not have_all_checksums:
- # We don't have all the required checksums to generate a proper
- # digest, so we have to skip this cpv.
- continue
+ missing_digests.add(f)
+ if missing_digests:
+ # This allows us to force remove of stale digests for the
+ # ebuild --force digest option.
+ distlist = [f for f in distlist if f not in missing_digests]
update_digest = True
if not force:
try:
@@ -236,13 +235,15 @@ class Manifest(object):
f.close()
if len(old_data) == 1 and "DIST" in old_data:
new_data = self._getDigestData(distlist)
- for myfile in new_data["DIST"]:
- for hashname in new_data["DIST"][myfile].keys():
- if hashname != "size" and \
- hashname not in portage_const.MANIFEST1_HASH_FUNCTIONS:
- del new_data["DIST"][myfile][hashname]
- if new_data["DIST"] == old_data["DIST"]:
- update_digest = False
+ if "DIST" in new_data:
+ for myfile in new_data["DIST"]:
+ for hashname in \
+ new_data["DIST"][myfile].keys():
+ if hashname != "size" and hashname not in \
+ portage_const.MANIFEST1_HASH_FUNCTIONS:
+ del new_data["DIST"][myfile][hashname]
+ if new_data["DIST"] == old_data["DIST"]:
+ update_digest = False
except (IOError, OSError), e:
if errno.ENOENT == e.errno:
pass