1 |
Author: zmedico |
2 |
Date: 2009-04-29 19:57:46 +0000 (Wed, 29 Apr 2009) |
3 |
New Revision: 13413 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/repoman/checks.py |
7 |
Log: |
8 |
Warn about sed and epatch calls which should be moved from src_unpack to |
9 |
src_prepare. Thanks to Markus Meier <maekke@g.o> for the initial patch. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/repoman/checks.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/repoman/checks.py 2009-04-29 19:13:15 UTC (rev 13412) |
15 |
+++ main/trunk/pym/repoman/checks.py 2009-04-29 19:57:46 UTC (rev 13413) |
16 |
@@ -229,6 +229,38 @@ |
17 |
elif self.inherit_re.match(line) is not None: |
18 |
self.inherit_line = line |
19 |
|
20 |
+class SrcUnpackPatches(LineCheck): |
21 |
+ repoman_check_name = 'ebuild.minorsyn' |
22 |
+ |
23 |
+ src_unpack_re = re.compile(r'^src_unpack\(\)') |
24 |
+ func_end_re = re.compile(r'^\}$') |
25 |
+ src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s') |
26 |
+ |
27 |
+ def new(self, pkg): |
28 |
+ if pkg.metadata['EAPI'] not in ('0', '1'): |
29 |
+ self.eapi = pkg.metadata['EAPI'] |
30 |
+ else: |
31 |
+ self.eapi = None |
32 |
+ self.in_src_unpack = None |
33 |
+ |
34 |
+ def check(self, num, line): |
35 |
+ |
36 |
+ if self.eapi is not None: |
37 |
+ |
38 |
+ if self.in_src_unpack is None and \ |
39 |
+ self.src_unpack_re.match(line) is not None: |
40 |
+ self.in_src_unpack = True |
41 |
+ |
42 |
+ if self.in_src_unpack is True and \ |
43 |
+ self.func_end_re.match(line) is not None: |
44 |
+ self.in_src_unpack = False |
45 |
+ |
46 |
+ if self.in_src_unpack: |
47 |
+ m = self.src_prepare_tools_re.search(line) |
48 |
+ if m is not None: |
49 |
+ return ("'%s'" % m.group(1)) + \ |
50 |
+ " call should be moved to src_prepare from line: %d" |
51 |
+ |
52 |
class EbuildPatches(LineCheck): |
53 |
"""Ensure ebuilds use bash arrays for PATCHES to ensure white space safety""" |
54 |
repoman_check_name = 'ebuild.patches' |
55 |
@@ -368,7 +400,7 @@ |
56 |
EbuildPatches, EbuildQuotedA, EapiDefinition, |
57 |
IUseUndefined, ImplicitRuntimeDeps, InheritAutotools, |
58 |
EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, |
59 |
- DeprecatedBindnowFlags, WantAutoDefaultValue))) |
60 |
+ DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue))) |
61 |
|
62 |
_here_doc_re = re.compile(r'.*\s<<[-]?(\w+)$') |