public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/
Date: Wed,  1 Oct 2014 23:02:34 +0000 (UTC)	[thread overview]
Message-ID: <1412204294.4cd224554dd4d6f31cdc1cd610473e71a9d3b76f.dol-sen@gentoo> (raw)

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):


             reply	other threads:[~2014-10-01 23:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-01 23:02 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-10-01 23:02 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/variables/, pym/repoman/ Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2014-11-17  0:55 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  3:08 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-17  4:51 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 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=1412204294.4cd224554dd4d6f31cdc1cd610473e71a9d3b76f.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --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