commit: f8b1d840de9ffd9aa86dc8666d8915826ffa0f63 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Thu Nov 24 06:50:14 2016 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Thu Nov 24 17:44:12 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f8b1d840
repos.conf: support strict-misc-digests attribute (bug 600128) This setting determines whether digests are checked for files declared in the Manifest with MISC type (includes ChangeLog and metadata.xml files). Defaults to true. The current GLEP 60 draft specifies that non-strict handling of MISC digests should be supported. X-Gentoo-Bug: 600128 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=600128 Acked-by: Brian Dolbec <dolsen <AT> gentoo.org> man/portage.5 | 9 ++++++++- pym/portage/manifest.py | 6 ++++-- pym/portage/package/ebuild/digestcheck.py | 2 +- pym/portage/repository/config.py | 18 ++++++++++++++---- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/man/portage.5 b/man/portage.5 index 963f49d..2cacafc 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -1,4 +1,4 @@ -.TH "PORTAGE" "5" "Nov 2015" "Portage VERSION" "Portage" +.TH "PORTAGE" "5" "Nov 2016" "Portage VERSION" "Portage" .SH NAME portage \- the heart of Gentoo .SH "DESCRIPTION" @@ -961,6 +961,13 @@ since operations performed by these tools are inherently .B priority Specifies priority of given repository. .TP +.B strict\-misc\-digests +This setting determines whether digests are checked for files declared +in the Manifest with MISC type (includes ChangeLog and metadata.xml +files). Defaults to true. +.br +Valid values: true, false. +.TP .B sync\-cvs\-repo Specifies CVS repository. .TP diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py index fe4166c..7278e21 100644 --- a/pym/portage/manifest.py +++ b/pym/portage/manifest.py @@ -129,7 +129,7 @@ class Manifest(object): def __init__(self, pkgdir, distdir=None, fetchlist_dict=None, manifest1_compat=DeprecationWarning, from_scratch=False, thin=False, allow_missing=False, allow_create=True, hashes=None, - find_invalid_path_char=None): + find_invalid_path_char=None, strict_misc_digests=True): """ 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 @@ -173,6 +173,7 @@ class Manifest(object): self.guessType = guessManifestFileType self.allow_missing = allow_missing self.allow_create = allow_create + self.strict_misc_digests = strict_misc_digests def getFullname(self): """ Returns the absolute path to the Manifest file for this instance """ @@ -461,7 +462,8 @@ class Manifest(object): fetchlist_dict=self.fetchlist_dict, from_scratch=True, thin=self.thin, allow_missing=self.allow_missing, allow_create=self.allow_create, hashes=self.hashes, - find_invalid_path_char=self._find_invalid_path_char) + find_invalid_path_char=self._find_invalid_path_char, + strict_misc_digests=self.strict_misc_digests) pn = os.path.basename(self.pkgdir.rstrip(os.path.sep)) cat = self._pkgdir_category() diff --git a/pym/portage/package/ebuild/digestcheck.py b/pym/portage/package/ebuild/digestcheck.py index e207ba8..502950f 100644 --- a/pym/portage/package/ebuild/digestcheck.py +++ b/pym/portage/package/ebuild/digestcheck.py @@ -48,7 +48,7 @@ def digestcheck(myfiles, mysettings, strict=False, justmanifest=None, mf=None): eout.ebegin(_("checking auxfile checksums ;-)")) mf.checkTypeHashes("AUX", hash_filter=hash_filter) eout.eend(0) - if mf.fhashdict.get("MISC"): + if mf.strict_misc_digests and mf.fhashdict.get("MISC"): eout.ebegin(_("checking miscfile checksums ;-)")) mf.checkTypeHashes("MISC", ignoreMissingFiles=True, hash_filter=hash_filter) diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 0512057..67c717d 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -80,7 +80,7 @@ class RepoConfig(object): 'find_invalid_path_char', 'force', 'format', 'local_config', 'location', 'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name', 'name', 'portage1_profiles', 'portage1_profiles_compat', 'priority', - 'profile_formats', 'sign_commit', 'sign_manifest', + 'profile_formats', 'sign_commit', 'sign_manifest', 'strict_misc_digests', 'sync_depth', 'sync_hooks_only_on_change', 'sync_type', 'sync_umask', 'sync_uri', 'sync_user', 'thin_manifest', 'update_changelog', '_eapis_banned', '_eapis_deprecated', @@ -172,6 +172,9 @@ class RepoConfig(object): self.sync_hooks_only_on_change = repo_opts.get( 'sync-hooks-only-on-change', 'false').lower() == 'true' + self.strict_misc_digests = repo_opts.get( + 'strict-misc-digests', 'true').lower() == 'true' + self.module_specific_options = {} # Not implemented. @@ -326,6 +329,7 @@ class RepoConfig(object): kwds['allow_missing'] = self.allow_missing_manifest kwds['allow_create'] = self.create_manifest kwds['hashes'] = self.manifest_hashes + kwds['strict_misc_digests'] = self.strict_misc_digests if self.disable_manifest: kwds['from_scratch'] = True kwds['find_invalid_path_char'] = self.find_invalid_path_char @@ -403,6 +407,8 @@ class RepoConfig(object): repo_msg.append(indent + "format: " + self.format) if self.location: repo_msg.append(indent + "location: " + self.location) + if not self.strict_misc_digests: + repo_msg.append(indent + "strict-misc-digests: false") if self.sync_type: repo_msg.append(indent + "sync-type: " + self.sync_type) if self.sync_umask: @@ -500,7 +506,7 @@ class RepoConfigLoader(object): # Selectively copy only the attributes which # repos.conf is allowed to override. for k in ('aliases', 'auto_sync', 'eclass_overrides', - 'force', 'masters', 'priority', + 'force', 'masters', 'priority', 'strict_misc_digests', 'sync_depth', 'sync_hooks_only_on_change', 'sync_type', 'sync_umask', 'sync_uri', 'sync_user', 'module_specific_options'): @@ -922,12 +928,13 @@ class RepoConfigLoader(object): return repo_name in self.prepos def config_string(self): + bool_keys = ("strict_misc_digests",) str_or_int_keys = ("auto_sync", "format", "location", "main_repo", "priority", "sync_type", "sync_umask", "sync_uri", 'sync_user') str_tuple_keys = ("aliases", "eclass_overrides", "force") repo_config_tuple_keys = ("masters",) - keys = str_or_int_keys + str_tuple_keys + repo_config_tuple_keys + keys = bool_keys + str_or_int_keys + str_tuple_keys + repo_config_tuple_keys config_string = "" for repo_name, repo in sorted(self.prepos.items(), key=lambda x: (x[0] != "DEFAULT", x[0])): config_string += "\n[%s]\n" % repo_name @@ -935,7 +942,10 @@ class RepoConfigLoader(object): if key == "main_repo" and repo_name != "DEFAULT": continue if getattr(repo, key) is not None: - if key in str_or_int_keys: + if key in bool_keys: + config_string += "%s = %s\n" % (key.replace("_", "-"), + 'true' if getattr(repo, key) else 'false') + elif key in str_or_int_keys: config_string += "%s = %s\n" % (key.replace("_", "-"), getattr(repo, key)) elif key in str_tuple_keys: config_string += "%s = %s\n" % (key.replace("_", "-"), " ".join(getattr(repo, key)))