public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>, "Zac Medico" <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH] repoman: support metadata/layout.conf restrict-allowed
Date: Mon,  5 Aug 2019 20:40:29 -0700	[thread overview]
Message-ID: <20190806034029.28125-1-zmedico@gentoo.org> (raw)

Bug: https://bugs.gentoo.org/690786
Signed-off-by: Zac Medico <zmedico@gentoo.org>
---
 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



                 reply	other threads:[~2019-08-06  3:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190806034029.28125-1-zmedico@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    --cc=mgorny@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox