Gentoo Archives: gentoo-commits

From: Brian Dolbec <brian.dolbec@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/checks/ebuilds/
Date: Wed, 01 Oct 2014 23:46:45
Message-Id: 1412207134.c4c004b5125e1785af163d3d574a3f61ccadd062.dol-sen@gentoo
1 commit: c4c004b5125e1785af163d3d574a3f61ccadd062
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 3 19:39:56 2014 +0000
4 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
5 CommitDate: Wed Oct 1 23:45:34 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c4c004b5
7
8 repoman.../use_flags.py: Reset state variables for each check() run
9
10 Also double space function separations.
11
12 ---
13 pym/repoman/checks/ebuilds/use_flags.py | 11 ++++++++++-
14 1 file changed, 10 insertions(+), 1 deletion(-)
15
16 diff --git a/pym/repoman/checks/ebuilds/use_flags.py b/pym/repoman/checks/ebuilds/use_flags.py
17 index bc09ed7..d63ae6d 100644
18 --- a/pym/repoman/checks/ebuilds/use_flags.py
19 +++ b/pym/repoman/checks/ebuilds/use_flags.py
20 @@ -19,10 +19,11 @@ class USEFlagChecks(object):
21 @param globalUseFlags: Global USE flags
22 '''
23 self.qatracker = qatracker
24 + self.globalUseFlags = globalUseFlags
25 self.useFlags = []
26 self.defaultUseFlags = []
27 self.usedUseFlags = set()
28 - self.globalUseFlags = globalUseFlags
29 +
30
31 def check(self, pkg, package, ebuild, y_ebuild, localUseFlags):
32 '''Perform the check.
33 @@ -33,14 +34,20 @@ class USEFlagChecks(object):
34 @param y_ebuild: Ebuild which we check (string).
35 @param localUseFlags: Local USE flags of the package
36 '''
37 + # reset state variables for the run
38 + self.useFlags = []
39 + self.defaultUseFlags = []
40 + self.usedUseFlags = set()
41 self._checkGlobal(pkg)
42 self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
43 self._checkRequiredUSE(pkg, ebuild)
44
45 +
46 def getUsedUseFlags(self):
47 '''Get the USE flags that this check has seen'''
48 return self.usedUseFlags
49
50 +
51 def _checkGlobal(self, pkg):
52 for myflag in pkg._metadata["IUSE"].split():
53 flag_name = myflag.lstrip("+-")
54 @@ -50,6 +57,7 @@ class USEFlagChecks(object):
55 if flag_name not in self.globalUseFlags:
56 self.useFlags.append(flag_name)
57
58 +
59 def _checkMetadata(self, package, ebuild, y_ebuild, localUseFlags):
60 for mypos in range(len(self.useFlags) - 1, -1, -1):
61 if self.useFlags[mypos] and (self.useFlags[mypos] in localUseFlags):
62 @@ -67,6 +75,7 @@ class USEFlagChecks(object):
63 "IUSE.invalid",
64 "%s/%s.ebuild: %s" % (package, y_ebuild, self.useFlags[mypos]))
65
66 +
67 def _checkRequiredUSE(self, pkg, ebuild):
68 required_use = pkg._metadata["REQUIRED_USE"]
69 if required_use: