1 |
Author: volkmar |
2 |
Date: 2009-10-04 14:06:18 +0000 (Sun, 04 Oct 2009) |
3 |
New Revision: 14489 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/repoman/checks.py |
7 |
Log: |
8 |
Restrict upstream.workaround to src_compile and src_install as much as possible. |
9 |
Prevent warnings when using emake -j1 in src_test which is recommanded. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/repoman/checks.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/repoman/checks.py 2009-10-04 09:00:03 UTC (rev 14488) |
15 |
+++ main/trunk/pym/repoman/checks.py 2009-10-04 14:06:18 UTC (rev 14489) |
16 |
@@ -30,6 +30,36 @@ |
17 |
def end(self): |
18 |
pass |
19 |
|
20 |
+class PhaseCheck(LineCheck): |
21 |
+ """ basic class for function detection """ |
22 |
+ |
23 |
+ ignore_line = re.compile(r'(^\s*#)') |
24 |
+ func_end_re = re.compile(r'^\}$') |
25 |
+ in_phase = '' |
26 |
+ |
27 |
+ def __init__(self): |
28 |
+ self.phases = ('pkg_setup', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'pkg_pretend', |
29 |
+ 'src_unpack', 'src_prepare', 'src_compile', 'src_test', 'src_install') |
30 |
+ phase_re = '(' |
31 |
+ for phase in self.phases: |
32 |
+ phase_re += phase + '|' |
33 |
+ phase_re = phase_re[:-1] + ')' |
34 |
+ self.phases_re = re.compile(phase_re) |
35 |
+ |
36 |
+ def check(self, num, line): |
37 |
+ m = self.phases_re.match(line) |
38 |
+ if m is not None: |
39 |
+ self.in_phase = m.group(1) |
40 |
+ if self.in_phase != '' and \ |
41 |
+ self.func_end_re.match(line) is not None: |
42 |
+ self.in_phase = '' |
43 |
+ |
44 |
+ return self.phase_check(num, line) |
45 |
+ |
46 |
+ def phase_check(self, num, line): |
47 |
+ """ override this function for your checks """ |
48 |
+ pass |
49 |
+ |
50 |
class EbuildHeader(LineCheck): |
51 |
"""Ensure ebuilds have proper headers |
52 |
Copyright header errors |
53 |
@@ -327,12 +357,17 @@ |
54 |
if self._iuse_def is None: |
55 |
yield 'IUSE is not defined' |
56 |
|
57 |
-class EMakeParallelDisabled(LineCheck): |
58 |
+class EMakeParallelDisabled(PhaseCheck): |
59 |
"""Check for emake -j1 calls which disable parallelization.""" |
60 |
repoman_check_name = 'upstream.workaround' |
61 |
re = re.compile(r'^\s*emake\s+.*-j\s*1\b') |
62 |
error = errors.EMAKE_PARALLEL_DISABLED |
63 |
|
64 |
+ def phase_check(self, num, line): |
65 |
+ if self.in_phase == 'src_compile' or self.in_phase == 'src_install': |
66 |
+ if self.re.match(line): |
67 |
+ return self.error |
68 |
+ |
69 |
class EMakeParallelDisabledViaMAKEOPTS(LineCheck): |
70 |
"""Check for MAKEOPTS=-j1 that disables parallelization.""" |
71 |
repoman_check_name = 'upstream.workaround' |
72 |
@@ -356,36 +391,6 @@ |
73 |
return 'WANT_AUTO' + m.group(1) + \ |
74 |
' redundantly set to default value "latest" on line: %d' |
75 |
|
76 |
-class PhaseCheck(LineCheck): |
77 |
- """ basic class for function detection """ |
78 |
- |
79 |
- ignore_line = re.compile(r'(^\s*#)') |
80 |
- func_end_re = re.compile(r'^\}$') |
81 |
- in_phase = '' |
82 |
- |
83 |
- def __init__(self): |
84 |
- self.phases = ('pkg_setup', 'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm', 'pkg_pretend', |
85 |
- 'src_unpack', 'src_prepare', 'src_compile', 'src_test', 'src_install') |
86 |
- phase_re = '(' |
87 |
- for phase in self.phases: |
88 |
- phase_re += phase + '|' |
89 |
- phase_re = phase_re[:-1] + ')' |
90 |
- self.phases_re = re.compile(phase_re) |
91 |
- |
92 |
- def check(self, num, line): |
93 |
- m = self.phases_re.match(line) |
94 |
- if m is not None: |
95 |
- self.in_phase = m.group(1) |
96 |
- if self.in_phase != '' and \ |
97 |
- self.func_end_re.match(line) is not None: |
98 |
- self.in_phase = '' |
99 |
- |
100 |
- return self.phase_check(num, line) |
101 |
- |
102 |
- def phase_check(self, num, line): |
103 |
- """ override this function for your checks """ |
104 |
- pass |
105 |
- |
106 |
class SrcCompileEconf(PhaseCheck): |
107 |
repoman_check_name = 'ebuild.minorsyn' |
108 |
configure_re = re.compile(r'\s(econf|./configure)') |