commit:     5e6c14c41051daca8d01fbc0dd5b567c17ebac51
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:01:52 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 30 03:51:17 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=5e6c14c4

repoman: New linechecks module, helpers

 .../repoman/modules/linechecks/helpers/__init__.py | 21 +++++++++++++++++++++
 .../repoman/modules/linechecks/helpers/offset.py   | 22 ++++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/helpers/__init__.py 
b/repoman/pym/repoman/modules/linechecks/helpers/__init__.py
new file mode 100644
index 000000000..e2d12afe4
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/helpers/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Helpers plug-in module for repoman LineChecks.
+Performs variable helpers checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+       'name': 'do',
+       'description': doc,
+       'provides':{
+               'nooffset-check': {
+                       'name': "nooffset",
+                       'sourcefile': "offset",
+                       'class': "NoOffsetWithHelpers",
+                       'description': doc,
+               },
+       }
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/helpers/offset.py 
b/repoman/pym/repoman/modules/linechecks/helpers/offset.py
new file mode 100644
index 000000000..5d7624a68
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/helpers/offset.py
@@ -0,0 +1,22 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class NoOffsetWithHelpers(LineCheck):
+       """ Check that the image location, the alternate root offset, and the
+       offset prefix (D, ROOT, ED, EROOT and EPREFIX) are not used with
+       helpers """
+
+       repoman_check_name = 'variable.usedwithhelpers'
+       # Ignore matches in quoted strings like this:
+       # elog "installed into ${ROOT}usr/share/php5/apc/."
+       _install_funcs = (
+               'docinto|do(compress|dir|hard)'
+               '|exeinto|fowners|fperms|insinto|into')
+       _quoted_vars = 'D|ROOT|ED|EROOT|EPREFIX'
+       re = re.compile(
+               r'^[^#"\']*\b(%s)\s+"?\$\{?(%s)\b.*' %
+               (_install_funcs, _quoted_vars))
+       error = 'NO_OFFSET_WITH_HELPERS'

Reply via email to