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/, pym/repoman/modules/scan/eclasses/, ...
Date: Sun, 31 Jan 2016 20:03:31 +0000 (UTC)	[thread overview]
Message-ID: <1454185521.d2dd97b04e5b44eb1265576929d8957cc2b3eeb2.dolsen@gentoo> (raw)

commit:     d2dd97b04e5b44eb1265576929d8957cc2b3eeb2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  8 08:46:01 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 20:25:21 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d2dd97b0

repoman: Create RubyEclassChecks class plugin

 pym/repoman/checks/ebuilds/eclasses/__init__.py        |  0
 pym/repoman/modules/scan/eclasses/__init__.py          |  9 +++++++++
 .../{checks/ebuilds => modules/scan}/eclasses/ruby.py  | 18 ++++++++++++++----
 pym/repoman/scanner.py                                 |  8 ++------
 4 files changed, 25 insertions(+), 10 deletions(-)

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

diff --git a/pym/repoman/modules/scan/eclasses/__init__.py b/pym/repoman/modules/scan/eclasses/__init__.py
index ed9a7c7..126f2a6 100644
--- a/pym/repoman/modules/scan/eclasses/__init__.py
+++ b/pym/repoman/modules/scan/eclasses/__init__.py
@@ -19,6 +19,15 @@ module_spec = {
 			'func_kwargs': {
 			},
 		},
+		'ruby-module': {
+			'name': "ruby",
+			'sourcefile': "ruby",
+			'class': "RubyEclassChecks",
+			'description': doc,
+			'functions': ['check'],
+			'func_kwargs': {
+			},
+		},
 	}
 }
 

diff --git a/pym/repoman/checks/ebuilds/eclasses/ruby.py b/pym/repoman/modules/scan/eclasses/ruby.py
similarity index 62%
rename from pym/repoman/checks/ebuilds/eclasses/ruby.py
rename to pym/repoman/modules/scan/eclasses/ruby.py
index e8d36ea..4dc5d62 100644
--- a/pym/repoman/checks/ebuilds/eclasses/ruby.py
+++ b/pym/repoman/modules/scan/eclasses/ruby.py
@@ -4,19 +4,23 @@ Performs Ruby eclass checks
 '''
 
 from repoman.qa_data import ruby_deprecated
+from repoman.modules.scan.scanbase import ScanBase
 
 
-class RubyEclassChecks(object):
+class RubyEclassChecks(ScanBase):
 	'''Performs checks for the usage of Ruby eclasses in ebuilds'''
 
-	def __init__(self, qatracker):
+	def __init__(self, **kwargs):
 		'''
 		@param qatracker: QATracker instance
 		'''
-		self.qatracker = qatracker
+		super(RubyEclassChecks, self).__init__(**kwargs)
+		self.qatracker = kwargs.get('qatracker')
 		self.old_ruby_eclasses = ["ruby-ng", "ruby-fakegem", "ruby"]
 
-	def check(self, pkg, ebuild):
+	def check(self, **kwargs):
+		pkg = kwargs.get('pkg')
+		ebuild = kwargs.get('ebuild')
 		is_inherited = lambda eclass: eclass in pkg.inherited
 		is_old_ruby_eclass_inherited = filter(
 			is_inherited, self.old_ruby_eclasses)
@@ -30,3 +34,9 @@ class RubyEclassChecks(object):
 						"IUSE.rubydeprecated",
 						(ebuild.relative_path + ": Deprecated ruby target: %s")
 						% myruby)
+		return {'continue': False}
+
+	@property
+	def runInEbuilds(self):
+		'''Ebuild level scans'''
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 0248a66..c5601dd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -18,7 +18,6 @@ from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
 from repoman.checks.ebuilds.checks import run_checks
-from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -214,7 +213,6 @@ class Scanner(object):
 			self.modules[mod_class.__name__] = mod_class(**self.kwargs)
 
 		# initialize our checks classes here before the big xpkg loop
-		self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
 		self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
 		self.restrictcheck = RestrictChecks(self.qatracker)
 
@@ -301,7 +299,7 @@ class Scanner(object):
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
 				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
-				('use_flags', 'USEFlagChecks'),
+				('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -364,9 +362,7 @@ class Scanner(object):
 			badlicsyntax = badlicsyntax > 0
 			badprovsyntax = badprovsyntax > 0
 
-			used_useflags = used_useflags.union(dynamic_data['ebuild_used_useflags'])
-
-			self.rubyeclasscheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
+			used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
 
 			# license checks
 			if not badlicsyntax:


             reply	other threads:[~2016-01-31 20:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-31 20:03 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-01-30  6:58 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/eclasses/, Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-11  8:01 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=1454185521.d2dd97b04e5b44eb1265576929d8957cc2b3eeb2.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