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 0BE6E13838B 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 4C4C6E08F2; 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 BB74CE08D5 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 95D7A340388 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 9CFD86B90 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.3a4ed09c34f7c98b7a8af76411b7aaf449d94003.dol-sen@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: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 3a4ed09c34f7c98b7a8af76411b7aaf449d94003 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: 9814800f-b14a-44ac-972e-9975c1455a0c X-Archives-Hash: 7006d60a1225f62bdcd25d47295d5821 commit: 3a4ed09c34f7c98b7a8af76411b7aaf449d94003 Author: Tom Wijsman gentoo org> AuthorDate: Fri Jun 6 15:09:43 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=3a4ed09c 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 ed3cf88..722de79 100755 --- a/pym/repoman/main.py +++ b/pym/repoman/main.py @@ -60,6 +60,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 @@ -296,6 +297,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: @@ -611,22 +613,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