Bring back FEATURES="assume-digests" for bug #132182.
authorZac Medico <zmedico@gentoo.org>
Thu, 4 May 2006 02:44:01 +0000 (02:44 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 4 May 2006 02:44:01 +0000 (02:44 -0000)
svn path=/main/trunk/; revision=3317

pym/portage.py
pym/portage_manifest.py

index a30391181fe28b6a4927e5af65c3ff137522b693..8b46a35d776e9323e7683e3ca8ea3af11bdad7d6 100644 (file)
@@ -2222,7 +2222,8 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None
                fetchlist_dict=FetchlistDict(mysettings["O"], mysettings, myportdb))
        writemsg(">>> Creating Manifest for %s\n" % mysettings["O"])
        try:
-               mf.create(assumeDistfileHashes=True, requiredDistfiles=myarchives)
+               mf.create(requiredDistfiles=myarchives, assumeDistHashesSometimes=True,
+                       assumeDistHashesAlways=("assume-digests" in mysettings.features))
        except portage_exception.FileNotFound, e:
                writemsg("!!! File %s doesn't exist, can't update Manifest\n" % str(e))
                return 0
index 856ba6fbc24e03725ab9fe369e9699b2cb2df3ed..669ee60671e6bd7d7617edb1d1899d9af28a49ae 100644 (file)
@@ -400,16 +400,19 @@ class Manifest(object):
                                return t
                return None
        
-       def create(self, checkExisting=False, assumeDistfileHashes=True, requiredDistfiles=None):
-               """ Recreate this Manifest from scratch, not using any existing checksums
-               (exception: if assumeDistfileHashes is true then existing DIST checksums are
-               reused if the file doesn't exist in DISTDIR.  The requiredDistfiles
-               parameter specifies a list of distfiles to raise a FileNotFound
-               exception for (if no file or existing checksums are available), and
-               defaults to all distfiles when not specified."""
+       def create(self, checkExisting=False, assumeDistHashesSometimes=False,
+               assumeDistHashesAlways=False, requiredDistfiles=None):
+               """ Recreate this Manifest from scratch.  This will not use any
+               existing checksums unless assumeDistHashesSometimes or
+               assumeDistHashesAlways is true (assumeDistHashesSometimes will only
+               cause DIST checksums to be reused if the file doesn't exist in
+               DISTDIR).  The requiredDistfiles parameter specifies a list of
+               distfiles to raise a FileNotFound exception for (if no file or existing
+               checksums are available), and defaults to all distfiles when not
+               specified."""
                if checkExisting:
                        self.checkAllHashes()
-               if assumeDistfileHashes:
+               if assumeDistHashesSometimes or assumeDistHashesAlways:
                        distfilehashes = self.fhashdict["DIST"]
                else:
                        distfilehashes = {}
@@ -446,12 +449,16 @@ class Manifest(object):
                        requiredDistfiles = distlist.copy()
                for f in distlist:
                        fname = os.path.join(self.distdir, f)
-                       if os.path.exists(fname):
-                               self.fhashdict["DIST"][f] = perform_multiple_checksums(fname, self.hashes)
-                       elif assumeDistfileHashes and f in distfilehashes:
+                       if f in distfilehashes and (assumeDistHashesAlways or \
+                               (assumeDistHashesSometimes and not os.path.exists(fname))):
                                self.fhashdict["DIST"][f] = distfilehashes[f]
-                       elif f in requiredDistfiles:
-                                       raise FileNotFound(fname)
+                       else:
+                               try:
+                                       self.fhashdict["DIST"][f] = perform_multiple_checksums(fname, self.hashes)
+                               except FileNotFound:
+                                       if f in requiredDistfiles:
+                                               raise
+
        def _pkgdir_category(self):
                return self.pkgdir.rstrip(os.sep).split(os.sep)[-2]