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 724FD1387FD for ; Fri, 6 Jun 2014 15:24:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 50F9CE0B24; Fri, 6 Jun 2014 15:24:38 +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 D0D2BE0B24 for ; Fri, 6 Jun 2014 15:24:37 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 94F8E33F926 for ; Fri, 6 Jun 2014 15:24:36 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 9A39F181A9 for ; Fri, 6 Jun 2014 15:24:34 +0000 (UTC) From: "Tom Wijsman" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Tom Wijsman" Message-ID: <1402068213.6d4cf83b8927d887f2d751251e504fee4d452b38.tomwij@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: tomwij X-VCS-Committer-Name: Tom Wijsman X-VCS-Revision: 6d4cf83b8927d887f2d751251e504fee4d452b38 X-VCS-Branch: repoman Date: Fri, 6 Jun 2014 15:24:34 +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: 6de287b5-8726-4902-b7d7-8bf954f1c9fc X-Archives-Hash: 8925eff1e24eab39d67cf5d09db310d4 commit: 6d4cf83b8927d887f2d751251e504fee4d452b38 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:23:33 2014 +0000 Commit: Tom Wijsman gentoo org> CommitDate: Fri Jun 6 15:23:33 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6d4cf83b 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 6667d6b..f56426b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -54,6 +54,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 @@ -61,7 +62,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 @@ -291,6 +292,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: @@ -603,24 +605,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