1 |
commit: faabe3297ec32e9b4a12cd622aab0280693f264d |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Jul 15 01:01:52 2017 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 11 16:13:15 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=faabe329 |
7 |
|
8 |
repoman: New linechecks module, helpers |
9 |
|
10 |
.../repoman/modules/linechecks/helpers/__init__.py | 21 +++++++++++++++++++++ |
11 |
.../repoman/modules/linechecks/helpers/offset.py | 22 ++++++++++++++++++++++ |
12 |
2 files changed, 43 insertions(+) |
13 |
|
14 |
diff --git a/repoman/pym/repoman/modules/linechecks/helpers/__init__.py b/repoman/pym/repoman/modules/linechecks/helpers/__init__.py |
15 |
new file mode 100644 |
16 |
index 000000000..e2d12afe4 |
17 |
--- /dev/null |
18 |
+++ b/repoman/pym/repoman/modules/linechecks/helpers/__init__.py |
19 |
@@ -0,0 +1,21 @@ |
20 |
+# Copyright 2015-2016 Gentoo Foundation |
21 |
+# Distributed under the terms of the GNU General Public License v2 |
22 |
+ |
23 |
+doc = """Helpers plug-in module for repoman LineChecks. |
24 |
+Performs variable helpers checks on ebuilds.""" |
25 |
+__doc__ = doc[:] |
26 |
+ |
27 |
+ |
28 |
+module_spec = { |
29 |
+ 'name': 'do', |
30 |
+ 'description': doc, |
31 |
+ 'provides':{ |
32 |
+ 'nooffset-check': { |
33 |
+ 'name': "nooffset", |
34 |
+ 'sourcefile': "offset", |
35 |
+ 'class': "NoOffsetWithHelpers", |
36 |
+ 'description': doc, |
37 |
+ }, |
38 |
+ } |
39 |
+} |
40 |
+ |
41 |
|
42 |
diff --git a/repoman/pym/repoman/modules/linechecks/helpers/offset.py b/repoman/pym/repoman/modules/linechecks/helpers/offset.py |
43 |
new file mode 100644 |
44 |
index 000000000..5d7624a68 |
45 |
--- /dev/null |
46 |
+++ b/repoman/pym/repoman/modules/linechecks/helpers/offset.py |
47 |
@@ -0,0 +1,22 @@ |
48 |
+ |
49 |
+import re |
50 |
+ |
51 |
+from repoman.modules.linechecks.base import LineCheck |
52 |
+ |
53 |
+ |
54 |
+class NoOffsetWithHelpers(LineCheck): |
55 |
+ """ Check that the image location, the alternate root offset, and the |
56 |
+ offset prefix (D, ROOT, ED, EROOT and EPREFIX) are not used with |
57 |
+ helpers """ |
58 |
+ |
59 |
+ repoman_check_name = 'variable.usedwithhelpers' |
60 |
+ # Ignore matches in quoted strings like this: |
61 |
+ # elog "installed into ${ROOT}usr/share/php5/apc/." |
62 |
+ _install_funcs = ( |
63 |
+ 'docinto|do(compress|dir|hard)' |
64 |
+ '|exeinto|fowners|fperms|insinto|into') |
65 |
+ _quoted_vars = 'D|ROOT|ED|EROOT|EPREFIX' |
66 |
+ re = re.compile( |
67 |
+ r'^[^#"\']*\b(%s)\s+"?\$\{?(%s)\b.*' % |
68 |
+ (_install_funcs, _quoted_vars)) |
69 |
+ error = 'NO_OFFSET_WITH_HELPERS' |