1 |
Add a check for dosym with target path matching absolute paths |
2 |
controlled by the package manager, e.g. /bin, /etc... |
3 |
|
4 |
Example output: |
5 |
|
6 |
ebuild.absdosym 5 |
7 |
app-editors/nano/nano-2.5.3.ebuild: dosym '/bin/nano'... could use relative path on line: 81 |
8 |
--- |
9 |
repoman/man/repoman.1 | 4 ++++ |
10 |
repoman/pym/repoman/modules/scan/ebuild/checks.py | 13 +++++++++++++ |
11 |
repoman/pym/repoman/qa_data.py | 4 ++++ |
12 |
3 files changed, 21 insertions(+) |
13 |
|
14 |
diff --git a/repoman/man/repoman.1 b/repoman/man/repoman.1 |
15 |
index 9b106906f..78e4b7275 100644 |
16 |
--- a/repoman/man/repoman.1 |
17 |
+++ b/repoman/man/repoman.1 |
18 |
@@ -292,6 +292,10 @@ Some files listed in SRC_URI aren't referenced in the Manifest |
19 |
.B digest.unused |
20 |
Some files listed in the Manifest aren't referenced in SRC_URI |
21 |
.TP |
22 |
+.B ebuild.absdosym |
23 |
+Ebuild uses 'dosym' with explicit absolute path where relative path |
24 |
+could be used |
25 |
+.TP |
26 |
.B ebuild.badheader |
27 |
This ebuild has a malformed header |
28 |
.TP |
29 |
diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py b/repoman/pym/repoman/modules/scan/ebuild/checks.py |
30 |
index db6b6c8b4..e6e5d78ba 100644 |
31 |
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py |
32 |
+++ b/repoman/pym/repoman/modules/scan/ebuild/checks.py |
33 |
@@ -911,6 +911,19 @@ class PortageInternalVariableAssignment(LineCheck): |
34 |
e += ' on line: %d' |
35 |
return e |
36 |
|
37 |
+ |
38 |
+class EbuildNonRelativeDosym(LineCheck): |
39 |
+ """Check ebuild for dosym using absolute paths instead of relative.""" |
40 |
+ repoman_check_name = 'ebuild.absdosym' |
41 |
+ regex = re.compile( |
42 |
+ r'^\s*dosym\s+["\']?(/(bin|etc|lib|opt|sbin|srv|usr|var)\S*)') |
43 |
+ |
44 |
+ def check(self, num, line): |
45 |
+ match = self.regex.match(line) |
46 |
+ if match: |
47 |
+ return "dosym '%s'... could use relative path" % (match.group(1), ) + " on line: %d" |
48 |
+ |
49 |
+ |
50 |
_base_check_classes = (InheritEclass, LineCheck, PhaseCheck) |
51 |
_constant_checks = None |
52 |
|
53 |
diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py |
54 |
index 132a55be3..a59fed778 100644 |
55 |
--- a/repoman/pym/repoman/qa_data.py |
56 |
+++ b/repoman/pym/repoman/qa_data.py |
57 |
@@ -195,6 +195,9 @@ qahelp = { |
58 |
"Some files listed in SRC_URI aren't referenced in the Manifest"), |
59 |
"digest.unused": ( |
60 |
"Some files listed in the Manifest aren't referenced in SRC_URI"), |
61 |
+ "ebuild.absdosym": ( |
62 |
+ "This ebuild uses absolute target to dosym where relative symlink" |
63 |
+ " could be used instead"), |
64 |
"ebuild.majorsyn": ( |
65 |
"This ebuild has a major syntax error" |
66 |
" that may cause the ebuild to fail partially or fully"), |
67 |
@@ -262,6 +265,7 @@ qawarnings = set(( |
68 |
"RDEPEND.suspect", |
69 |
"virtual.suspect", |
70 |
"RESTRICT.invalid", |
71 |
+ "ebuild.absdosym", |
72 |
"ebuild.minorsyn", |
73 |
"ebuild.badheader", |
74 |
"ebuild.patches", |
75 |
-- |
76 |
2.12.2 |