aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2017-07-15 01:01:52 +0000
committerZac Medico <zmedico@gentoo.org>2018-03-29 20:51:17 -0700
commit5e6c14c41051daca8d01fbc0dd5b567c17ebac51 (patch)
tree73a48106468635c030d7efa1bc89fdd66103a510
parentrepoman: New linechecks module, gentoo_header (diff)
downloadportage-5e6c14c4.tar.gz
portage-5e6c14c4.tar.bz2
portage-5e6c14c4.zip
repoman: New linechecks module, helpers
-rw-r--r--repoman/pym/repoman/modules/linechecks/helpers/__init__.py21
-rw-r--r--repoman/pym/repoman/modules/linechecks/helpers/offset.py22
2 files changed, 43 insertions, 0 deletions
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'