From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
Date: Mon, 10 Aug 2015 14:45:32 +0000 (UTC) [thread overview]
Message-ID: <1439217920.a9e2b85c2172e8c18158d44f15dbb01e3bcd5e87.mgorny@gentoo> (raw)
commit: a9e2b85c2172e8c18158d44f15dbb01e3bcd5e87
Author: Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 6 15:09:43 2014 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Aug 10 14:45:20 2015 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a9e2b85c
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 125b390..5fe7515 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
next reply other threads:[~2015-08-10 14:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-10 14:45 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-09-21 23:47 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/ Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-10 14:45 Michał Górny
2015-08-10 13:44 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1439217920.a9e2b85c2172e8c18158d44f15dbb01e3bcd5e87.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox