Make ebuild digest reuse existing checksums
authorMarius Mauch <genone@gentoo.org>
Sat, 25 Mar 2006 00:45:29 +0000 (00:45 -0000)
committerMarius Mauch <genone@gentoo.org>
Sat, 25 Mar 2006 00:45:29 +0000 (00:45 -0000)
svn path=/main/trunk/; revision=2997

pym/portage.py
pym/portage_manifest.py

index 03b3b307b6d66a991d2173853b963a1e463c5977..6b36bfd6a7ffde80e08c8e0aaaaabda8ccbd52f8 100644 (file)
@@ -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
index 9dddd69823d196c8e694e745256966ccc48f48de..962dbb4474c3c77ae073e550157f546ee2a281a3 100644 (file)
@@ -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):