public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/, ...
Date: Sun, 10 Jan 2016 20:17:10 +0000 (UTC)	[thread overview]
Message-ID: <1452456908.98db70d4576c0df34e51964ebb164df0a7268fee.dolsen@gentoo> (raw)

commit:     98db70d4576c0df34e51964ebb164df0a7268fee
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 10:03:26 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 20:15:08 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=98db70d4

repoman: Migrate eapi.py to the plugin module

 pym/repoman/checks/ebuilds/variables/eapi.py | 44 -------------------------
 pym/repoman/modules/scan/eapi/__init__.py    | 23 +++++++++++++
 pym/repoman/modules/scan/eapi/eapi.py        | 49 ++++++++++++++++++++++++++++
 pym/repoman/scanner.py                       |  6 ++--
 4 files changed, 74 insertions(+), 48 deletions(-)

diff --git a/pym/repoman/checks/ebuilds/variables/eapi.py b/pym/repoman/checks/ebuilds/variables/eapi.py
deleted file mode 100644
index 2f8b1cb..0000000
--- a/pym/repoman/checks/ebuilds/variables/eapi.py
+++ /dev/null
@@ -1,44 +0,0 @@
-
-'''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/modules/scan/eapi/__init__.py b/pym/repoman/modules/scan/eapi/__init__.py
new file mode 100644
index 0000000..de586a8
--- /dev/null
+++ b/pym/repoman/modules/scan/eapi/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Eapi plug-in module for repoman.
+Performs an IsEbuild check on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'eapi',
+	'description': doc,
+	'provides':{
+		'live-module': {
+			'name': "eapi",
+			'class': "EAPIChecks",
+			'description': doc,
+			'functions': ['check'],
+			'func_kwargs': {
+			},
+		},
+	}
+}
+

diff --git a/pym/repoman/modules/scan/eapi/eapi.py b/pym/repoman/modules/scan/eapi/eapi.py
new file mode 100644
index 0000000..1190b1a
--- /dev/null
+++ b/pym/repoman/modules/scan/eapi/eapi.py
@@ -0,0 +1,49 @@
+
+'''eapi.py
+Perform checks on the EAPI variable.
+'''
+
+
+class EAPIChecks(object):
+	'''Perform checks on the EAPI variable.'''
+
+	def __init__(self, **kwargs):
+		'''
+		@param qatracker: QATracker instance
+		@param repo_settings: Repository settings
+		'''
+		self.qatracker = kwargs.get('qatracker')
+		self.repo_settings = kwargs.get('repo_settings')
+
+	def check(self, **kwargs):
+		'''
+		@param pkg: Package in which we check (object).
+		@param ebuild: Ebuild which we check (object).
+		'''
+		ebuild = kwargs.get('ebuild')
+
+		if not self._checkBanned(ebuild):
+			self._checkDeprecated(ebuild)
+		return {'continue': False}
+
+	def _checkBanned(self, ebuild):
+		if self.repo_settings.repo_config.eapi_is_banned(ebuild.eapi):
+			self.qatracker.add_error(
+				"repo.eapi.banned", "%s: %s" % (ebuild.relative_path, ebuild.eapi))
+			return True
+		return False
+
+	def _checkDeprecated(self, ebuild):
+		if self.repo_settings.repo_config.eapi_is_deprecated(ebuild.eapi):
+			self.qatracker.add_error(
+				"repo.eapi.deprecated", "%s: %s" % (ebuild.relative_path, ebuild.eapi))
+			return True
+		return False
+
+	@property
+	def runInPkgs(self):
+		return (False, [])
+
+	@property
+	def runInEbuilds(self):
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e5c185b..a8aa2f3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -25,7 +25,6 @@ from repoman.checks.ebuilds.thirdpartymirrors import ThirdPartyMirrors
 from repoman.check_missingslot import check_missingslot
 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.modules.commit import repochecks
@@ -229,7 +228,6 @@ class Scanner(object):
 		self.thirdparty = ThirdPartyMirrors(self.repo_settings.repoman_settings, self.qatracker)
 		self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
 		self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
-		self.eapicheck = EAPIChecks(self.qatracker, self.repo_settings)
 		self.descriptioncheck = DescriptionChecks(self.qatracker)
 		self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
 		self.restrictcheck = RestrictChecks(self.qatracker)
@@ -312,7 +310,8 @@ class Scanner(object):
 
 			# initialize per ebuild plugin checks here
 			# need to set it up for ==> self.modules_list or some other ordered list
-			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks')]:
+			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
+				('eapi', 'EAPIChecks')]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
 					logging.debug("Initializing class name: %s", mod_class.__name__)
@@ -339,7 +338,6 @@ class Scanner(object):
 			if y_ebuild_continue:
 				continue
 
-			self.eapicheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
 
 			for k, v in dynamic_data['ebuild'].metadata.items():
 				if not isinstance(v, basestring):


             reply	other threads:[~2016-01-10 20:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-10 20:17 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-01-10 20:17 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/, Brian Dolbec
2016-01-11  6:31 Brian Dolbec
2016-01-11  8:01 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-29  5:01 Brian Dolbec
2016-01-29  5:01 Brian Dolbec
2016-01-30  6:58 Brian Dolbec
2016-01-31 20:03 Brian Dolbec
2016-03-11  0:41 Brian Dolbec
2016-03-11  0:41 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452456908.98db70d4576c0df34e51964ebb164df0a7268fee.dolsen@gentoo \
    --to=dolsen@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox