aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-10-03 02:42:53 -0700
committerZac Medico <zmedico@gentoo.org>2011-10-03 02:42:53 -0700
commitd9d0606fe01618cc81fb0b862ada91149dad3746 (patch)
treea8fc59143393b3c82fddb596c1f67437485e1db1 /pym/portage/manifest.py
parentImplement GLEP 59 with control via layout.conf. (diff)
downloadportage-d9d0606fe01618cc81fb0b862ada91149dad3746.tar.gz
portage-d9d0606fe01618cc81fb0b862ada91149dad3746.tar.bz2
portage-d9d0606fe01618cc81fb0b862ada91149dad3746.zip
GLEP 59: use manifest-hashes list in layout.conf
The manifest-hashes layout.conf setting simply overrides the hashes that are generated. When unspecified, the MANIFEST2_HASH_DEFAULTS constant is used instead (current value contains SHA1, SHA256, and RMD160). In order to enable SHA512 and WHIRLPOOL, and drop RMD160 and SHA1, simply set "manifest-hashes = SHA256 SHA512 WHIRLPOOL" in layout.conf. As with the previous boolean flags approach, manifest-hashes settings become redundant and can be removed from layout.conf after a version of portage with equivalent defaults is stable.
Diffstat (limited to 'pym/portage/manifest.py')
-rw-r--r--pym/portage/manifest.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
index eaea0bdf6..78153c02a 100644
--- a/pym/portage/manifest.py
+++ b/pym/portage/manifest.py
@@ -103,7 +103,7 @@ class Manifest(object):
parsers = (parseManifest2,)
def __init__(self, pkgdir, distdir, fetchlist_dict=None,
manifest1_compat=DeprecationWarning, from_scratch=False, thin=False,
- allow_missing=False, allow_create=True, hash_flags=None):
+ allow_missing=False, allow_create=True, hashes=None):
""" Create new Manifest instance for package in pkgdir.
Do not parse Manifest file if from_scratch == True (only for internal use)
The fetchlist_dict parameter is required only for generation of
@@ -120,14 +120,10 @@ class Manifest(object):
self.fhashdict = {}
self.hashes = set()
- if hash_flags is None:
- hash_flags = {}
- self.hash_flags = hash_flags
- for hash_type in MANIFEST2_HASH_FUNCTIONS:
- default_state = hash_type in MANIFEST2_HASH_DEFAULTS
- if hash_flags.get(hash_type, default_state):
- self.hashes.add(hash_type)
+ if hashes is None:
+ hashes = MANIFEST2_HASH_DEFAULTS
+ self.hashes.update(hashes.intersection(MANIFEST2_HASH_FUNCTIONS))
self.hashes.difference_update(hashname for hashname in \
list(self.hashes) if hashname not in hashfunc_map)
self.hashes.add("size")
@@ -360,7 +356,7 @@ class Manifest(object):
self.__init__(self.pkgdir, self.distdir,
fetchlist_dict=self.fetchlist_dict, from_scratch=True,
thin=self.thin, allow_missing=self.allow_missing,
- allow_create=self.allow_create, hash_flags=self.hash_flags)
+ allow_create=self.allow_create, hashes=self.hashes)
pn = os.path.basename(self.pkgdir.rstrip(os.path.sep))
cat = self._pkgdir_category()