Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH] repoman: Add a check for relative dosym candidates
Date: Sat, 15 Apr 2017 11:05:59
Message-Id: 20170415110456.19598-1-mgorny@gentoo.org
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 | 2 +-
11 repoman/pym/repoman/qa_data.py | 4 ++++
12 3 files changed, 9 insertions(+), 1 deletion(-)
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 57c8b10a5..e6e5d78ba 100644
31 --- a/repoman/pym/repoman/modules/scan/ebuild/checks.py
32 +++ b/repoman/pym/repoman/modules/scan/ebuild/checks.py
33 @@ -921,7 +921,7 @@ class EbuildNonRelativeDosym(LineCheck):
34 def check(self, num, line):
35 match = self.regex.match(line)
36 if match:
37 - return "dosym '%s' could use relative path" % (match.group(1), ) + " on line: %d"
38 + return "dosym '%s'... could use relative path" % (match.group(1), ) + " on line: %d"
39
40
41 _base_check_classes = (InheritEclass, LineCheck, PhaseCheck)
42 diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
43 index 132a55be3..a59fed778 100644
44 --- a/repoman/pym/repoman/qa_data.py
45 +++ b/repoman/pym/repoman/qa_data.py
46 @@ -195,6 +195,9 @@ qahelp = {
47 "Some files listed in SRC_URI aren't referenced in the Manifest"),
48 "digest.unused": (
49 "Some files listed in the Manifest aren't referenced in SRC_URI"),
50 + "ebuild.absdosym": (
51 + "This ebuild uses absolute target to dosym where relative symlink"
52 + " could be used instead"),
53 "ebuild.majorsyn": (
54 "This ebuild has a major syntax error"
55 " that may cause the ebuild to fail partially or fully"),
56 @@ -262,6 +265,7 @@ qawarnings = set((
57 "RDEPEND.suspect",
58 "virtual.suspect",
59 "RESTRICT.invalid",
60 + "ebuild.absdosym",
61 "ebuild.minorsyn",
62 "ebuild.badheader",
63 "ebuild.patches",
64 --
65 2.12.2

Replies