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

commit:     f662a734a28a9c6a13233693fd08498d371054e0
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: Mon Sep 21 23:42:44 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f662a734

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 42600cd..7b36852 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] 3+ messages in thread

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-21 23:47 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/ Brian Dolbec
2015-09-21 23:51 ` [gentoo-commits] proj/portage:master commit in: pym/repoman/, pym/repoman/checks/ebuilds/variables/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2015-09-21 23:47 [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 ` [gentoo-commits] proj/portage:master " Brian Dolbec

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