From: Marius Mauch Date: Sat, 25 Mar 2006 00:45:29 +0000 (-0000) Subject: Make ebuild digest reuse existing checksums X-Git-Tag: v2.1_pre7~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e4becfedbeb95e47d26cb9009fad6ee24e0c9439;p=portage.git Make ebuild digest reuse existing checksums svn path=/main/trunk/; revision=2997 --- diff --git a/pym/portage.py b/pym/portage.py index 03b3b307b..6b36bfd6a 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -2053,7 +2053,7 @@ def digestgen(myarchives,mysettings,db=None,overwrite=1,manifestonly=0): mf.create(assumeDistfileHashes=True) try: writemsg(">>> Adding digests for file %s\n" % f) - mf.updateFileHashes(mytype, f, checkExisting=False) + mf.updateFileHashes(mytype, f, checkExisting=False, reuseExisting=True) except portage_exception.FileNotFound, e: writemsg("!!! File %s doesn't exist, can't update Manifest\n" % str(e)) return 0 diff --git a/pym/portage_manifest.py b/pym/portage_manifest.py index 9dddd6982..962dbb447 100644 --- a/pym/portage_manifest.py +++ b/pym/portage_manifest.py @@ -279,7 +279,7 @@ class Manifest(object): """ Get a list of all DIST files associated to the given cpv """ return self.db.getfetchlist(cpv, mysettings=self.mysettings, all=True)[1] - def updateFileHashes(self, ftype, fname, checkExisting=True, ignoreMissing=True): + def updateFileHashes(self, ftype, fname, checkExisting=True, ignoreMissing=True, reuseExisting=False): """ Regenerate hashes for the given file """ if checkExisting: self.checkFileHashes(fname) @@ -287,7 +287,11 @@ class Manifest(object): raise FileNotInManifestException(fname) if not self.fhashdict[ftype].has_key(fname): self.fhashdict[ftype][fname] = {} - myhashes = perform_multiple_checksums(self._getAbsname(ftype, fname), self.hashes) + myhashkeys = list(self.hashes) + if reuseExisting: + for k in [h for h in self.fhashdict[ftype][fname].keys() if h in myhashkeys]: + myhashkeys.remove(k) + myhashes = perform_multiple_checksums(self._getAbsname(ftype, fname), myhashkeys) self.fhashdict[ftype][fname].update(myhashes) def updateTypeHashes(self, idtype, checkExisting=False, ignoreMissingFiles=True):