From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id ED88613838B for ; Wed, 1 Oct 2014 23:46:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A86E3E08F8; Wed, 1 Oct 2014 23:46:44 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C1386E08DC for ; Wed, 1 Oct 2014 23:46:41 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9AB5034038E for ; Wed, 1 Oct 2014 23:46:40 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AE4556B91 for ; Wed, 1 Oct 2014 23:46:36 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1412207135.a7c9f77f9ab9321fe9beda0bbf7716f2b206405b.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/ X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/checks/ebuilds/variables/restrict.py pym/repoman/main.py X-VCS-Directories: pym/repoman/ pym/repoman/checks/ebuilds/variables/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: a7c9f77f9ab9321fe9beda0bbf7716f2b206405b X-VCS-Branch: repoman Date: Wed, 1 Oct 2014 23:46:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: bab114c5-2b2f-4d14-9a7a-d9d34da9e65b X-Archives-Hash: 24bb3d4a110f1f7b55f3b6bffc7b2a29 commit: a7c9f77f9ab9321fe9beda0bbf7716f2b206405b Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:23:33 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Wed Oct 1 23:45:35 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a7c9f77f repoman/main.py: Split RESTRICT checks to checks/ebuild/variables/ --- pym/repoman/checks/ebuilds/variables/restrict.py | 41 ++++++++++++++++++++++++ pym/repoman/main.py | 25 ++++----------- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/restrict.py b/pym/repoman/checks/ebuilds/variables/restrict.py new file mode 100644 index 0000000..215b792 --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/restrict.py @@ -0,0 +1,41 @@ + +'''restrict.py +Perform checks on the RESTRICT variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + +from repoman.qa_data import valid_restrict + + +class RestrictChecks(object): + '''Perform checks on the RESTRICT variable.''' + + def __init__(self, qatracker): + ''' + @param qatracker: QATracker instance + ''' + self.qatracker = qatracker + + def check(self, pkg, package, ebuild, y_ebuild): + myrestrict = None + + try: + myrestrict = portage.dep.use_reduce( + pkg._metadata["RESTRICT"], matchall=1, flat=True) + except portage.exception.InvalidDependString as e: + self. qatracker.add_error( + "RESTRICT.syntax", + "%s: RESTRICT: %s" % (ebuild.relative_path, e)) + del e + + if myrestrict: + myrestrict = set(myrestrict) + mybadrestrict = myrestrict.difference(valid_restrict) + + if mybadrestrict: + for mybad in mybadrestrict: + self.qatracker.add_error( + "RESTRICT.invalid", + package + "/" + y_ebuild + ".ebuild: %s" % mybad) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 722de79..b3e93bf 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -61,6 +61,7 @@ from repoman.checks.ebuilds.use_flags import USEFlagChecks from repoman.checks.ebuilds.variables.description import DescriptionChecks from repoman.checks.ebuilds.variables.eapi import EAPIChecks from repoman.checks.ebuilds.variables.license import LicenseChecks +from repoman.checks.ebuilds.variables.restrict import RestrictChecks from repoman.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -68,7 +69,7 @@ from repoman.profile import check_profiles, dev_keywords, setup_profile from repoman.qa_data import ( format_qa_output, format_qa_output_column, qahelp, qawarnings, qacats, missingvars, - suspect_virtual, suspect_rdepend, valid_restrict) + suspect_virtual, suspect_rdepend) from repoman.qa_tracker import QATracker from repoman.repos import RepoSettings, repo_metadata from repoman.scan import Changes, scan @@ -298,6 +299,7 @@ rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) +restrictcheck = RestrictChecks(qatracker) ###################### for xpkg in effective_scanlist: @@ -617,24 +619,9 @@ for xpkg in effective_scanlist: licensecheck.check(pkg, xpkg, ebuild, y_ebuild) ################# - # restrict checks - myrestrict = None - try: - myrestrict = portage.dep.use_reduce( - myaux["RESTRICT"], matchall=1, flat=True) - except portage.exception.InvalidDependString as e: - qatracker.add_error( - "RESTRICT.syntax", - "%s: RESTRICT: %s" % (ebuild.relative_path, e)) - del e - if myrestrict: - myrestrict = set(myrestrict) - mybadrestrict = myrestrict.difference(valid_restrict) - if mybadrestrict: - for mybad in mybadrestrict: - qatracker.add_error( - "RESTRICT.invalid", - xpkg + "/" + y_ebuild + ".ebuild: %s" % mybad) + ################# + restrictcheck.check(pkg, xpkg, ebuild, y_ebuild) + ################# # Syntax Checks