From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D625B138334 for ; Tue, 6 Aug 2019 03:42:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 18FAAE089A; Tue, 6 Aug 2019 03:42:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 937C0E089A for ; Tue, 6 Aug 2019 03:42:02 +0000 (UTC) Received: from localhost.localdomain (unknown [100.42.98.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id EB4AD34971F; Tue, 6 Aug 2019 03:42:00 +0000 (UTC) From: Zac Medico To: gentoo-portage-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= , Zac Medico Subject: [gentoo-portage-dev] [PATCH] repoman: support metadata/layout.conf restrict-allowed Date: Mon, 5 Aug 2019 20:40:29 -0700 Message-Id: <20190806034029.28125-1-zmedico@gentoo.org> X-Mailer: git-send-email 2.21.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: eb3ca4ce-457b-4ca3-a648-234c167a5a14 X-Archives-Hash: 1285ed1bfe73388ed7cf95642da440b0 Bug: https://bugs.gentoo.org/690786 Signed-off-by: Zac Medico --- lib/portage/repository/config.py | 8 +++++++- repoman/lib/repoman/modules/scan/metadata/restrict.py | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py index 2b2b1e151..46bb6b65a 100644 --- a/lib/portage/repository/config.py +++ b/lib/portage/repository/config.py @@ -103,6 +103,7 @@ class RepoConfig(object): 'portage1_profiles_compat', 'priority', 'profile_formats', + 'restrict_allowed', 'sign_commit', 'sign_manifest', 'strict_misc_digests', @@ -339,7 +340,7 @@ class RepoConfig(object): for value in ('allow-missing-manifest', 'cache-formats', 'create-manifest', 'disable-manifest', 'manifest-hashes', - 'manifest-required-hashes', 'profile-formats', + 'manifest-required-hashes', 'profile-formats', 'restrict-allowed', 'sign-commit', 'sign-manifest', 'thin-manifest', 'update-changelog'): setattr(self, value.lower().replace("-", "_"), layout_data[value]) @@ -1142,6 +1143,11 @@ def parse_layout_conf(repo_location, repo_name=None): data['eapis-banned'] = tuple(layout_data.get('eapis-banned', '').split()) data['eapis-deprecated'] = tuple(layout_data.get('eapis-deprecated', '').split()) + restrict_allowed = layout_data.get('restrict-allowed') + if restrict_allowed is not None: + restrict_allowed = tuple(restrict_allowed.split()) + data['restrict-allowed'] = restrict_allowed + data['sign-commit'] = layout_data.get('sign-commits', 'false').lower() \ == 'true' diff --git a/repoman/lib/repoman/modules/scan/metadata/restrict.py b/repoman/lib/repoman/modules/scan/metadata/restrict.py index 99784f231..f39128b24 100644 --- a/repoman/lib/repoman/modules/scan/metadata/restrict.py +++ b/repoman/lib/repoman/modules/scan/metadata/restrict.py @@ -18,6 +18,10 @@ class RestrictChecks(ScanBase): ''' self.qatracker = kwargs.get('qatracker') self.repo_settings = kwargs.get('repo_settings') + if self.repo_settings.repo_config.restrict_allowed is None: + self._restrict_allowed = self.repo_settings.qadata.valid_restrict + else: + self._restrict_allowed = self.repo_settings.repo_config.restrict_allowed def check(self, **kwargs): xpkg = kwargs.get('xpkg') @@ -35,7 +39,7 @@ class RestrictChecks(ScanBase): if myrestrict: myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(self.repo_settings.qadata.valid_restrict) + mybadrestrict = myrestrict.difference(self._restrict_allowed) if mybadrestrict: for mybad in mybadrestrict: -- 2.21.0