commit: 3a18df10ae0c81f1b5092b0f40f559b9d6183306 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: Sat Jul 15 02:25:44 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3a18df10
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"