Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/repoman/
Date: Fri, 08 Jun 2012 02:52:19
Message-Id: 1339123908.dcdfed5f9487f4232affc156518e05e00c10da5f.zmedico@gentoo
1 commit: dcdfed5f9487f4232affc156518e05e00c10da5f
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 8 02:51:48 2012 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 8 02:51:48 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=dcdfed5f
7
8 InheritEclass: avoid false positive in func regex
9
10 ---
11 pym/repoman/checks.py | 7 +++++--
12 1 files changed, 5 insertions(+), 2 deletions(-)
13
14 diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
15 index 65f024c..2864d67 100644
16 --- a/pym/repoman/checks.py
17 +++ b/pym/repoman/checks.py
18 @@ -469,7 +469,10 @@ class InheritEclass(LineCheck):
19 self._ignore_missing = ignore_missing
20 inherit_re = eclass
21 self._inherit_re = re.compile(r'^(\s*|.*[|&]\s*)\binherit\s(.*\s)?%s(\s|$)' % inherit_re)
22 - self._func_re = re.compile(r'\b(' + '|'.join(funcs) + r')\b')
23 + # Match when the function is preceded only by leading whitespace or a shell
24 + # operator such as (, {, |, ||, or &&. This prevents false postives in
25 + # things like elog messages, as reported in bug #413285.
26 + self._func_re = re.compile(r'(^|[|&{(])\s*\b(' + '|'.join(funcs) + r')\b')
27
28 def new(self, pkg):
29 self.repoman_check_name = 'inherit.missing'
30 @@ -493,7 +496,7 @@ class InheritEclass(LineCheck):
31 if s:
32 self._func_call = True
33 return '%s.eclass is not inherited, but "%s" found at line: %s' % \
34 - (self._eclass, s.group(0), '%d')
35 + (self._eclass, s.group(2), '%d')
36 elif not self._func_call:
37 self._func_call = self._func_re.search(line)