commit: 33b08baff4825bf84f639cf213de92ed36f76771 Author: Wynn Wolf Arbor <wolf <AT> oriole <DOT> systems> AuthorDate: Thu Jul 2 15:50:18 2020 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Thu Jul 2 21:39:39 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=33b08baf
git: Verify boolean values passed to sync-git-verify-commit-signature Currently, if 'sync-git-verify-commit-signature' is set to anything other than 'yes', 'no', 'true', or 'false', its value is ignored silently and nothing is verified because the option defaults to 'false'. Introduce a check to CheckGitConfig that warns the user if their input is invalid. Bug: https://bugs.gentoo.org/703698 Signed-off-by: Wynn Wolf Arbor <wolf <AT> oriole.systems> Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/sync/modules/git/__init__.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/portage/sync/modules/git/__init__.py b/lib/portage/sync/modules/git/__init__.py index 270d97186..2081d0d25 100644 --- a/lib/portage/sync/modules/git/__init__.py +++ b/lib/portage/sync/modules/git/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2014-2018 Gentoo Foundation +# Copyright 2014-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 doc = """Git plug-in module for portage. @@ -14,6 +14,7 @@ class CheckGitConfig(CheckSyncConfig): def __init__(self, repo, logger): CheckSyncConfig.__init__(self, repo, logger) self.checks.append('check_depth') + self.checks.append('check_verify_commit_signature') def check_depth(self): for attr in ('clone_depth', 'sync_depth'): @@ -33,6 +34,16 @@ class CheckGitConfig(CheckSyncConfig): else: setattr(self.repo, attr, d) + def check_verify_commit_signature(self): + v = self.repo.module_specific_options.get( + 'sync-git-verify-commit-signature', 'false').lower() + + if v not in ('yes', 'no', 'true', 'false'): + writemsg_level("!!! %s\n" % + _("sync-git-verify-commit-signature not one of: %s") + % ('{yes, no, true, false}'), + level=self.logger.ERROR, noiselevel=-1) + module_spec = { 'name': 'git',
