Synchronize required hash code in all relevant places. (trunk r5924)
authorZac Medico <zmedico@gentoo.org>
Wed, 7 Feb 2007 23:44:49 +0000 (23:44 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 7 Feb 2007 23:44:49 +0000 (23:44 -0000)
svn path=/main/branches/2.1.2/; revision=5925

pym/portage.py
pym/portage_const.py
pym/portage_manifest.py

index a3dcd7b06b22a0ea919967c224ee62a42672020b..32907c32e4f033d2dfffd606123111f61b5ddfff 100644 (file)
@@ -2686,9 +2686,9 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None
                # fetches when sufficient digests already exist.  To ease transition
                # while Manifest 1 is being removed, only require hashes that will
                # exist before and after the transition.
-               required_hash_types = set(portage_const.MANIFEST1_HASH_FUNCTIONS
-                       ).intersection(portage_const.MANIFEST2_HASH_FUNCTIONS)
+               required_hash_types = set()
                required_hash_types.add("size")
+               required_hash_types.add(portage_const.MANIFEST2_REQUIRED_HASH)
                dist_hashes = mf.fhashdict.get("DIST", {})
                missing_hashes = set()
                for myfile in distfiles_map:
@@ -3554,8 +3554,11 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0,
                        # Skip files that we already have digests for.
                        mf = Manifest(mysettings["O"], mysettings["DISTDIR"])
                        mydigests = mf.getTypeDigests("DIST")
+                       required_hash_types = set()
+                       required_hash_types.add("size")
+                       required_hash_types.add(portage_const.MANIFEST2_REQUIRED_HASH)
                        for filename, hashes in mydigests.iteritems():
-                               if len(hashes) == len(mf.hashes):
+                               if not required_hash_types.difference(hashes):
                                        checkme = [i for i in checkme if i != filename]
                                        fetchme = [i for i in fetchme \
                                                if os.path.basename(i) != filename]
index 7b44a6c1aff08df6cd50c8456d38e7de9eb83543..4f0d04ecb9e0c390493ac13c296e807005b95848 100644 (file)
@@ -23,7 +23,6 @@ CUSTOM_PROFILE_PATH     = USER_CONFIG_PATH+"/profile"
 PORTAGE_BASE_PATH       = os.path.join(os.sep, os.sep.join(__file__.split(os.sep)[:-2]))
 PORTAGE_BIN_PATH        = PORTAGE_BASE_PATH+"/bin"
 PORTAGE_PYM_PATH        = PORTAGE_BASE_PATH+"/pym"
-NEWS_LIB_PATH           = "/var/lib/gentoo"
 PROFILE_PATH            = "/etc/make.profile"
 LOCALE_DATA_PATH        = PORTAGE_BASE_PATH+"/locale"
 
@@ -45,9 +44,6 @@ CUSTOM_MIRRORS_FILE     = USER_CONFIG_PATH+"/mirrors"
 CONFIG_MEMORY_FILE      = PRIVATE_PATH + "/config"
 COLOR_MAP_FILE          = USER_CONFIG_PATH + "/color.map"
 
-REPO_NAME_FILE         = "repo_name"
-REPO_NAME_LOC          = "profiles" + "/" + REPO_NAME_FILE
-
 INCREMENTALS=["USE","USE_EXPAND","USE_EXPAND_HIDDEN","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"]
 EBUILD_PHASES           = ["setup", "unpack", "compile", "test", "install",
                           "preinst", "postinst", "prerm", "postrm", "other"]
@@ -57,6 +53,7 @@ EAPI = 0
 HASHING_BLOCKSIZE        = 32768
 MANIFEST1_HASH_FUNCTIONS = ["MD5","SHA256","RMD160"]
 MANIFEST2_HASH_FUNCTIONS = ["SHA1","SHA256","RMD160"]
+MANIFEST2_REQUIRED_HASH = "SHA1"
 
 MANIFEST2_IDENTIFIERS = ["AUX","MISC","DIST","EBUILD"]
 # ===========================================================================
index 1266e33df435b7a6b0ee0e8ef342627f154663db..225638e508530650fca276fd5f4416100d74ee36 100644 (file)
@@ -459,6 +459,10 @@ class Manifest(object):
                        # repoman passes in an empty list, which implies that all distfiles
                        # are required.
                        requiredDistfiles = distlist.copy()
+               required_hash_types = set()
+               required_hash_types.add("size")
+               required_hash_types.add(portage_const.MANIFEST2_REQUIRED_HASH)
+               
                for f in distlist:
                        fname = os.path.join(self.distdir, f)
                        mystat = None
@@ -471,7 +475,8 @@ class Manifest(object):
                                (assumeDistHashesAlways and mystat is None) or \
                                (assumeDistHashesAlways and mystat is not None and \
                                len(distfilehashes[f]) == len(self.hashes) and \
-                               distfilehashes[f]["size"] == mystat.st_size)):
+                               distfilehashes[f]["size"] == mystat.st_size)) and \
+                               not required_hash_types.difference(distfilehashes[f]):
                                self.fhashdict["DIST"][f] = distfilehashes[f]
                        else:
                                try: