public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/modules/scan/use/, pym/repoman/
@ 2016-01-30  6:58 Brian Dolbec
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Dolbec @ 2016-01-30  6:58 UTC (permalink / raw
  To: gentoo-commits

commit:     fbad4f7dfb991ffd486d26ca4e84cd61aaf62981
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  8 01:37:39 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 06:33:55 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fbad4f7d

repoman: Create USEFlagChecks class plugin

 pym/repoman/modules/scan/use/__init__.py           | 24 +++++++++++++++
 .../ebuilds => modules/scan/use}/use_flags.py      | 36 ++++++++++++++--------
 pym/repoman/scanner.py                             |  8 ++---
 3 files changed, 50 insertions(+), 18 deletions(-)

diff --git a/pym/repoman/modules/scan/use/__init__.py b/pym/repoman/modules/scan/use/__init__.py
new file mode 100644
index 0000000..80fa213
--- /dev/null
+++ b/pym/repoman/modules/scan/use/__init__.py
@@ -0,0 +1,24 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Use plug-in module for repoman.
+Performs use flag checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'use',
+	'description': doc,
+	'provides':{
+		'use-module': {
+			'name': "use_flags",
+			'sourcefile': "use_flags",
+			'class': "USEFlagChecks",
+			'description': doc,
+			'functions': ['check', 'getUsedUseFlags'],
+			'func_desc': {
+			},
+		},
+	}
+}
+

diff --git a/pym/repoman/checks/ebuilds/use_flags.py b/pym/repoman/modules/scan/use/use_flags.py
similarity index 74%
rename from pym/repoman/checks/ebuilds/use_flags.py
rename to pym/repoman/modules/scan/use/use_flags.py
index ac21b47..acc7dd3 100644
--- a/pym/repoman/checks/ebuilds/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -9,31 +9,39 @@ from repoman._portage import portage
 
 from portage import eapi
 from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from repoman.modules.scan.scanbase import ScanBase
 
 
-class USEFlagChecks(object):
+class USEFlagChecks(ScanBase):
 	'''Performs checks on USE flags listed in the ebuilds and metadata.xml'''
 
-	def __init__(self, qatracker, globalUseFlags):
-		'''
+	def __init__(self, **kwargs):
+		'''Class init
+
 		@param qatracker: QATracker instance
 		@param globalUseFlags: Global USE flags
 		'''
-		self.qatracker = qatracker
-		self.globalUseFlags = globalUseFlags
+		super(USEFlagChecks, self).__init__(**kwargs)
+		self.qatracker = kwargs.get('qatracker')
+		self.globalUseFlags = kwargs.get('uselist')
 		self.useFlags = []
 		self.defaultUseFlags = []
 		self.usedUseFlags = set()
 
-	def check(self, pkg, package, ebuild, y_ebuild, localUseFlags):
+	def check(self, **kwargs):
 		'''Perform the check.
 
 		@param pkg: Package in which we check (object).
-		@param package: Package in which we check (string).
+		@param xpkg: Package in which we check (string).
 		@param ebuild: Ebuild which we check (object).
 		@param y_ebuild: Ebuild which we check (string).
-		@param localUseFlags: Local USE flags of the package
+		@param muselist: Local USE flags of the package
 		'''
+		pkg = kwargs.get('pkg')
+		package = kwargs.get('xpkg')
+		ebuild = kwargs.get('ebuild')
+		y_ebuild = kwargs.get('y_ebuild')
+		localUseFlags = kwargs.get('muselist')
 		# reset state variables for the run
 		self.useFlags = []
 		self.defaultUseFlags = []
@@ -41,10 +49,9 @@ class USEFlagChecks(object):
 		self._checkGlobal(pkg)
 		self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
 		self._checkRequiredUSE(pkg, ebuild)
-
-	def getUsedUseFlags(self):
-		'''Get the USE flags that this check has seen'''
-		return self.usedUseFlags
+		used_useflags = kwargs.get('used_useflags').union(self.usedUseFlags)
+		return {'continue': False, 'ebuild_UsedUseFlags': self.usedUseFlags,
+			'used_useflags': used_useflags}
 
 	def _checkGlobal(self, pkg):
 		for myflag in pkg._metadata["IUSE"].split():
@@ -88,3 +95,8 @@ class USEFlagChecks(object):
 					"REQUIRED_USE.syntax",
 					"%s: REQUIRED_USE: %s" % (ebuild.relative_path, e))
 				del e
+
+	@property
+	def runInEbuilds(self):
+		'''Ebuild level scans'''
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 40aafcc..23642c3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,7 +19,6 @@ 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.use_flags import USEFlagChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -215,7 +214,6 @@ class Scanner(object):
 			self.modules[mod_class.__name__] = mod_class(**self.kwargs)
 
 		# initialize our checks classes here before the big xpkg loop
-		self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
 		self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
 		self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
 		self.restrictcheck = RestrictChecks(self.qatracker)
@@ -303,6 +301,7 @@ class Scanner(object):
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
 				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
+				('use_flags', 'USEFlagChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -365,10 +364,7 @@ class Scanner(object):
 			badlicsyntax = badlicsyntax > 0
 			badprovsyntax = badprovsyntax > 0
 
-			self.use_flag_checks.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['muselist'])
-
-			ebuild_used_useflags = self.use_flag_checks.getUsedUseFlags()
-			used_useflags = used_useflags.union(ebuild_used_useflags)
+			used_useflags = used_useflags.union(dynamic_data['ebuild_used_useflags'])
 
 			self.rubyeclasscheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/modules/scan/use/, pym/repoman/
@ 2016-01-30  8:00 Brian Dolbec
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Dolbec @ 2016-01-30  8:00 UTC (permalink / raw
  To: gentoo-commits

commit:     93c291f79572c27c51d90ead0b203c3560e25649
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  8 01:37:39 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 07:50:17 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=93c291f7

repoman: Create USEFlagChecks class plugin

 pym/repoman/modules/scan/use/__init__.py           | 24 +++++++++++++++
 .../ebuilds => modules/scan/use}/use_flags.py      | 36 ++++++++++++++--------
 pym/repoman/scanner.py                             |  8 ++---
 3 files changed, 50 insertions(+), 18 deletions(-)

diff --git a/pym/repoman/modules/scan/use/__init__.py b/pym/repoman/modules/scan/use/__init__.py
new file mode 100644
index 0000000..80fa213
--- /dev/null
+++ b/pym/repoman/modules/scan/use/__init__.py
@@ -0,0 +1,24 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Use plug-in module for repoman.
+Performs use flag checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'use',
+	'description': doc,
+	'provides':{
+		'use-module': {
+			'name': "use_flags",
+			'sourcefile': "use_flags",
+			'class': "USEFlagChecks",
+			'description': doc,
+			'functions': ['check', 'getUsedUseFlags'],
+			'func_desc': {
+			},
+		},
+	}
+}
+

diff --git a/pym/repoman/checks/ebuilds/use_flags.py b/pym/repoman/modules/scan/use/use_flags.py
similarity index 74%
rename from pym/repoman/checks/ebuilds/use_flags.py
rename to pym/repoman/modules/scan/use/use_flags.py
index ac21b47..acc7dd3 100644
--- a/pym/repoman/checks/ebuilds/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -9,31 +9,39 @@ from repoman._portage import portage
 
 from portage import eapi
 from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from repoman.modules.scan.scanbase import ScanBase
 
 
-class USEFlagChecks(object):
+class USEFlagChecks(ScanBase):
 	'''Performs checks on USE flags listed in the ebuilds and metadata.xml'''
 
-	def __init__(self, qatracker, globalUseFlags):
-		'''
+	def __init__(self, **kwargs):
+		'''Class init
+
 		@param qatracker: QATracker instance
 		@param globalUseFlags: Global USE flags
 		'''
-		self.qatracker = qatracker
-		self.globalUseFlags = globalUseFlags
+		super(USEFlagChecks, self).__init__(**kwargs)
+		self.qatracker = kwargs.get('qatracker')
+		self.globalUseFlags = kwargs.get('uselist')
 		self.useFlags = []
 		self.defaultUseFlags = []
 		self.usedUseFlags = set()
 
-	def check(self, pkg, package, ebuild, y_ebuild, localUseFlags):
+	def check(self, **kwargs):
 		'''Perform the check.
 
 		@param pkg: Package in which we check (object).
-		@param package: Package in which we check (string).
+		@param xpkg: Package in which we check (string).
 		@param ebuild: Ebuild which we check (object).
 		@param y_ebuild: Ebuild which we check (string).
-		@param localUseFlags: Local USE flags of the package
+		@param muselist: Local USE flags of the package
 		'''
+		pkg = kwargs.get('pkg')
+		package = kwargs.get('xpkg')
+		ebuild = kwargs.get('ebuild')
+		y_ebuild = kwargs.get('y_ebuild')
+		localUseFlags = kwargs.get('muselist')
 		# reset state variables for the run
 		self.useFlags = []
 		self.defaultUseFlags = []
@@ -41,10 +49,9 @@ class USEFlagChecks(object):
 		self._checkGlobal(pkg)
 		self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
 		self._checkRequiredUSE(pkg, ebuild)
-
-	def getUsedUseFlags(self):
-		'''Get the USE flags that this check has seen'''
-		return self.usedUseFlags
+		used_useflags = kwargs.get('used_useflags').union(self.usedUseFlags)
+		return {'continue': False, 'ebuild_UsedUseFlags': self.usedUseFlags,
+			'used_useflags': used_useflags}
 
 	def _checkGlobal(self, pkg):
 		for myflag in pkg._metadata["IUSE"].split():
@@ -88,3 +95,8 @@ class USEFlagChecks(object):
 					"REQUIRED_USE.syntax",
 					"%s: REQUIRED_USE: %s" % (ebuild.relative_path, e))
 				del e
+
+	@property
+	def runInEbuilds(self):
+		'''Ebuild level scans'''
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 40aafcc..23642c3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,7 +19,6 @@ 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.use_flags import USEFlagChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -215,7 +214,6 @@ class Scanner(object):
 			self.modules[mod_class.__name__] = mod_class(**self.kwargs)
 
 		# initialize our checks classes here before the big xpkg loop
-		self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
 		self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
 		self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
 		self.restrictcheck = RestrictChecks(self.qatracker)
@@ -303,6 +301,7 @@ class Scanner(object):
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
 				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
+				('use_flags', 'USEFlagChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -365,10 +364,7 @@ class Scanner(object):
 			badlicsyntax = badlicsyntax > 0
 			badprovsyntax = badprovsyntax > 0
 
-			self.use_flag_checks.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['muselist'])
-
-			ebuild_used_useflags = self.use_flag_checks.getUsedUseFlags()
-			used_useflags = used_useflags.union(ebuild_used_useflags)
+			used_useflags = used_useflags.union(dynamic_data['ebuild_used_useflags'])
 
 			self.rubyeclasscheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
 


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/modules/scan/use/, pym/repoman/
@ 2016-01-27 23:15 Brian Dolbec
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
  To: gentoo-commits

commit:     1ac21fb2d7bceb888f8203bb5b8b58865190f66d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  8 01:37:39 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 27 22:44:22 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1ac21fb2

repoman: Create USEFlagChecks class plugin

 pym/repoman/modules/scan/use/__init__.py           | 24 +++++++++++++++
 .../ebuilds => modules/scan/use}/use_flags.py      | 36 ++++++++++++++--------
 pym/repoman/scanner.py                             |  8 ++---
 3 files changed, 50 insertions(+), 18 deletions(-)

diff --git a/pym/repoman/modules/scan/use/__init__.py b/pym/repoman/modules/scan/use/__init__.py
new file mode 100644
index 0000000..80fa213
--- /dev/null
+++ b/pym/repoman/modules/scan/use/__init__.py
@@ -0,0 +1,24 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Use plug-in module for repoman.
+Performs use flag checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'use',
+	'description': doc,
+	'provides':{
+		'use-module': {
+			'name': "use_flags",
+			'sourcefile': "use_flags",
+			'class': "USEFlagChecks",
+			'description': doc,
+			'functions': ['check', 'getUsedUseFlags'],
+			'func_desc': {
+			},
+		},
+	}
+}
+

diff --git a/pym/repoman/checks/ebuilds/use_flags.py b/pym/repoman/modules/scan/use/use_flags.py
similarity index 74%
rename from pym/repoman/checks/ebuilds/use_flags.py
rename to pym/repoman/modules/scan/use/use_flags.py
index ac21b47..acc7dd3 100644
--- a/pym/repoman/checks/ebuilds/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -9,31 +9,39 @@ from repoman._portage import portage
 
 from portage import eapi
 from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
+from repoman.modules.scan.scanbase import ScanBase
 
 
-class USEFlagChecks(object):
+class USEFlagChecks(ScanBase):
 	'''Performs checks on USE flags listed in the ebuilds and metadata.xml'''
 
-	def __init__(self, qatracker, globalUseFlags):
-		'''
+	def __init__(self, **kwargs):
+		'''Class init
+
 		@param qatracker: QATracker instance
 		@param globalUseFlags: Global USE flags
 		'''
-		self.qatracker = qatracker
-		self.globalUseFlags = globalUseFlags
+		super(USEFlagChecks, self).__init__(**kwargs)
+		self.qatracker = kwargs.get('qatracker')
+		self.globalUseFlags = kwargs.get('uselist')
 		self.useFlags = []
 		self.defaultUseFlags = []
 		self.usedUseFlags = set()
 
-	def check(self, pkg, package, ebuild, y_ebuild, localUseFlags):
+	def check(self, **kwargs):
 		'''Perform the check.
 
 		@param pkg: Package in which we check (object).
-		@param package: Package in which we check (string).
+		@param xpkg: Package in which we check (string).
 		@param ebuild: Ebuild which we check (object).
 		@param y_ebuild: Ebuild which we check (string).
-		@param localUseFlags: Local USE flags of the package
+		@param muselist: Local USE flags of the package
 		'''
+		pkg = kwargs.get('pkg')
+		package = kwargs.get('xpkg')
+		ebuild = kwargs.get('ebuild')
+		y_ebuild = kwargs.get('y_ebuild')
+		localUseFlags = kwargs.get('muselist')
 		# reset state variables for the run
 		self.useFlags = []
 		self.defaultUseFlags = []
@@ -41,10 +49,9 @@ class USEFlagChecks(object):
 		self._checkGlobal(pkg)
 		self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
 		self._checkRequiredUSE(pkg, ebuild)
-
-	def getUsedUseFlags(self):
-		'''Get the USE flags that this check has seen'''
-		return self.usedUseFlags
+		used_useflags = kwargs.get('used_useflags').union(self.usedUseFlags)
+		return {'continue': False, 'ebuild_UsedUseFlags': self.usedUseFlags,
+			'used_useflags': used_useflags}
 
 	def _checkGlobal(self, pkg):
 		for myflag in pkg._metadata["IUSE"].split():
@@ -88,3 +95,8 @@ class USEFlagChecks(object):
 					"REQUIRED_USE.syntax",
 					"%s: REQUIRED_USE: %s" % (ebuild.relative_path, e))
 				del e
+
+	@property
+	def runInEbuilds(self):
+		'''Ebuild level scans'''
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 6ff4eeb..2101f13 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,7 +19,6 @@ 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.use_flags import USEFlagChecks
 from repoman.checks.ebuilds.variables.license import LicenseChecks
 from repoman.checks.ebuilds.variables.restrict import RestrictChecks
 from repoman.modules.commit import repochecks
@@ -215,7 +214,6 @@ class Scanner(object):
 			self.modules[mod_class.__name__] = mod_class(**self.kwargs)
 
 		# initialize our checks classes here before the big xpkg loop
-		self.use_flag_checks = USEFlagChecks(self.qatracker, uselist)
 		self.rubyeclasscheck = RubyEclassChecks(self.qatracker)
 		self.licensecheck = LicenseChecks(self.qatracker, liclist, liclist_deprecated)
 		self.restrictcheck = RestrictChecks(self.qatracker)
@@ -303,6 +301,7 @@ class Scanner(object):
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
 				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
+				('use_flags', 'USEFlagChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -365,10 +364,7 @@ class Scanner(object):
 			badlicsyntax = badlicsyntax > 0
 			badprovsyntax = badprovsyntax > 0
 
-			self.use_flag_checks.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['muselist'])
-
-			ebuild_used_useflags = self.use_flag_checks.getUsedUseFlags()
-			used_useflags = used_useflags.union(ebuild_used_useflags)
+			used_useflags = used_useflags.union(dynamic_data['ebuild_used_useflags'])
 
 			self.rubyeclasscheck.check(dynamic_data['pkg'], dynamic_data['ebuild'])
 


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

end of thread, other threads:[~2016-01-30  8:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-30  6:58 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/, pym/repoman/modules/scan/use/, pym/repoman/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2016-01-30  8:00 Brian Dolbec
2016-01-27 23:15 Brian Dolbec

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