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 0E31A1393F1 for ; Thu, 17 Sep 2015 03:09:17 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DFA7621C06E; Thu, 17 Sep 2015 03:08:58 +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 7792D21C06E for ; Thu, 17 Sep 2015 03:08:48 +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 8D777340D0D for ; Thu, 17 Sep 2015 03:08:47 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D935122B for ; Thu, 17 Sep 2015 03:08:43 +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: <1442459208.77466eaf42192fbbb46d13fbcf857d7314dfa713.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/ 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: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 77466eaf42192fbbb46d13fbcf857d7314dfa713 X-VCS-Branch: repoman Date: Thu, 17 Sep 2015 03:08:43 +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: 115e9e99-4152-476c-8314-2f65e72ed477 X-Archives-Hash: 74a7fd2b0d1594343961b2eb7da0d562 commit: 77466eaf42192fbbb46d13fbcf857d7314dfa713 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:09:43 2014 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Thu Sep 17 03:06:48 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=77466eaf 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 f692b63..fd7baa0 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -63,6 +63,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 @@ -299,6 +300,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: @@ -617,22 +619,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