aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2017-07-15 00:19:44 +0000
committerZac Medico <zmedico@gentoo.org>2018-03-29 20:51:17 -0700
commitf3858eac537a32134cb28301e539af5b418a8116 (patch)
tree618df970fdcd95f73c36c4ff7bf0e13c5d93e3d9
parentrepoman: New linechecks module, deprecated (diff)
downloadportage-f3858eac537a32134cb28301e539af5b418a8116.tar.gz
portage-f3858eac537a32134cb28301e539af5b418a8116.tar.bz2
portage-f3858eac537a32134cb28301e539af5b418a8116.zip
repoman: New linechecks module, do
-rw-r--r--repoman/pym/repoman/modules/linechecks/do/__init__.py21
-rw-r--r--repoman/pym/repoman/modules/linechecks/do/dosym.py16
2 files changed, 37 insertions, 0 deletions
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"