public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-21 23:51 Brian Dolbec
  2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/ Brian Dolbec
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:51 UTC (permalink / raw
  To: gentoo-commits

commit:     f1407272871994cd83a18398b566566a61d4f9d0
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 15:09:43 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:44 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f1407272

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 7b36852..08d79eb 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  2015-09-21 23:51 ` [gentoo-commits] proj/portage:master " Brian Dolbec
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     f5b8099f789b28533ffbe3dea814ebcae5c67ada
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 15:23:33 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 21 23:42:44 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f5b8099f

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 08d79eb..8497833 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -64,6 +64,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
@@ -71,7 +72,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
@@ -301,6 +302,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:
@@ -623,24 +625,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
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-21 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-21 23:51 [gentoo-commits] proj/portage:master commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/ Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/ Brian Dolbec
  -- 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:51 ` [gentoo-commits] proj/portage:master " Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox