summaryrefslogtreecommitdiffstats
path: root/pym/portage/manifest.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage/manifest.py')
-rw-r--r--pym/portage/manifest.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
index d09de2606..eaea0bdf6 100644
--- a/pym/portage/manifest.py
+++ b/pym/portage/manifest.py
@@ -18,6 +18,8 @@ from portage import _unicode_encode
from portage.exception import DigestException, FileNotFound, \
InvalidDataType, MissingParameter, PermissionDenied, \
PortageException, PortagePackageException
+from portage.const import (MANIFEST2_HASH_DEFAULTS,
+ MANIFEST2_HASH_FUNCTIONS, MANIFEST2_REQUIRED_HASH)
from portage.localization import _
class FileNotInManifestException(PortageException):
@@ -101,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):
+ allow_missing=False, allow_create=True, hash_flags=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
@@ -117,7 +119,15 @@ class Manifest(object):
self.pkgdir = _unicode_decode(pkgdir).rstrip(os.sep) + os.sep
self.fhashdict = {}
self.hashes = set()
- self.hashes.update(portage.const.MANIFEST2_HASH_FUNCTIONS)
+
+ 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)
+
self.hashes.difference_update(hashname for hashname in \
list(self.hashes) if hashname not in hashfunc_map)
self.hashes.add("size")
@@ -350,7 +360,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)
+ allow_create=self.allow_create, hash_flags=self.hash_flags)
pn = os.path.basename(self.pkgdir.rstrip(os.path.sep))
cat = self._pkgdir_category()