public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2014-10-01 23:02 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     4cd224554dd4d6f31cdc1cd610473e71a9d3b76f
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:40:39 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 22:58:14 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4cd22455

repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py

---
 pym/repoman/checks/ebuilds/variables/__init__.py |  0
 pym/repoman/checks/ebuilds/variables/eapi.py     | 44 ++++++++++++++++++++++++
 pym/repoman/main.py                              | 12 +++----
 3 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py
new file mode 100644
index 0000000..e69de29

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py
new file mode 100644
index 0000000..2f8b1cb
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/eapi.py
@@ -0,0 +1,44 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+	'''Perform checks on the EAPI variable.'''
+
+	def __init__(self, qatracker, repo_settings):
+		'''
+		@param qatracker: QATracker instance
+		@param repo_settings: Repository settings
+		'''
+		self.qatracker = qatracker
+		self.repo_settings = repo_settings
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		eapi = pkg._metadata["EAPI"]
+
+		if not self._checkBanned(ebuild, eapi):
+			self._checkDeprecated(ebuild, eapi)
+
+	def _checkBanned(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_banned(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False
+
+	def _checkDeprecated(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index ecdecfa..c6f38df 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -58,6 +58,7 @@ from repoman.checks.ebuilds.manifests import Manifests
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.modules.commit import repochecks
@@ -292,6 +293,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist)
 keywordcheck = KeywordChecks(qatracker)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
+eapicheck = EAPIChecks(qatracker, repo_settings)
 ######################
 
 for xpkg in effective_scanlist:
@@ -393,13 +395,9 @@ for xpkg in effective_scanlist:
 		inherited = pkg.inherited
 		live_ebuild = live_eclasses.intersection(inherited)
 
-		if repo_settings.repo_config.eapi_is_banned(eapi):
-			qatracker.add_error(
-				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
-
-		elif repo_settings.repo_config.eapi_is_deprecated(eapi):
-			qatracker.add_error(
-				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+		#######################
+		eapicheck.check(pkg, ebuild)
+		#######################
 
 		for k, v in myaux.items():
 			if not isinstance(v, basestring):


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2014-10-01 23:02 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:02 UTC (permalink / raw
  To: gentoo-commits

commit:     42e0de9ed35a8f933e482656b38d118325f2e5d3
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 15:23:33 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 22:58:15 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=42e0de9e

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 722de79..b3e93bf 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -61,6 +61,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
@@ -68,7 +69,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
@@ -298,6 +299,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:
@@ -617,24 +619,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] 24+ messages in thread

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2014-10-01 23:46 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     2aaa7db8d8178a6a1a062fae77f6db88a5353c91
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:40:39 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 23:45:34 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2aaa7db8

repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py

---
 pym/repoman/checks/ebuilds/variables/__init__.py |  0
 pym/repoman/checks/ebuilds/variables/eapi.py     | 44 ++++++++++++++++++++++++
 pym/repoman/main.py                              | 12 +++----
 3 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py
new file mode 100644
index 0000000..e69de29

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py
new file mode 100644
index 0000000..2f8b1cb
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/eapi.py
@@ -0,0 +1,44 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+	'''Perform checks on the EAPI variable.'''
+
+	def __init__(self, qatracker, repo_settings):
+		'''
+		@param qatracker: QATracker instance
+		@param repo_settings: Repository settings
+		'''
+		self.qatracker = qatracker
+		self.repo_settings = repo_settings
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		eapi = pkg._metadata["EAPI"]
+
+		if not self._checkBanned(ebuild, eapi):
+			self._checkDeprecated(ebuild, eapi)
+
+	def _checkBanned(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_banned(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False
+
+	def _checkDeprecated(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index ecdecfa..c6f38df 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -58,6 +58,7 @@ from repoman.checks.ebuilds.manifests import Manifests
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.modules.commit import repochecks
@@ -292,6 +293,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist)
 keywordcheck = KeywordChecks(qatracker)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
+eapicheck = EAPIChecks(qatracker, repo_settings)
 ######################
 
 for xpkg in effective_scanlist:
@@ -393,13 +395,9 @@ for xpkg in effective_scanlist:
 		inherited = pkg.inherited
 		live_ebuild = live_eclasses.intersection(inherited)
 
-		if repo_settings.repo_config.eapi_is_banned(eapi):
-			qatracker.add_error(
-				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
-
-		elif repo_settings.repo_config.eapi_is_deprecated(eapi):
-			qatracker.add_error(
-				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+		#######################
+		eapicheck.check(pkg, ebuild)
+		#######################
 
 		for k, v in myaux.items():
 			if not isinstance(v, basestring):


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2014-10-01 23:46 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     8b4fa96f5946c9605633fe93b7602a463d90c678
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:50:26 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Wed Oct  1 23:45:34 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8b4fa96f

repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/

---
 .../checks/ebuilds/variables/description.py        | 32 ++++++++++++++++++++++
 pym/repoman/main.py                                | 13 ++++-----
 2 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py
new file mode 100644
index 0000000..a2b1057
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/description.py
@@ -0,0 +1,32 @@
+
+'''description.py
+Perform checks on the DESCRIPTION variable.
+'''
+
+from repoman.qa_data import max_desc_len
+
+
+class DescriptionChecks(object):
+	'''Perform checks on the DESCRIPTION variable.'''
+
+	def __init__(self, qatracker):
+		'''
+		@param qatracker: QATracker instance
+		'''
+		self.qatracker = qatracker
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		self._checkTooLong(pkg, ebuild)
+
+	def _checkTooLong(self, pkg, ebuild):
+		# 14 is the length of DESCRIPTION=""
+		if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
+			self.qatracker.add_error(
+				'DESCRIPTION.toolong',
+				"%s: DESCRIPTION is %d characters (max %d)" %
+				(ebuild.relative_path, len(
+					pkg._metadata['DESCRIPTION']), max_desc_len))

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index c6f38df..ed3cf88 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -58,6 +58,7 @@ from repoman.checks.ebuilds.manifests import Manifests
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 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.ebuild import Ebuild
 from repoman.errors import err
@@ -65,7 +66,7 @@ from repoman.modules.commit import repochecks
 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, max_desc_len, missingvars,
+	qawarnings, qacats, missingvars,
 	suspect_virtual, suspect_rdepend, valid_restrict)
 from repoman.qa_tracker import QATracker
 from repoman.repos import RepoSettings, repo_metadata
@@ -294,6 +295,7 @@ keywordcheck = KeywordChecks(qatracker)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
 eapicheck = EAPIChecks(qatracker, repo_settings)
+descriptioncheck = DescriptionChecks(qatracker)
 ######################
 
 for xpkg in effective_scanlist:
@@ -433,12 +435,9 @@ for xpkg in effective_scanlist:
 					myqakey = var + ".virtual"
 					qatracker.add_error(myqakey, ebuild.relative_path)
 
-		# 14 is the length of DESCRIPTION=""
-		if len(myaux['DESCRIPTION']) > max_desc_len:
-			qatracker.add_error(
-				'DESCRIPTION.toolong',
-				"%s: DESCRIPTION is %d characters (max %d)" %
-				(ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len))
+		#######################
+		descriptioncheck.check(pkg, ebuild)
+		#######################
 
 		keywords = myaux["KEYWORDS"].split()
 


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2014-10-01 23:46 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2014-10-01 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     3a4ed09c34f7c98b7a8af76411b7aaf449d94003
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 15:09:43 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> 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


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2014-11-17  0:55 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2014-11-17  0:55 UTC (permalink / raw
  To: gentoo-commits

commit:     b6fba118bd3e9de34ff3c4c5315fe045990e3a1e
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:50:26 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Nov 17 00:53:14 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=b6fba118

repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/

---
 .../checks/ebuilds/variables/description.py        | 32 ++++++++++++++++++++++
 pym/repoman/main.py                                | 13 ++++-----
 2 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py
new file mode 100644
index 0000000..a2b1057
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/description.py
@@ -0,0 +1,32 @@
+
+'''description.py
+Perform checks on the DESCRIPTION variable.
+'''
+
+from repoman.qa_data import max_desc_len
+
+
+class DescriptionChecks(object):
+	'''Perform checks on the DESCRIPTION variable.'''
+
+	def __init__(self, qatracker):
+		'''
+		@param qatracker: QATracker instance
+		'''
+		self.qatracker = qatracker
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		self._checkTooLong(pkg, ebuild)
+
+	def _checkTooLong(self, pkg, ebuild):
+		# 14 is the length of DESCRIPTION=""
+		if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
+			self.qatracker.add_error(
+				'DESCRIPTION.toolong',
+				"%s: DESCRIPTION is %d characters (max %d)" %
+				(ebuild.relative_path, len(
+					pkg._metadata['DESCRIPTION']), max_desc_len))

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index c6f38df..ed3cf88 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -58,6 +58,7 @@ from repoman.checks.ebuilds.manifests import Manifests
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 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.ebuild import Ebuild
 from repoman.errors import err
@@ -65,7 +66,7 @@ from repoman.modules.commit import repochecks
 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, max_desc_len, missingvars,
+	qawarnings, qacats, missingvars,
 	suspect_virtual, suspect_rdepend, valid_restrict)
 from repoman.qa_tracker import QATracker
 from repoman.repos import RepoSettings, repo_metadata
@@ -294,6 +295,7 @@ keywordcheck = KeywordChecks(qatracker)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
 eapicheck = EAPIChecks(qatracker, repo_settings)
+descriptioncheck = DescriptionChecks(qatracker)
 ######################
 
 for xpkg in effective_scanlist:
@@ -433,12 +435,9 @@ for xpkg in effective_scanlist:
 					myqakey = var + ".virtual"
 					qatracker.add_error(myqakey, ebuild.relative_path)
 
-		# 14 is the length of DESCRIPTION=""
-		if len(myaux['DESCRIPTION']) > max_desc_len:
-			qatracker.add_error(
-				'DESCRIPTION.toolong',
-				"%s: DESCRIPTION is %d characters (max %d)" %
-				(ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len))
+		#######################
+		descriptioncheck.check(pkg, ebuild)
+		#######################
 
 		keywords = myaux["KEYWORDS"].split()
 


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2014-11-17  0:55 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2014-11-17  0:55 UTC (permalink / raw
  To: gentoo-commits

commit:     65806bbaa7ce379e2f84b7a95dace1116423bbfe
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:40:39 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Nov 17 00:53:14 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=65806bba

repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py

---
 pym/repoman/checks/ebuilds/variables/__init__.py |  0
 pym/repoman/checks/ebuilds/variables/eapi.py     | 44 ++++++++++++++++++++++++
 pym/repoman/main.py                              | 12 +++----
 3 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py
new file mode 100644
index 0000000..e69de29

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py
new file mode 100644
index 0000000..2f8b1cb
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/eapi.py
@@ -0,0 +1,44 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+	'''Perform checks on the EAPI variable.'''
+
+	def __init__(self, qatracker, repo_settings):
+		'''
+		@param qatracker: QATracker instance
+		@param repo_settings: Repository settings
+		'''
+		self.qatracker = qatracker
+		self.repo_settings = repo_settings
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		eapi = pkg._metadata["EAPI"]
+
+		if not self._checkBanned(ebuild, eapi):
+			self._checkDeprecated(ebuild, eapi)
+
+	def _checkBanned(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_banned(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False
+
+	def _checkDeprecated(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index ecdecfa..c6f38df 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -58,6 +58,7 @@ from repoman.checks.ebuilds.manifests import Manifests
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.modules.commit import repochecks
@@ -292,6 +293,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist)
 keywordcheck = KeywordChecks(qatracker)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
+eapicheck = EAPIChecks(qatracker, repo_settings)
 ######################
 
 for xpkg in effective_scanlist:
@@ -393,13 +395,9 @@ for xpkg in effective_scanlist:
 		inherited = pkg.inherited
 		live_ebuild = live_eclasses.intersection(inherited)
 
-		if repo_settings.repo_config.eapi_is_banned(eapi):
-			qatracker.add_error(
-				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
-
-		elif repo_settings.repo_config.eapi_is_deprecated(eapi):
-			qatracker.add_error(
-				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+		#######################
+		eapicheck.check(pkg, ebuild)
+		#######################
 
 		for k, v in myaux.items():
 			if not isinstance(v, basestring):


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2014-11-17  0:55 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2014-11-17  0:55 UTC (permalink / raw
  To: gentoo-commits

commit:     67423fab037ef9cae64bab4675b8514bfe593804
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 15:23:33 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Nov 17 00:53:14 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=67423fab

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 722de79..b3e93bf 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -61,6 +61,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
@@ -68,7 +69,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
@@ -298,6 +299,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:
@@ -617,24 +619,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] 24+ messages in thread

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-08-10 13:44 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-08-10 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     80e85b5fa8e38560a79b53c446d36135cc2b9c91
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:40:39 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Jul 21 05:47:30 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=80e85b5f

repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py

 pym/repoman/checks/ebuilds/variables/__init__.py |  0
 pym/repoman/checks/ebuilds/variables/eapi.py     | 44 ++++++++++++++++++++++++
 pym/repoman/main.py                              | 12 +++----
 3 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py
new file mode 100644
index 0000000..e69de29

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py
new file mode 100644
index 0000000..2f8b1cb
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/eapi.py
@@ -0,0 +1,44 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+	'''Perform checks on the EAPI variable.'''
+
+	def __init__(self, qatracker, repo_settings):
+		'''
+		@param qatracker: QATracker instance
+		@param repo_settings: Repository settings
+		'''
+		self.qatracker = qatracker
+		self.repo_settings = repo_settings
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		eapi = pkg._metadata["EAPI"]
+
+		if not self._checkBanned(ebuild, eapi):
+			self._checkDeprecated(ebuild, eapi)
+
+	def _checkBanned(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_banned(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False
+
+	def _checkDeprecated(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 015bea2..deb3202 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.modules.commit import repochecks
@@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist)
 keywordcheck = KeywordChecks(qatracker, options)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
+eapicheck = EAPIChecks(qatracker, repo_settings)
 ######################
 
 for xpkg in effective_scanlist:
@@ -396,13 +398,9 @@ for xpkg in effective_scanlist:
 		inherited = pkg.inherited
 		live_ebuild = live_eclasses.intersection(inherited)
 
-		if repo_settings.repo_config.eapi_is_banned(eapi):
-			qatracker.add_error(
-				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
-
-		elif repo_settings.repo_config.eapi_is_deprecated(eapi):
-			qatracker.add_error(
-				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+		#######################
+		eapicheck.check(pkg, ebuild)
+		#######################
 
 		for k, v in myaux.items():
 			if not isinstance(v, basestring):


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-08-10 14:45 Michał Górny
  0 siblings, 0 replies; 24+ messages in thread
From: Michał Górny @ 2015-08-10 14:45 UTC (permalink / raw
  To: gentoo-commits

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


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-08-10 14:45 Michał Górny
  0 siblings, 0 replies; 24+ messages in thread
From: Michał Górny @ 2015-08-10 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     fddb006ce71e3a3aac211c533e5029b52bbbb3aa
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:40:39 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=fddb006c

repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py

 pym/repoman/checks/ebuilds/variables/__init__.py |  0
 pym/repoman/checks/ebuilds/variables/eapi.py     | 44 ++++++++++++++++++++++++
 pym/repoman/main.py                              | 12 +++----
 3 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py
new file mode 100644
index 0000000..e69de29

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py
new file mode 100644
index 0000000..2f8b1cb
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/eapi.py
@@ -0,0 +1,44 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+	'''Perform checks on the EAPI variable.'''
+
+	def __init__(self, qatracker, repo_settings):
+		'''
+		@param qatracker: QATracker instance
+		@param repo_settings: Repository settings
+		'''
+		self.qatracker = qatracker
+		self.repo_settings = repo_settings
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		eapi = pkg._metadata["EAPI"]
+
+		if not self._checkBanned(ebuild, eapi):
+			self._checkDeprecated(ebuild, eapi)
+
+	def _checkBanned(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_banned(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False
+
+	def _checkDeprecated(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 2523544..70d2255 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.modules.commit import repochecks
@@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist)
 keywordcheck = KeywordChecks(qatracker, options)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
+eapicheck = EAPIChecks(qatracker, repo_settings)
 ######################
 
 for xpkg in effective_scanlist:
@@ -396,13 +398,9 @@ for xpkg in effective_scanlist:
 		inherited = pkg.inherited
 		live_ebuild = live_eclasses.intersection(inherited)
 
-		if repo_settings.repo_config.eapi_is_banned(eapi):
-			qatracker.add_error(
-				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
-
-		elif repo_settings.repo_config.eapi_is_deprecated(eapi):
-			qatracker.add_error(
-				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+		#######################
+		eapicheck.check(pkg, ebuild)
+		#######################
 
 		for k, v in myaux.items():
 			if not isinstance(v, basestring):


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-08-11 23:54 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-08-11 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     3b95b74fd43530dc0da3e738fa445fc498f3bc45
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: Tue Aug 11 23:52:56 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3b95b74f

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


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-08-11 23:54 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-08-11 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     22e24c0fbe4f0a0e15a6686a8e9e7debc9bd91bd
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: Tue Aug 11 23:52:57 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=22e24c0f

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 5fe7515..e98520b 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] 24+ messages in thread

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-05 21:27 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:27 UTC (permalink / raw
  To: gentoo-commits

commit:     3f78284c30d9f228fcaeef59ee79d67aa2a815ff
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:50:26 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:27:00 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=3f78284c

repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/

 .../checks/ebuilds/variables/description.py        | 32 ++++++++++++++++++++++
 pym/repoman/main.py                                | 13 ++++-----
 2 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py
new file mode 100644
index 0000000..a2b1057
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/description.py
@@ -0,0 +1,32 @@
+
+'''description.py
+Perform checks on the DESCRIPTION variable.
+'''
+
+from repoman.qa_data import max_desc_len
+
+
+class DescriptionChecks(object):
+	'''Perform checks on the DESCRIPTION variable.'''
+
+	def __init__(self, qatracker):
+		'''
+		@param qatracker: QATracker instance
+		'''
+		self.qatracker = qatracker
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		self._checkTooLong(pkg, ebuild)
+
+	def _checkTooLong(self, pkg, ebuild):
+		# 14 is the length of DESCRIPTION=""
+		if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
+			self.qatracker.add_error(
+				'DESCRIPTION.toolong',
+				"%s: DESCRIPTION is %d characters (max %d)" %
+				(ebuild.relative_path, len(
+					pkg._metadata['DESCRIPTION']), max_desc_len))

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 70d2255..125b390 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 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.ebuild import Ebuild
 from repoman.errors import err
@@ -68,7 +69,7 @@ from repoman.modules.commit import repochecks
 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, max_desc_len, missingvars,
+	qawarnings, qacats, missingvars,
 	suspect_virtual, suspect_rdepend, valid_restrict)
 from repoman.qa_tracker import QATracker
 from repoman.repos import RepoSettings, repo_metadata
@@ -297,6 +298,7 @@ keywordcheck = KeywordChecks(qatracker, options)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
 eapicheck = EAPIChecks(qatracker, repo_settings)
+descriptioncheck = DescriptionChecks(qatracker)
 ######################
 
 for xpkg in effective_scanlist:
@@ -436,12 +438,9 @@ for xpkg in effective_scanlist:
 					myqakey = var + ".virtual"
 					qatracker.add_error(myqakey, ebuild.relative_path)
 
-		# 14 is the length of DESCRIPTION=""
-		if len(myaux['DESCRIPTION']) > max_desc_len:
-			qatracker.add_error(
-				'DESCRIPTION.toolong',
-				"%s: DESCRIPTION is %d characters (max %d)" %
-				(ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len))
+		#######################
+		descriptioncheck.check(pkg, ebuild)
+		#######################
 
 		keywords = myaux["KEYWORDS"].split()
 


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-05 21:48 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     26988a0cc70f23e85c0be0cbc388ad35da8572db
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: Sat Sep  5 21:47:38 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=26988a0c

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


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-05 21:48 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     7104d9aace97693d935f0e97f86ba4c048d3cc54
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:50:26 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 21:47:38 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7104d9aa

repoman/main.py: Split DESCRIPTION checks to checks/ebuild/variables/

 .../checks/ebuilds/variables/description.py        | 32 ++++++++++++++++++++++
 pym/repoman/main.py                                | 13 ++++-----
 2 files changed, 38 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/description.py b/pym/repoman/checks/ebuilds/variables/description.py
new file mode 100644
index 0000000..a2b1057
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/description.py
@@ -0,0 +1,32 @@
+
+'''description.py
+Perform checks on the DESCRIPTION variable.
+'''
+
+from repoman.qa_data import max_desc_len
+
+
+class DescriptionChecks(object):
+	'''Perform checks on the DESCRIPTION variable.'''
+
+	def __init__(self, qatracker):
+		'''
+		@param qatracker: QATracker instance
+		'''
+		self.qatracker = qatracker
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		self._checkTooLong(pkg, ebuild)
+
+	def _checkTooLong(self, pkg, ebuild):
+		# 14 is the length of DESCRIPTION=""
+		if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
+			self.qatracker.add_error(
+				'DESCRIPTION.toolong',
+				"%s: DESCRIPTION is %d characters (max %d)" %
+				(ebuild.relative_path, len(
+					pkg._metadata['DESCRIPTION']), max_desc_len))

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 6bfd1be..f692b63 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 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.ebuild import Ebuild
 from repoman.errors import err
@@ -68,7 +69,7 @@ from repoman.modules.commit import repochecks
 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, max_desc_len, missingvars,
+	qawarnings, qacats, missingvars,
 	suspect_virtual, suspect_rdepend, valid_restrict)
 from repoman.qa_tracker import QATracker
 from repoman.repos import RepoSettings, repo_metadata
@@ -297,6 +298,7 @@ keywordcheck = KeywordChecks(qatracker, options)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
 eapicheck = EAPIChecks(qatracker, repo_settings)
+descriptioncheck = DescriptionChecks(qatracker)
 ######################
 
 for xpkg in effective_scanlist:
@@ -436,12 +438,9 @@ for xpkg in effective_scanlist:
 					myqakey = var + ".virtual"
 					qatracker.add_error(myqakey, ebuild.relative_path)
 
-		# 14 is the length of DESCRIPTION=""
-		if len(myaux['DESCRIPTION']) > max_desc_len:
-			qatracker.add_error(
-				'DESCRIPTION.toolong',
-				"%s: DESCRIPTION is %d characters (max %d)" %
-				(ebuild.relative_path, len(myaux['DESCRIPTION']), max_desc_len))
+		#######################
+		descriptioncheck.check(pkg, ebuild)
+		#######################
 
 		keywords = myaux["KEYWORDS"].split()
 


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-05 21:48 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-09-05 21:48 UTC (permalink / raw
  To: gentoo-commits

commit:     c5a78a6bfae80827bb1ea5e2593dd6ea6bf2e5d0
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: Sat Sep  5 21:47:38 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c5a78a6b

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 fd7baa0..582370e 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] 24+ messages in thread

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     77466eaf42192fbbb46d13fbcf857d7314dfa713
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: 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


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     733c498fab0b1139d5491a7097d7d730957811f5
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: Thu Sep 17 03:06:49 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=733c498f

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 fd7baa0..582370e 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] 24+ messages in thread

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-17  3:08 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-09-17  3:08 UTC (permalink / raw
  To: gentoo-commits

commit:     7d5ee266ffb358608da15f47d822c1df94927e52
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:40:39 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 03:06:48 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7d5ee266

repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py

 pym/repoman/checks/ebuilds/variables/__init__.py |  0
 pym/repoman/checks/ebuilds/variables/eapi.py     | 44 ++++++++++++++++++++++++
 pym/repoman/main.py                              | 12 +++----
 3 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py
new file mode 100644
index 0000000..e69de29

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py
new file mode 100644
index 0000000..2f8b1cb
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/eapi.py
@@ -0,0 +1,44 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+	'''Perform checks on the EAPI variable.'''
+
+	def __init__(self, qatracker, repo_settings):
+		'''
+		@param qatracker: QATracker instance
+		@param repo_settings: Repository settings
+		'''
+		self.qatracker = qatracker
+		self.repo_settings = repo_settings
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		eapi = pkg._metadata["EAPI"]
+
+		if not self._checkBanned(ebuild, eapi):
+			self._checkDeprecated(ebuild, eapi)
+
+	def _checkBanned(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_banned(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False
+
+	def _checkDeprecated(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index bacc25f..6bfd1be 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.modules.commit import repochecks
@@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist)
 keywordcheck = KeywordChecks(qatracker, options)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
+eapicheck = EAPIChecks(qatracker, repo_settings)
 ######################
 
 for xpkg in effective_scanlist:
@@ -396,13 +398,9 @@ for xpkg in effective_scanlist:
 		inherited = pkg.inherited
 		live_ebuild = live_eclasses.intersection(inherited)
 
-		if repo_settings.repo_config.eapi_is_banned(eapi):
-			qatracker.add_error(
-				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
-
-		elif repo_settings.repo_config.eapi_is_deprecated(eapi):
-			qatracker.add_error(
-				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+		#######################
+		eapicheck.check(pkg, ebuild)
+		#######################
 
 		for k, v in myaux.items():
 			if not isinstance(v, basestring):


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     0191afc5b71e9a06bb3e65be018eae3d8c9aad77
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:40:39 2014 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:27 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0191afc5

repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py

 pym/repoman/checks/ebuilds/variables/__init__.py |  0
 pym/repoman/checks/ebuilds/variables/eapi.py     | 44 ++++++++++++++++++++++++
 pym/repoman/main.py                              | 12 +++----
 3 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py
new file mode 100644
index 0000000..e69de29

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py
new file mode 100644
index 0000000..2f8b1cb
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/eapi.py
@@ -0,0 +1,44 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+	'''Perform checks on the EAPI variable.'''
+
+	def __init__(self, qatracker, repo_settings):
+		'''
+		@param qatracker: QATracker instance
+		@param repo_settings: Repository settings
+		'''
+		self.qatracker = qatracker
+		self.repo_settings = repo_settings
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		eapi = pkg._metadata["EAPI"]
+
+		if not self._checkBanned(ebuild, eapi):
+			self._checkDeprecated(ebuild, eapi)
+
+	def _checkBanned(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_banned(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False
+
+	def _checkDeprecated(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 1e23387..42600cd 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.modules.commit import repochecks
@@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist)
 keywordcheck = KeywordChecks(qatracker, options)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
+eapicheck = EAPIChecks(qatracker, repo_settings)
 ######################
 
 for xpkg in effective_scanlist:
@@ -396,13 +398,9 @@ for xpkg in effective_scanlist:
 		inherited = pkg.inherited
 		live_ebuild = live_eclasses.intersection(inherited)
 
-		if repo_settings.repo_config.eapi_is_banned(eapi):
-			qatracker.add_error(
-				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
-
-		elif repo_settings.repo_config.eapi_is_deprecated(eapi):
-			qatracker.add_error(
-				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+		#######################
+		eapicheck.check(pkg, ebuild)
+		#######################
 
 		for k, v in myaux.items():
 			if not isinstance(v, basestring):


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-17  4:51 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-09-17  4:51 UTC (permalink / raw
  To: gentoo-commits

commit:     eb76107ad3505427d510cb76fa751bafac4c629c
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: Thu Sep 17 04:41:27 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=eb76107a

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] 24+ messages in thread

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 24+ messages in thread
From: Brian Dolbec @ 2015-09-21 23:47 UTC (permalink / raw
  To: gentoo-commits

commit:     4436beeb6f74ffe091cfdfab4975960edf687fbb
Author:     Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Fri Jun  6 14:40:39 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=4436beeb

repoman/main.py: Split EAPI checks to checks/ebuilds/variables/eapi.py

 pym/repoman/checks/ebuilds/variables/__init__.py |  0
 pym/repoman/checks/ebuilds/variables/eapi.py     | 44 ++++++++++++++++++++++++
 pym/repoman/main.py                              | 12 +++----
 3 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/__init__.py b/pym/repoman/checks/ebuilds/variables/__init__.py
new file mode 100644
index 0000000..e69de29

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py
new file mode 100644
index 0000000..2f8b1cb
--- /dev/null
+++ b/pym/repoman/checks/ebuilds/variables/eapi.py
@@ -0,0 +1,44 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+	'''Perform checks on the EAPI variable.'''
+
+	def __init__(self, qatracker, repo_settings):
+		'''
+		@param qatracker: QATracker instance
+		@param repo_settings: Repository settings
+		'''
+		self.qatracker = qatracker
+		self.repo_settings = repo_settings
+
+	def check(self, pkg, ebuild):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		eapi = pkg._metadata["EAPI"]
+
+		if not self._checkBanned(ebuild, eapi):
+			self._checkDeprecated(ebuild, eapi)
+
+	def _checkBanned(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_banned(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False
+
+	def _checkDeprecated(self, ebuild, eapi):
+		if self.repo_settings.repo_config.eapi_is_deprecated(eapi):
+			self.qatracker.add_error(
+				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+
+			return True
+
+		return False

diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 1e23387..42600cd 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -61,6 +61,7 @@ from repoman.check_missingslot import check_missingslot
 from repoman.checks.ebuilds.misc import bad_split_check, pkg_invalid
 from repoman.checks.ebuilds.pkgmetadata import PkgMetadata
 from repoman.checks.ebuilds.use_flags import USEFlagChecks
+from repoman.checks.ebuilds.variables.eapi import EAPIChecks
 from repoman.ebuild import Ebuild
 from repoman.errors import err
 from repoman.modules.commit import repochecks
@@ -295,6 +296,7 @@ use_flag_checks = USEFlagChecks(qatracker, uselist)
 keywordcheck = KeywordChecks(qatracker, options)
 liveeclasscheck = LiveEclassChecks(qatracker)
 rubyeclasscheck = RubyEclassChecks(qatracker)
+eapicheck = EAPIChecks(qatracker, repo_settings)
 ######################
 
 for xpkg in effective_scanlist:
@@ -396,13 +398,9 @@ for xpkg in effective_scanlist:
 		inherited = pkg.inherited
 		live_ebuild = live_eclasses.intersection(inherited)
 
-		if repo_settings.repo_config.eapi_is_banned(eapi):
-			qatracker.add_error(
-				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, eapi))
-
-		elif repo_settings.repo_config.eapi_is_deprecated(eapi):
-			qatracker.add_error(
-				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, eapi))
+		#######################
+		eapicheck.check(pkg, ebuild)
+		#######################
 
 		for k, v in myaux.items():
 			if not isinstance(v, basestring):


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
@ 2015-09-21 23:47 Brian Dolbec
  0 siblings, 0 replies; 24+ 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] 24+ messages in thread

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

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-05 21:48 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2015-09-21 23:47 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: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 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

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