Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/sync/modules/git/
Date: Thu, 02 Jul 2020 22:08:49
Message-Id: 1593725979.33b08baff4825bf84f639cf213de92ed36f76771.zmedico@gentoo
1 commit: 33b08baff4825bf84f639cf213de92ed36f76771
2 Author: Wynn Wolf Arbor <wolf <AT> oriole <DOT> systems>
3 AuthorDate: Thu Jul 2 15:50:18 2020 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Jul 2 21:39:39 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=33b08baf
7
8 git: Verify boolean values passed to sync-git-verify-commit-signature
9
10 Currently, if 'sync-git-verify-commit-signature' is set to anything
11 other than 'yes', 'no', 'true', or 'false', its value is ignored
12 silently and nothing is verified because the option defaults to 'false'.
13
14 Introduce a check to CheckGitConfig that warns the user if their input
15 is invalid.
16
17 Bug: https://bugs.gentoo.org/703698
18 Signed-off-by: Wynn Wolf Arbor <wolf <AT> oriole.systems>
19 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
20
21 lib/portage/sync/modules/git/__init__.py | 13 ++++++++++++-
22 1 file changed, 12 insertions(+), 1 deletion(-)
23
24 diff --git a/lib/portage/sync/modules/git/__init__.py b/lib/portage/sync/modules/git/__init__.py
25 index 270d97186..2081d0d25 100644
26 --- a/lib/portage/sync/modules/git/__init__.py
27 +++ b/lib/portage/sync/modules/git/__init__.py
28 @@ -1,4 +1,4 @@
29 -# Copyright 2014-2018 Gentoo Foundation
30 +# Copyright 2014-2020 Gentoo Authors
31 # Distributed under the terms of the GNU General Public License v2
32
33 doc = """Git plug-in module for portage.
34 @@ -14,6 +14,7 @@ class CheckGitConfig(CheckSyncConfig):
35 def __init__(self, repo, logger):
36 CheckSyncConfig.__init__(self, repo, logger)
37 self.checks.append('check_depth')
38 + self.checks.append('check_verify_commit_signature')
39
40 def check_depth(self):
41 for attr in ('clone_depth', 'sync_depth'):
42 @@ -33,6 +34,16 @@ class CheckGitConfig(CheckSyncConfig):
43 else:
44 setattr(self.repo, attr, d)
45
46 + def check_verify_commit_signature(self):
47 + v = self.repo.module_specific_options.get(
48 + 'sync-git-verify-commit-signature', 'false').lower()
49 +
50 + if v not in ('yes', 'no', 'true', 'false'):
51 + writemsg_level("!!! %s\n" %
52 + _("sync-git-verify-commit-signature not one of: %s")
53 + % ('{yes, no, true, false}'),
54 + level=self.logger.ERROR, noiselevel=-1)
55 +
56
57 module_spec = {
58 'name': 'git',