public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/
@ 2016-01-06  4:21 Brian Dolbec
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-06  4:21 UTC (permalink / raw
  To: gentoo-commits

commit:     44283d1ffb00766110c5d0cf54e213f4a51118bc
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:28:58 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan  6 04:08:22 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=44283d1f

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 64 +++++++++++++--------------
 pym/repoman/scanner.py                        |  7 +--
 2 files changed, 32 insertions(+), 39 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index b11732d..867b886 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -14,6 +14,8 @@ class KeywordChecks(object):
 		'''
 		self.qatracker = kwargs.get('qatracker')
 		self.options = kwargs.get('options')
+		self.repo_metadata = kwargs.get('repo_metadata')
+		self.profiles = kwargs.get('profiles')
 		self.slot_keywords = {}
 
 	def prepare(self, **kwargs):
@@ -21,39 +23,38 @@ class KeywordChecks(object):
 		self.slot_keywords = {}
 		return {'continue': False}
 
-	def check(
-		self, pkg, package, ebuild, y_ebuild, keywords, ebuild_archs, changed,
-		live_ebuild, kwlist, profiles):
+	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 keywords: All the keywords (including -...) of the ebuild.
 		@param ebuild_archs: Just the architectures (no prefixes) of the ebuild.
 		@param changed: Changes instance
-		@param slot_keywords: A dictionary of keywords per slot.
 		@param live_ebuild: A boolean that determines if this is a live ebuild.
-		@param kwlist: A list of all global keywords.
-		@param profiles: A list of all profiles.
 		'''
+		pkg = kwargs.get('pkg')
+		xpkg =kwargs.get('xpkg')
+		ebuild = kwargs.get('ebuild')
+		y_ebuild = kwargs.get('y_ebuild')
+		changed = kwargs.get('changed')
+		live_ebuild = kwargs.get('live_ebuild')
 		if not self.options.straight_to_stable:
 			self._checkAddedWithStableKeywords(
-				package, ebuild, y_ebuild, keywords, changed)
+				xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
 
-		self._checkForDroppedKeywords(
-			pkg, ebuild, ebuild_archs, live_ebuild)
+		self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
 
-		self._checkForInvalidKeywords(
-			pkg, package, y_ebuild, kwlist, profiles)
+		self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-		self._checkForMaskLikeKeywords(
-			package, y_ebuild, keywords, kwlist)
+		self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-		self.slot_keywords[pkg.slot].update(ebuild_archs)
+		self.slot_keywords[pkg.slot].update(ebuild.archs)
+		return {'continue': False}
 
-	def _isKeywordStable(self, keyword):
+	@staticmethod
+	def _isKeywordStable(keyword):
 		return not keyword.startswith("~") and not keyword.startswith("-")
 
 	def _checkAddedWithStableKeywords(
@@ -82,9 +83,8 @@ class KeywordChecks(object):
 						ebuild.relative_path,
 						" ".join(sorted(dropped_keywords))))
 
-	def _checkForInvalidKeywords(
-		self, pkg, package, y_ebuild, kwlist, profiles):
-		myuse = pkg._metadata["KEYWORDS"].split()
+	def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+		myuse = ebuild.keywords
 
 		for mykey in myuse:
 			if mykey not in ("-*", "*", "~*"):
@@ -93,20 +93,16 @@ class KeywordChecks(object):
 				if not self._isKeywordStable(myskey[:1]):
 					myskey = myskey[1:]
 
-				if myskey not in kwlist:
-					self.qatracker.add_error(
-						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s" % (
-							package, y_ebuild, mykey))
-				elif myskey not in profiles:
+				if myskey not in self.repo_metadata['kwlist']:
+					self.qatracker.add_error("KEYWORDS.invalid",
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
+				elif myskey not in self.profiles:
 					self.qatracker.add_error(
 						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s (profile invalid)" % (
-							package, y_ebuild, mykey))
-
-	def _checkForMaskLikeKeywords(
-		self, package, y_ebuild, keywords, kwlist):
+						"%s/%s.ebuild: %s (profile invalid)"
+							% (xpkg, y_ebuild, mykey))
 
+	def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
 		# KEYWORDS="-*" is a stupid replacement for package.mask
 		# and screws general KEYWORDS semantics
 		if "-*" in keywords:
@@ -115,12 +111,12 @@ class KeywordChecks(object):
 			for kw in keywords:
 				if kw[0] == "~":
 					kw = kw[1:]
-				if kw in kwlist:
+				if kw in self.repo_metadata['kwlist']:
 					haskeyword = True
 
 			if not haskeyword:
-				self.qatracker.add_error(
-					"KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild")
+				self.qatracker.add_error("KEYWORDS.stupid",
+					"%s/%s.ebuild" % (xpkg, y_ebuild))
 
 	@property
 	def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index a6a89eb..7452d76 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -201,6 +201,7 @@ class Scanner(object):
 			"uselist": uselist,
 			"checks": self.checks,
 			"repo_metadata": self.repo_metadata,
+			"profiles": self.profiles,
 		}
 		# initialize the plugin checks here
 		self.modules = {}
@@ -299,7 +300,7 @@ class Scanner(object):
 			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
 				('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
-				('description', 'DescriptionChecks'),
+				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -330,10 +331,6 @@ class Scanner(object):
 
 			print("**** finished plugin loop, continuing...")
 
-			self.modules['KeywordChecks'].check(
-				dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, dynamic_data['ebuild'].archs, self.changed,
-				dynamic_data['live_ebuild'], self.repo_metadata['kwlist'], self.profiles)
-
 			if self.options.ignore_arches:
 				arches = [[
 					self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"],


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/
@ 2016-01-11  6:31 Brian Dolbec
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-11  6:31 UTC (permalink / raw
  To: gentoo-commits

commit:     e112f76afa86c6b371d9d573de43df7dbd344fde
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:28:58 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 22:59:33 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e112f76a

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ++++++++++++---------------
 pym/repoman/scanner.py                        |  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
 		super(KeywordChecks, self).__init__(**kwargs)
 		self.qatracker = kwargs.get('qatracker')
 		self.options = kwargs.get('options')
+		self.repo_metadata = kwargs.get('repo_metadata')
+		self.profiles = kwargs.get('profiles')
 		self.slot_keywords = {}
 
 	def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
 		live_ebuild = kwargs.get('live_ebuild')
 		if not self.options.straight_to_stable:
 			self._checkAddedWithStableKeywords(
-				package, ebuild, y_ebuild, keywords, changed)
+				xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
 
-		self._checkForDroppedKeywords(
-			pkg, ebuild, ebuild_archs, live_ebuild)
+		self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
 
-		self._checkForInvalidKeywords(
-			pkg, package, y_ebuild, kwlist, profiles)
+		self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-		self._checkForMaskLikeKeywords(
-			package, y_ebuild, keywords, kwlist)
+		self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-		self.slot_keywords[pkg.slot].update(ebuild_archs)
+		self.slot_keywords[pkg.slot].update(ebuild.archs)
 		return {'continue': False}
 
-	def _isKeywordStable(self, keyword):
+	@staticmethod
+	def _isKeywordStable(keyword):
 		return not keyword.startswith("~") and not keyword.startswith("-")
 
 	def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
 						ebuild.relative_path,
 						" ".join(sorted(dropped_keywords))))
 
-	def _checkForInvalidKeywords(
-		self, pkg, package, y_ebuild, kwlist, profiles):
-		myuse = pkg._metadata["KEYWORDS"].split()
+	def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+		myuse = ebuild.keywords
 
 		for mykey in myuse:
 			if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
 				if not self._isKeywordStable(myskey[:1]):
 					myskey = myskey[1:]
 
-				if myskey not in kwlist:
+				if myskey not in self.repo_metadata['kwlist']:
+					self.qatracker.add_error("KEYWORDS.invalid",
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
+				elif myskey not in self.profiles:
 					self.qatracker.add_error(
 						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s" % (
-							package, y_ebuild, mykey))
-				elif myskey not in profiles:
-					self.qatracker.add_error(
-						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s (profile invalid)" % (
-							package, y_ebuild, mykey))
-
-	def _checkForMaskLikeKeywords(
-		self, package, y_ebuild, keywords, kwlist):
+						"%s/%s.ebuild: %s (profile invalid)"
+							% (xpkg, y_ebuild, mykey))
 
+	def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
 		# KEYWORDS="-*" is a stupid replacement for package.mask
 		# and screws general KEYWORDS semantics
 		if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
 			for kw in keywords:
 				if kw[0] == "~":
 					kw = kw[1:]
-				if kw in kwlist:
+				if kw in self.repo_metadata['kwlist']:
 					haskeyword = True
 
 			if not haskeyword:
-				self.qatracker.add_error(
-					"KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild")
+				self.qatracker.add_error("KEYWORDS.stupid",
+					"%s/%s.ebuild" % (xpkg, y_ebuild))
 
 	@property
 	def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index bb856b8..83193fd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -203,6 +203,7 @@ class Scanner(object):
 			"uselist": uselist,
 			"checks": self.checks,
 			"repo_metadata": self.repo_metadata,
+			"profiles": self.profiles,
 		}
 		# initialize the plugin checks here
 		self.modules = {}
@@ -299,7 +300,7 @@ class Scanner(object):
 			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
 				('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
-				('description', 'DescriptionChecks'),
+				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/
@ 2016-01-11  8:01 Brian Dolbec
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-11  8:01 UTC (permalink / raw
  To: gentoo-commits

commit:     ed1be101d7047de509b5f900cf724349131b0e49
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:28:58 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:16 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ed1be101

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ++++++++++++---------------
 pym/repoman/scanner.py                        |  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
 		super(KeywordChecks, self).__init__(**kwargs)
 		self.qatracker = kwargs.get('qatracker')
 		self.options = kwargs.get('options')
+		self.repo_metadata = kwargs.get('repo_metadata')
+		self.profiles = kwargs.get('profiles')
 		self.slot_keywords = {}
 
 	def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
 		live_ebuild = kwargs.get('live_ebuild')
 		if not self.options.straight_to_stable:
 			self._checkAddedWithStableKeywords(
-				package, ebuild, y_ebuild, keywords, changed)
+				xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
 
-		self._checkForDroppedKeywords(
-			pkg, ebuild, ebuild_archs, live_ebuild)
+		self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
 
-		self._checkForInvalidKeywords(
-			pkg, package, y_ebuild, kwlist, profiles)
+		self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-		self._checkForMaskLikeKeywords(
-			package, y_ebuild, keywords, kwlist)
+		self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-		self.slot_keywords[pkg.slot].update(ebuild_archs)
+		self.slot_keywords[pkg.slot].update(ebuild.archs)
 		return {'continue': False}
 
-	def _isKeywordStable(self, keyword):
+	@staticmethod
+	def _isKeywordStable(keyword):
 		return not keyword.startswith("~") and not keyword.startswith("-")
 
 	def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
 						ebuild.relative_path,
 						" ".join(sorted(dropped_keywords))))
 
-	def _checkForInvalidKeywords(
-		self, pkg, package, y_ebuild, kwlist, profiles):
-		myuse = pkg._metadata["KEYWORDS"].split()
+	def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+		myuse = ebuild.keywords
 
 		for mykey in myuse:
 			if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
 				if not self._isKeywordStable(myskey[:1]):
 					myskey = myskey[1:]
 
-				if myskey not in kwlist:
+				if myskey not in self.repo_metadata['kwlist']:
+					self.qatracker.add_error("KEYWORDS.invalid",
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
+				elif myskey not in self.profiles:
 					self.qatracker.add_error(
 						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s" % (
-							package, y_ebuild, mykey))
-				elif myskey not in profiles:
-					self.qatracker.add_error(
-						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s (profile invalid)" % (
-							package, y_ebuild, mykey))
-
-	def _checkForMaskLikeKeywords(
-		self, package, y_ebuild, keywords, kwlist):
+						"%s/%s.ebuild: %s (profile invalid)"
+							% (xpkg, y_ebuild, mykey))
 
+	def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
 		# KEYWORDS="-*" is a stupid replacement for package.mask
 		# and screws general KEYWORDS semantics
 		if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
 			for kw in keywords:
 				if kw[0] == "~":
 					kw = kw[1:]
-				if kw in kwlist:
+				if kw in self.repo_metadata['kwlist']:
 					haskeyword = True
 
 			if not haskeyword:
-				self.qatracker.add_error(
-					"KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild")
+				self.qatracker.add_error("KEYWORDS.stupid",
+					"%s/%s.ebuild" % (xpkg, y_ebuild))
 
 	@property
 	def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index bb856b8..83193fd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -203,6 +203,7 @@ class Scanner(object):
 			"uselist": uselist,
 			"checks": self.checks,
 			"repo_metadata": self.repo_metadata,
+			"profiles": self.profiles,
 		}
 		# initialize the plugin checks here
 		self.modules = {}
@@ -299,7 +300,7 @@ class Scanner(object):
 			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
 				('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
-				('description', 'DescriptionChecks'),
+				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/
@ 2016-01-18 19:23 Brian Dolbec
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
  To: gentoo-commits

commit:     2897811ee4dd018671eb41f6dbe4b312e9e6441d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:28:58 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 19:20:03 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2897811e

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ++++++++++++---------------
 pym/repoman/scanner.py                        |  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
 		super(KeywordChecks, self).__init__(**kwargs)
 		self.qatracker = kwargs.get('qatracker')
 		self.options = kwargs.get('options')
+		self.repo_metadata = kwargs.get('repo_metadata')
+		self.profiles = kwargs.get('profiles')
 		self.slot_keywords = {}
 
 	def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
 		live_ebuild = kwargs.get('live_ebuild')
 		if not self.options.straight_to_stable:
 			self._checkAddedWithStableKeywords(
-				package, ebuild, y_ebuild, keywords, changed)
+				xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
 
-		self._checkForDroppedKeywords(
-			pkg, ebuild, ebuild_archs, live_ebuild)
+		self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
 
-		self._checkForInvalidKeywords(
-			pkg, package, y_ebuild, kwlist, profiles)
+		self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-		self._checkForMaskLikeKeywords(
-			package, y_ebuild, keywords, kwlist)
+		self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-		self.slot_keywords[pkg.slot].update(ebuild_archs)
+		self.slot_keywords[pkg.slot].update(ebuild.archs)
 		return {'continue': False}
 
-	def _isKeywordStable(self, keyword):
+	@staticmethod
+	def _isKeywordStable(keyword):
 		return not keyword.startswith("~") and not keyword.startswith("-")
 
 	def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
 						ebuild.relative_path,
 						" ".join(sorted(dropped_keywords))))
 
-	def _checkForInvalidKeywords(
-		self, pkg, package, y_ebuild, kwlist, profiles):
-		myuse = pkg._metadata["KEYWORDS"].split()
+	def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+		myuse = ebuild.keywords
 
 		for mykey in myuse:
 			if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
 				if not self._isKeywordStable(myskey[:1]):
 					myskey = myskey[1:]
 
-				if myskey not in kwlist:
+				if myskey not in self.repo_metadata['kwlist']:
+					self.qatracker.add_error("KEYWORDS.invalid",
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
+				elif myskey not in self.profiles:
 					self.qatracker.add_error(
 						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s" % (
-							package, y_ebuild, mykey))
-				elif myskey not in profiles:
-					self.qatracker.add_error(
-						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s (profile invalid)" % (
-							package, y_ebuild, mykey))
-
-	def _checkForMaskLikeKeywords(
-		self, package, y_ebuild, keywords, kwlist):
+						"%s/%s.ebuild: %s (profile invalid)"
+							% (xpkg, y_ebuild, mykey))
 
+	def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
 		# KEYWORDS="-*" is a stupid replacement for package.mask
 		# and screws general KEYWORDS semantics
 		if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
 			for kw in keywords:
 				if kw[0] == "~":
 					kw = kw[1:]
-				if kw in kwlist:
+				if kw in self.repo_metadata['kwlist']:
 					haskeyword = True
 
 			if not haskeyword:
-				self.qatracker.add_error(
-					"KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild")
+				self.qatracker.add_error("KEYWORDS.stupid",
+					"%s/%s.ebuild" % (xpkg, y_ebuild))
 
 	@property
 	def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index bb856b8..83193fd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -203,6 +203,7 @@ class Scanner(object):
 			"uselist": uselist,
 			"checks": self.checks,
 			"repo_metadata": self.repo_metadata,
+			"profiles": self.profiles,
 		}
 		# initialize the plugin checks here
 		self.modules = {}
@@ -299,7 +300,7 @@ class Scanner(object):
 			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
 				('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
-				('description', 'DescriptionChecks'),
+				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/
@ 2016-01-21 18:30 Brian Dolbec
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-21 18:30 UTC (permalink / raw
  To: gentoo-commits

commit:     334a29254dcecec3fd6a5a804f84a04e8686507e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:28:58 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 00:35:22 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=334a2925

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ++++++++++++---------------
 pym/repoman/scanner.py                        |  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
 		super(KeywordChecks, self).__init__(**kwargs)
 		self.qatracker = kwargs.get('qatracker')
 		self.options = kwargs.get('options')
+		self.repo_metadata = kwargs.get('repo_metadata')
+		self.profiles = kwargs.get('profiles')
 		self.slot_keywords = {}
 
 	def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
 		live_ebuild = kwargs.get('live_ebuild')
 		if not self.options.straight_to_stable:
 			self._checkAddedWithStableKeywords(
-				package, ebuild, y_ebuild, keywords, changed)
+				xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
 
-		self._checkForDroppedKeywords(
-			pkg, ebuild, ebuild_archs, live_ebuild)
+		self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
 
-		self._checkForInvalidKeywords(
-			pkg, package, y_ebuild, kwlist, profiles)
+		self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-		self._checkForMaskLikeKeywords(
-			package, y_ebuild, keywords, kwlist)
+		self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-		self.slot_keywords[pkg.slot].update(ebuild_archs)
+		self.slot_keywords[pkg.slot].update(ebuild.archs)
 		return {'continue': False}
 
-	def _isKeywordStable(self, keyword):
+	@staticmethod
+	def _isKeywordStable(keyword):
 		return not keyword.startswith("~") and not keyword.startswith("-")
 
 	def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
 						ebuild.relative_path,
 						" ".join(sorted(dropped_keywords))))
 
-	def _checkForInvalidKeywords(
-		self, pkg, package, y_ebuild, kwlist, profiles):
-		myuse = pkg._metadata["KEYWORDS"].split()
+	def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+		myuse = ebuild.keywords
 
 		for mykey in myuse:
 			if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
 				if not self._isKeywordStable(myskey[:1]):
 					myskey = myskey[1:]
 
-				if myskey not in kwlist:
+				if myskey not in self.repo_metadata['kwlist']:
+					self.qatracker.add_error("KEYWORDS.invalid",
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
+				elif myskey not in self.profiles:
 					self.qatracker.add_error(
 						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s" % (
-							package, y_ebuild, mykey))
-				elif myskey not in profiles:
-					self.qatracker.add_error(
-						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s (profile invalid)" % (
-							package, y_ebuild, mykey))
-
-	def _checkForMaskLikeKeywords(
-		self, package, y_ebuild, keywords, kwlist):
+						"%s/%s.ebuild: %s (profile invalid)"
+							% (xpkg, y_ebuild, mykey))
 
+	def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
 		# KEYWORDS="-*" is a stupid replacement for package.mask
 		# and screws general KEYWORDS semantics
 		if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
 			for kw in keywords:
 				if kw[0] == "~":
 					kw = kw[1:]
-				if kw in kwlist:
+				if kw in self.repo_metadata['kwlist']:
 					haskeyword = True
 
 			if not haskeyword:
-				self.qatracker.add_error(
-					"KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild")
+				self.qatracker.add_error("KEYWORDS.stupid",
+					"%s/%s.ebuild" % (xpkg, y_ebuild))
 
 	@property
 	def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index bb856b8..83193fd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -203,6 +203,7 @@ class Scanner(object):
 			"uselist": uselist,
 			"checks": self.checks,
 			"repo_metadata": self.repo_metadata,
+			"profiles": self.profiles,
 		}
 		# initialize the plugin checks here
 		self.modules = {}
@@ -299,7 +300,7 @@ class Scanner(object):
 			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
 				('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
-				('description', 'DescriptionChecks'),
+				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/
@ 2016-01-22 20:55 Brian Dolbec
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
  To: gentoo-commits

commit:     d6cb7d58683881d43e96e395664c0e77a1e1e860
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:28:58 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:11 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=d6cb7d58

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ++++++++++++---------------
 pym/repoman/scanner.py                        |  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
 		super(KeywordChecks, self).__init__(**kwargs)
 		self.qatracker = kwargs.get('qatracker')
 		self.options = kwargs.get('options')
+		self.repo_metadata = kwargs.get('repo_metadata')
+		self.profiles = kwargs.get('profiles')
 		self.slot_keywords = {}
 
 	def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
 		live_ebuild = kwargs.get('live_ebuild')
 		if not self.options.straight_to_stable:
 			self._checkAddedWithStableKeywords(
-				package, ebuild, y_ebuild, keywords, changed)
+				xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
 
-		self._checkForDroppedKeywords(
-			pkg, ebuild, ebuild_archs, live_ebuild)
+		self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
 
-		self._checkForInvalidKeywords(
-			pkg, package, y_ebuild, kwlist, profiles)
+		self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-		self._checkForMaskLikeKeywords(
-			package, y_ebuild, keywords, kwlist)
+		self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-		self.slot_keywords[pkg.slot].update(ebuild_archs)
+		self.slot_keywords[pkg.slot].update(ebuild.archs)
 		return {'continue': False}
 
-	def _isKeywordStable(self, keyword):
+	@staticmethod
+	def _isKeywordStable(keyword):
 		return not keyword.startswith("~") and not keyword.startswith("-")
 
 	def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
 						ebuild.relative_path,
 						" ".join(sorted(dropped_keywords))))
 
-	def _checkForInvalidKeywords(
-		self, pkg, package, y_ebuild, kwlist, profiles):
-		myuse = pkg._metadata["KEYWORDS"].split()
+	def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+		myuse = ebuild.keywords
 
 		for mykey in myuse:
 			if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
 				if not self._isKeywordStable(myskey[:1]):
 					myskey = myskey[1:]
 
-				if myskey not in kwlist:
+				if myskey not in self.repo_metadata['kwlist']:
+					self.qatracker.add_error("KEYWORDS.invalid",
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
+				elif myskey not in self.profiles:
 					self.qatracker.add_error(
 						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s" % (
-							package, y_ebuild, mykey))
-				elif myskey not in profiles:
-					self.qatracker.add_error(
-						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s (profile invalid)" % (
-							package, y_ebuild, mykey))
-
-	def _checkForMaskLikeKeywords(
-		self, package, y_ebuild, keywords, kwlist):
+						"%s/%s.ebuild: %s (profile invalid)"
+							% (xpkg, y_ebuild, mykey))
 
+	def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
 		# KEYWORDS="-*" is a stupid replacement for package.mask
 		# and screws general KEYWORDS semantics
 		if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
 			for kw in keywords:
 				if kw[0] == "~":
 					kw = kw[1:]
-				if kw in kwlist:
+				if kw in self.repo_metadata['kwlist']:
 					haskeyword = True
 
 			if not haskeyword:
-				self.qatracker.add_error(
-					"KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild")
+				self.qatracker.add_error("KEYWORDS.stupid",
+					"%s/%s.ebuild" % (xpkg, y_ebuild))
 
 	@property
 	def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index bb856b8..83193fd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -203,6 +203,7 @@ class Scanner(object):
 			"uselist": uselist,
 			"checks": self.checks,
 			"repo_metadata": self.repo_metadata,
+			"profiles": self.profiles,
 		}
 		# initialize the plugin checks here
 		self.modules = {}
@@ -299,7 +300,7 @@ class Scanner(object):
 			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
 				('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
-				('description', 'DescriptionChecks'),
+				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/
@ 2016-01-23  1:42 Brian Dolbec
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-23  1:42 UTC (permalink / raw
  To: gentoo-commits

commit:     925db7edeb1fcd78b9f68bc4eda54e01d63fd9db
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:28:58 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 01:25:27 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=925db7ed

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ++++++++++++---------------
 pym/repoman/scanner.py                        |  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
 		super(KeywordChecks, self).__init__(**kwargs)
 		self.qatracker = kwargs.get('qatracker')
 		self.options = kwargs.get('options')
+		self.repo_metadata = kwargs.get('repo_metadata')
+		self.profiles = kwargs.get('profiles')
 		self.slot_keywords = {}
 
 	def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
 		live_ebuild = kwargs.get('live_ebuild')
 		if not self.options.straight_to_stable:
 			self._checkAddedWithStableKeywords(
-				package, ebuild, y_ebuild, keywords, changed)
+				xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
 
-		self._checkForDroppedKeywords(
-			pkg, ebuild, ebuild_archs, live_ebuild)
+		self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
 
-		self._checkForInvalidKeywords(
-			pkg, package, y_ebuild, kwlist, profiles)
+		self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-		self._checkForMaskLikeKeywords(
-			package, y_ebuild, keywords, kwlist)
+		self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-		self.slot_keywords[pkg.slot].update(ebuild_archs)
+		self.slot_keywords[pkg.slot].update(ebuild.archs)
 		return {'continue': False}
 
-	def _isKeywordStable(self, keyword):
+	@staticmethod
+	def _isKeywordStable(keyword):
 		return not keyword.startswith("~") and not keyword.startswith("-")
 
 	def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
 						ebuild.relative_path,
 						" ".join(sorted(dropped_keywords))))
 
-	def _checkForInvalidKeywords(
-		self, pkg, package, y_ebuild, kwlist, profiles):
-		myuse = pkg._metadata["KEYWORDS"].split()
+	def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+		myuse = ebuild.keywords
 
 		for mykey in myuse:
 			if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
 				if not self._isKeywordStable(myskey[:1]):
 					myskey = myskey[1:]
 
-				if myskey not in kwlist:
+				if myskey not in self.repo_metadata['kwlist']:
+					self.qatracker.add_error("KEYWORDS.invalid",
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
+				elif myskey not in self.profiles:
 					self.qatracker.add_error(
 						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s" % (
-							package, y_ebuild, mykey))
-				elif myskey not in profiles:
-					self.qatracker.add_error(
-						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s (profile invalid)" % (
-							package, y_ebuild, mykey))
-
-	def _checkForMaskLikeKeywords(
-		self, package, y_ebuild, keywords, kwlist):
+						"%s/%s.ebuild: %s (profile invalid)"
+							% (xpkg, y_ebuild, mykey))
 
+	def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
 		# KEYWORDS="-*" is a stupid replacement for package.mask
 		# and screws general KEYWORDS semantics
 		if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
 			for kw in keywords:
 				if kw[0] == "~":
 					kw = kw[1:]
-				if kw in kwlist:
+				if kw in self.repo_metadata['kwlist']:
 					haskeyword = True
 
 			if not haskeyword:
-				self.qatracker.add_error(
-					"KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild")
+				self.qatracker.add_error("KEYWORDS.stupid",
+					"%s/%s.ebuild" % (xpkg, y_ebuild))
 
 	@property
 	def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index bb856b8..83193fd 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -203,6 +203,7 @@ class Scanner(object):
 			"uselist": uselist,
 			"checks": self.checks,
 			"repo_metadata": self.repo_metadata,
+			"profiles": self.profiles,
 		}
 		# initialize the plugin checks here
 		self.modules = {}
@@ -299,7 +300,7 @@ class Scanner(object):
 			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
 				('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
-				('description', 'DescriptionChecks'),
+				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/
@ 2016-01-27 23:15 Brian Dolbec
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
  To: gentoo-commits

commit:     b99d59c285b4c71027eec68c5809244416a5b95c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:28:58 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 27 22:44:21 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b99d59c2

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ++++++++++++---------------
 pym/repoman/scanner.py                        |  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
 		super(KeywordChecks, self).__init__(**kwargs)
 		self.qatracker = kwargs.get('qatracker')
 		self.options = kwargs.get('options')
+		self.repo_metadata = kwargs.get('repo_metadata')
+		self.profiles = kwargs.get('profiles')
 		self.slot_keywords = {}
 
 	def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
 		live_ebuild = kwargs.get('live_ebuild')
 		if not self.options.straight_to_stable:
 			self._checkAddedWithStableKeywords(
-				package, ebuild, y_ebuild, keywords, changed)
+				xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
 
-		self._checkForDroppedKeywords(
-			pkg, ebuild, ebuild_archs, live_ebuild)
+		self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
 
-		self._checkForInvalidKeywords(
-			pkg, package, y_ebuild, kwlist, profiles)
+		self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-		self._checkForMaskLikeKeywords(
-			package, y_ebuild, keywords, kwlist)
+		self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-		self.slot_keywords[pkg.slot].update(ebuild_archs)
+		self.slot_keywords[pkg.slot].update(ebuild.archs)
 		return {'continue': False}
 
-	def _isKeywordStable(self, keyword):
+	@staticmethod
+	def _isKeywordStable(keyword):
 		return not keyword.startswith("~") and not keyword.startswith("-")
 
 	def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
 						ebuild.relative_path,
 						" ".join(sorted(dropped_keywords))))
 
-	def _checkForInvalidKeywords(
-		self, pkg, package, y_ebuild, kwlist, profiles):
-		myuse = pkg._metadata["KEYWORDS"].split()
+	def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+		myuse = ebuild.keywords
 
 		for mykey in myuse:
 			if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
 				if not self._isKeywordStable(myskey[:1]):
 					myskey = myskey[1:]
 
-				if myskey not in kwlist:
+				if myskey not in self.repo_metadata['kwlist']:
+					self.qatracker.add_error("KEYWORDS.invalid",
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
+				elif myskey not in self.profiles:
 					self.qatracker.add_error(
 						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s" % (
-							package, y_ebuild, mykey))
-				elif myskey not in profiles:
-					self.qatracker.add_error(
-						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s (profile invalid)" % (
-							package, y_ebuild, mykey))
-
-	def _checkForMaskLikeKeywords(
-		self, package, y_ebuild, keywords, kwlist):
+						"%s/%s.ebuild: %s (profile invalid)"
+							% (xpkg, y_ebuild, mykey))
 
+	def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
 		# KEYWORDS="-*" is a stupid replacement for package.mask
 		# and screws general KEYWORDS semantics
 		if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
 			for kw in keywords:
 				if kw[0] == "~":
 					kw = kw[1:]
-				if kw in kwlist:
+				if kw in self.repo_metadata['kwlist']:
 					haskeyword = True
 
 			if not haskeyword:
-				self.qatracker.add_error(
-					"KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild")
+				self.qatracker.add_error("KEYWORDS.stupid",
+					"%s/%s.ebuild" % (xpkg, y_ebuild))
 
 	@property
 	def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b9e80ff..6996f38 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -206,6 +206,7 @@ class Scanner(object):
 			"uselist": uselist,
 			"checks": self.checks,
 			"repo_metadata": self.repo_metadata,
+			"profiles": self.profiles,
 		}
 		# initialize the plugin checks here
 		self.modules = {}
@@ -302,7 +303,7 @@ class Scanner(object):
 			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
 				('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
-				('description', 'DescriptionChecks'),
+				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/
@ 2016-01-29  5:01 Brian Dolbec
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-29  5:01 UTC (permalink / raw
  To: gentoo-commits

commit:     6ef51774706f1cf02ff3b4c38c8be2d79a0edde3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:28:58 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 04:52:56 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=6ef51774

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ++++++++++++---------------
 pym/repoman/scanner.py                        |  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
 		super(KeywordChecks, self).__init__(**kwargs)
 		self.qatracker = kwargs.get('qatracker')
 		self.options = kwargs.get('options')
+		self.repo_metadata = kwargs.get('repo_metadata')
+		self.profiles = kwargs.get('profiles')
 		self.slot_keywords = {}
 
 	def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
 		live_ebuild = kwargs.get('live_ebuild')
 		if not self.options.straight_to_stable:
 			self._checkAddedWithStableKeywords(
-				package, ebuild, y_ebuild, keywords, changed)
+				xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
 
-		self._checkForDroppedKeywords(
-			pkg, ebuild, ebuild_archs, live_ebuild)
+		self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
 
-		self._checkForInvalidKeywords(
-			pkg, package, y_ebuild, kwlist, profiles)
+		self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-		self._checkForMaskLikeKeywords(
-			package, y_ebuild, keywords, kwlist)
+		self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-		self.slot_keywords[pkg.slot].update(ebuild_archs)
+		self.slot_keywords[pkg.slot].update(ebuild.archs)
 		return {'continue': False}
 
-	def _isKeywordStable(self, keyword):
+	@staticmethod
+	def _isKeywordStable(keyword):
 		return not keyword.startswith("~") and not keyword.startswith("-")
 
 	def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
 						ebuild.relative_path,
 						" ".join(sorted(dropped_keywords))))
 
-	def _checkForInvalidKeywords(
-		self, pkg, package, y_ebuild, kwlist, profiles):
-		myuse = pkg._metadata["KEYWORDS"].split()
+	def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+		myuse = ebuild.keywords
 
 		for mykey in myuse:
 			if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
 				if not self._isKeywordStable(myskey[:1]):
 					myskey = myskey[1:]
 
-				if myskey not in kwlist:
+				if myskey not in self.repo_metadata['kwlist']:
+					self.qatracker.add_error("KEYWORDS.invalid",
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
+				elif myskey not in self.profiles:
 					self.qatracker.add_error(
 						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s" % (
-							package, y_ebuild, mykey))
-				elif myskey not in profiles:
-					self.qatracker.add_error(
-						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s (profile invalid)" % (
-							package, y_ebuild, mykey))
-
-	def _checkForMaskLikeKeywords(
-		self, package, y_ebuild, keywords, kwlist):
+						"%s/%s.ebuild: %s (profile invalid)"
+							% (xpkg, y_ebuild, mykey))
 
+	def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
 		# KEYWORDS="-*" is a stupid replacement for package.mask
 		# and screws general KEYWORDS semantics
 		if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
 			for kw in keywords:
 				if kw[0] == "~":
 					kw = kw[1:]
-				if kw in kwlist:
+				if kw in self.repo_metadata['kwlist']:
 					haskeyword = True
 
 			if not haskeyword:
-				self.qatracker.add_error(
-					"KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild")
+				self.qatracker.add_error("KEYWORDS.stupid",
+					"%s/%s.ebuild" % (xpkg, y_ebuild))
 
 	@property
 	def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b9e80ff..6996f38 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -206,6 +206,7 @@ class Scanner(object):
 			"uselist": uselist,
 			"checks": self.checks,
 			"repo_metadata": self.repo_metadata,
+			"profiles": self.profiles,
 		}
 		# initialize the plugin checks here
 		self.modules = {}
@@ -302,7 +303,7 @@ class Scanner(object):
 			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
 				('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
-				('description', 'DescriptionChecks'),
+				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/
@ 2016-01-30  8:00 Brian Dolbec
  0 siblings, 0 replies; 10+ messages in thread
From: Brian Dolbec @ 2016-01-30  8:00 UTC (permalink / raw
  To: gentoo-commits

commit:     6fe1e8ceee67f8d91ac94c319c603b1955109267
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 18:28:58 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=6fe1e8ce

repoman: Complete KeywordChecks migration

 pym/repoman/modules/scan/keywords/keywords.py | 47 ++++++++++++---------------
 pym/repoman/scanner.py                        |  3 +-
 2 files changed, 23 insertions(+), 27 deletions(-)

diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 484d7d5..e34c891 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -19,6 +19,8 @@ class KeywordChecks(ScanBase):
 		super(KeywordChecks, self).__init__(**kwargs)
 		self.qatracker = kwargs.get('qatracker')
 		self.options = kwargs.get('options')
+		self.repo_metadata = kwargs.get('repo_metadata')
+		self.profiles = kwargs.get('profiles')
 		self.slot_keywords = {}
 
 	def prepare(self, **kwargs):
@@ -45,21 +47,19 @@ class KeywordChecks(ScanBase):
 		live_ebuild = kwargs.get('live_ebuild')
 		if not self.options.straight_to_stable:
 			self._checkAddedWithStableKeywords(
-				package, ebuild, y_ebuild, keywords, changed)
+				xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
 
-		self._checkForDroppedKeywords(
-			pkg, ebuild, ebuild_archs, live_ebuild)
+		self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
 
-		self._checkForInvalidKeywords(
-			pkg, package, y_ebuild, kwlist, profiles)
+		self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
 
-		self._checkForMaskLikeKeywords(
-			package, y_ebuild, keywords, kwlist)
+		self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
 
-		self.slot_keywords[pkg.slot].update(ebuild_archs)
+		self.slot_keywords[pkg.slot].update(ebuild.archs)
 		return {'continue': False}
 
-	def _isKeywordStable(self, keyword):
+	@staticmethod
+	def _isKeywordStable(keyword):
 		return not keyword.startswith("~") and not keyword.startswith("-")
 
 	def _checkAddedWithStableKeywords(
@@ -88,9 +88,8 @@ class KeywordChecks(ScanBase):
 						ebuild.relative_path,
 						" ".join(sorted(dropped_keywords))))
 
-	def _checkForInvalidKeywords(
-		self, pkg, package, y_ebuild, kwlist, profiles):
-		myuse = pkg._metadata["KEYWORDS"].split()
+	def _checkForInvalidKeywords(self, ebuild, xpkg, y_ebuild):
+		myuse = ebuild.keywords
 
 		for mykey in myuse:
 			if mykey not in ("-*", "*", "~*"):
@@ -99,20 +98,16 @@ class KeywordChecks(ScanBase):
 				if not self._isKeywordStable(myskey[:1]):
 					myskey = myskey[1:]
 
-				if myskey not in kwlist:
+				if myskey not in self.repo_metadata['kwlist']:
+					self.qatracker.add_error("KEYWORDS.invalid",
+						"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mykey))
+				elif myskey not in self.profiles:
 					self.qatracker.add_error(
 						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s" % (
-							package, y_ebuild, mykey))
-				elif myskey not in profiles:
-					self.qatracker.add_error(
-						"KEYWORDS.invalid",
-						"%s/%s.ebuild: %s (profile invalid)" % (
-							package, y_ebuild, mykey))
-
-	def _checkForMaskLikeKeywords(
-		self, package, y_ebuild, keywords, kwlist):
+						"%s/%s.ebuild: %s (profile invalid)"
+							% (xpkg, y_ebuild, mykey))
 
+	def _checkForMaskLikeKeywords(self, xpkg, y_ebuild, keywords):
 		# KEYWORDS="-*" is a stupid replacement for package.mask
 		# and screws general KEYWORDS semantics
 		if "-*" in keywords:
@@ -121,12 +116,12 @@ class KeywordChecks(ScanBase):
 			for kw in keywords:
 				if kw[0] == "~":
 					kw = kw[1:]
-				if kw in kwlist:
+				if kw in self.repo_metadata['kwlist']:
 					haskeyword = True
 
 			if not haskeyword:
-				self.qatracker.add_error(
-					"KEYWORDS.stupid", package + "/" + y_ebuild + ".ebuild")
+				self.qatracker.add_error("KEYWORDS.stupid",
+					"%s/%s.ebuild" % (xpkg, y_ebuild))
 
 	@property
 	def runInPkgs(self):

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 27c1be9..f0a4bef 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -206,6 +206,7 @@ class Scanner(object):
 			"uselist": uselist,
 			"checks": self.checks,
 			"repo_metadata": self.repo_metadata,
+			"profiles": self.profiles,
 		}
 		# initialize the plugin checks here
 		self.modules = {}
@@ -302,7 +303,7 @@ class Scanner(object):
 			for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
 				('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
 				('thirdpartymirrors', 'ThirdPartyMirrors'),
-				('description', 'DescriptionChecks'),
+				('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])


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

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

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11  6:31 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/keywords/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2016-01-30  8:00 Brian Dolbec
2016-01-29  5:01 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-23  1:42 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-11  8:01 Brian Dolbec
2016-01-06  4:21 Brian Dolbec

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