commit: 34ba50bbdad52d0a8edb1ee6d3b31665fdba7a28
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 00:19:44 2017 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Nov 26 17:32:18 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=34ba50bb
repoman: New linechecks module, do
.../pym/repoman/modules/linechecks/do/__init__.py | 21 +++++++++++++++++++++
repoman/pym/repoman/modules/linechecks/do/dosym.py | 16 ++++++++++++++++
2 files changed, 37 insertions(+)
diff --git a/repoman/pym/repoman/modules/linechecks/do/__init__.py
b/repoman/pym/repoman/modules/linechecks/do/__init__.py
new file mode 100644
index 000000000..a56204794
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/do/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Do plug-in module for repoman LineChecks.
+Performs do* checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+ 'name': 'do',
+ 'description': doc,
+ 'provides':{
+ 'nonrelative-check': {
+ 'name': "dosym",
+ 'sourcefile': "dosym",
+ 'class': "EbuildNonRelativeDosym",
+ 'description': doc,
+ },
+ }
+}
+
diff --git a/repoman/pym/repoman/modules/linechecks/do/dosym.py
b/repoman/pym/repoman/modules/linechecks/do/dosym.py
new file mode 100644
index 000000000..bab4dad03
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/do/dosym.py
@@ -0,0 +1,16 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+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"