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 9DBFA1387FD for ; Fri, 6 Jun 2014 15:10:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 608C9E0B3F; Fri, 6 Jun 2014 15:10:56 +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 D5972E0B3F for ; Fri, 6 Jun 2014 15:10:55 +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 B0B4233FDA1 for ; Fri, 6 Jun 2014 15:10:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 96D92181A9 for ; Fri, 6 Jun 2014 15:10:51 +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: <1402067383.60fbda473665c8b4d5adf00323923538adc6357e.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/license.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: 60fbda473665c8b4d5adf00323923538adc6357e X-VCS-Branch: repoman Date: Fri, 6 Jun 2014 15:10:51 +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: ebb5c82e-2819-4322-92fa-534c523c9d3a X-Archives-Hash: 5ebc24abf30d3f50eba65edc9b255ee1 commit: 60fbda473665c8b4d5adf00323923538adc6357e Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:09:43 2014 +0000 Commit: Tom Wijsman gentoo org> CommitDate: Fri Jun 6 15:09:43 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=60fbda47 repoman/main.py: Split LICENSE checks to checks/ebuild/variables/ --- pym/repoman/checks/ebuilds/variables/license.py | 47 +++++++++++++++++++++++++ pym/repoman/main.py | 21 +++-------- 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/pym/repoman/checks/ebuilds/variables/license.py b/pym/repoman/checks/ebuilds/variables/license.py new file mode 100644 index 0000000..bdc859c --- /dev/null +++ b/pym/repoman/checks/ebuilds/variables/license.py @@ -0,0 +1,47 @@ + +'''description.py +Perform checks on the LICENSE variable. +''' + +# import our initialized portage instance +from repoman._portage import portage + + +class LicenseChecks(object): + '''Perform checks on the LICENSE variable.''' + + def __init__(self, qatracker, liclist, liclist_deprecated): + ''' + @param qatracker: QATracker instance + @param liclist: List of licenses. + @param liclist: List of deprecated licenses. + ''' + self.qatracker = qatracker + self.liclist = liclist + self.liclist_deprecated = liclist_deprecated + + def check( + self, pkg, package, ebuild, y_ebuild): + ''' + @param pkg: Package in which we check (object). + @param package: Package in which we check (string). + @param ebuild: Ebuild which we check (object). + @param y_ebuild: Ebuild which we check (string). + ''' + + # Parse the LICENSE variable, remove USE conditions and flatten it. + licenses = portage.dep.use_reduce( + pkg._metadata["LICENSE"], matchall=1, flat=True) + + # Check each entry to ensure that it exists in ${PORTDIR}/licenses/. + for lic in licenses: + # Need to check for "||" manually as no portage + # function will remove it without removing values. + if lic not in self.liclist and lic != "||": + self.qatracker.add_error( + "LICENSE.invalid", + package + "/" + y_ebuild + ".ebuild: %s" % lic) + elif lic in self.liclist_deprecated: + self.qatracker.add_error( + "LICENSE.deprecated", + "%s: %s" % (ebuild.relative_path, lic)) diff --git a/pym/repoman/main.py b/pym/repoman/main.py index 83dfd07..6667d6b 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -53,6 +53,7 @@ from repoman.checks.ebuilds.pkgmetadata import PkgMetadata 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.ebuild import Ebuild from repoman.errors import err from repoman.modules.commit import repochecks @@ -289,6 +290,7 @@ liveeclasscheck = LiveEclassChecks(qatracker) rubyeclasscheck = RubyEclassChecks(qatracker) eapicheck = EAPIChecks(qatracker, repo_settings) descriptioncheck = DescriptionChecks(qatracker) +licensecheck = LicenseChecks(qatracker, liclist, liclist_deprecated) ###################### for xpkg in effective_scanlist: @@ -597,22 +599,9 @@ for xpkg in effective_scanlist: # license checks if not badlicsyntax: - # Parse the LICENSE variable, remove USE conditions and - # flatten it. - licenses = portage.dep.use_reduce(myaux["LICENSE"], matchall=1, flat=True) - # Check each entry to ensure that it exists in PORTDIR's - # license directory. - for lic in licenses: - # Need to check for "||" manually as no portage - # function will remove it without removing values. - if lic not in liclist and lic != "||": - qatracker.add_error( - "LICENSE.invalid", - xpkg + "/" + y_ebuild + ".ebuild: %s" % lic) - elif lic in liclist_deprecated: - qatracker.add_error( - "LICENSE.deprecated", - "%s: %s" % (ebuild.relative_path, lic)) + ################# + licensecheck.check(pkg, xpkg, ebuild, y_ebuild) + ################# # restrict checks myrestrict = None