commit: fc3ff802cda4854498aa8b304c1102af0cef257c
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 3 19:39:56 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Jun 3 19:39:56 2014 +0000
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fc3ff802
repoman.../use_flags.py: Reset state variables for each check() run
Also double space function separations.
---
pym/repoman/checks/ebuilds/use_flags.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/pym/repoman/checks/ebuilds/use_flags.py
b/pym/repoman/checks/ebuilds/use_flags.py
index bc09ed7..d63ae6d 100644
--- a/pym/repoman/checks/ebuilds/use_flags.py
+++ b/pym/repoman/checks/ebuilds/use_flags.py
@@ -19,10 +19,11 @@ class USEFlagChecks(object):
@param globalUseFlags: Global USE flags
'''
self.qatracker = qatracker
+ self.globalUseFlags = globalUseFlags
self.useFlags = []
self.defaultUseFlags = []
self.usedUseFlags = set()
- self.globalUseFlags = globalUseFlags
+
def check(self, pkg, package, ebuild, y_ebuild, localUseFlags):
'''Perform the check.
@@ -33,14 +34,20 @@ class USEFlagChecks(object):
@param y_ebuild: Ebuild which we check (string).
@param localUseFlags: Local USE flags of the package
'''
+ # reset state variables for the run
+ self.useFlags = []
+ self.defaultUseFlags = []
+ self.usedUseFlags = set()
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
+
def _checkGlobal(self, pkg):
for myflag in pkg._metadata["IUSE"].split():
flag_name = myflag.lstrip("+-")
@@ -50,6 +57,7 @@ class USEFlagChecks(object):
if flag_name not in self.globalUseFlags:
self.useFlags.append(flag_name)
+
def _checkMetadata(self, package, ebuild, y_ebuild, localUseFlags):
for mypos in range(len(self.useFlags) - 1, -1, -1):
if self.useFlags[mypos] and (self.useFlags[mypos] in
localUseFlags):
@@ -67,6 +75,7 @@ class USEFlagChecks(object):
"IUSE.invalid",
"%s/%s.ebuild: %s" % (package, y_ebuild,
self.useFlags[mypos]))
+
def _checkRequiredUSE(self, pkg, ebuild):
required_use = pkg._metadata["REQUIRED_USE"]
if required_use: