* [gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/, repoman/man/, repoman/pym/repoman/modules/scan/ebuild/
@ 2017-04-20 20:40 Michał Górny
0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2017-04-20 20:40 UTC (permalink / raw
To: gentoo-commits
commit: 674ed22900df3e6a2054adb1b49f3e0fddbd64b2
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 15 10:43:13 2017 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Apr 20 20:38:48 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=674ed229
repoman: Add a check for relative dosym candidates
Add a check for dosym with target path matching absolute paths
controlled by the package manager, e.g. /bin, /etc...
Example output:
ebuild.absdosym 5
app-editors/nano/nano-2.5.3.ebuild: dosym '/bin/nano'... could use relative path on line: 81
Approved-by: Brian Dolbec <dolsen <AT> gentoo.org> (on IRC)
repoman/man/repoman.1 | 4 ++++
repoman/pym/repoman/modules/scan/ebuild/checks.py | 13 +++++++++++++
repoman/pym/repoman/qa_data.py | 4 ++++
3 files changed, 21 insertions(+)
diff --git a/repoman/man/repoman.1 b/repoman/man/repoman.1
index 9b106906f..78e4b7275 100644
--- a/repoman/man/repoman.1
+++ b/repoman/man/repoman.1
@@ -292,6 +292,10 @@ Some files listed in SRC_URI aren't referenced in the Manifest
.B digest.unused
Some files listed in the Manifest aren't referenced in SRC_URI
.TP
+.B ebuild.absdosym
+Ebuild uses 'dosym' with explicit absolute path where relative path
+could be used
+.TP
.B ebuild.badheader
This ebuild has a malformed header
.TP
diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py b/repoman/pym/repoman/modules/scan/ebuild/checks.py
index db6b6c8b4..e6e5d78ba 100644
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py
+++ b/repoman/pym/repoman/modules/scan/ebuild/checks.py
@@ -911,6 +911,19 @@ class PortageInternalVariableAssignment(LineCheck):
e += ' on line: %d'
return e
+
+class EbuildNonRelativeDosym(LineCheck):
+ """Check ebuild for dosym using absolute paths instead of relative."""
+ repoman_check_name = 'ebuild.absdosym'
+ regex = re.compile(
+ r'^\s*dosym\s+["\']?(/(bin|etc|lib|opt|sbin|srv|usr|var)\S*)')
+
+ def check(self, num, line):
+ match = self.regex.match(line)
+ if match:
+ return "dosym '%s'... could use relative path" % (match.group(1), ) + " on line: %d"
+
+
_base_check_classes = (InheritEclass, LineCheck, PhaseCheck)
_constant_checks = None
diff --git a/repoman/pym/repoman/qa_data.py b/repoman/pym/repoman/qa_data.py
index 132a55be3..a59fed778 100644
--- a/repoman/pym/repoman/qa_data.py
+++ b/repoman/pym/repoman/qa_data.py
@@ -195,6 +195,9 @@ qahelp = {
"Some files listed in SRC_URI aren't referenced in the Manifest"),
"digest.unused": (
"Some files listed in the Manifest aren't referenced in SRC_URI"),
+ "ebuild.absdosym": (
+ "This ebuild uses absolute target to dosym where relative symlink"
+ " could be used instead"),
"ebuild.majorsyn": (
"This ebuild has a major syntax error"
" that may cause the ebuild to fail partially or fully"),
@@ -262,6 +265,7 @@ qawarnings = set((
"RDEPEND.suspect",
"virtual.suspect",
"RESTRICT.invalid",
+ "ebuild.absdosym",
"ebuild.minorsyn",
"ebuild.badheader",
"ebuild.patches",
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-04-20 20:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-20 20:40 [gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/, repoman/man/, repoman/pym/repoman/modules/scan/ebuild/ Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox