1 |
commit: 8e1c57067c4556ee2c730f0722d344c52cf4888c |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jan 30 20:52:50 2011 +0000 |
4 |
Commit: Thomas Sachau <tommy <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jan 30 20:52:50 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=8e1c5706 |
7 |
|
8 |
repoman: add check for using offset vars with helpers |
9 |
|
10 |
New check: NoOffsetWithHelpers. Checks whether helper functions, such as |
11 |
dodir and insinto, are used with offset variables either referring to |
12 |
the installation image (D, ED), the alternate root location (ROOT, |
13 |
EROOT), or the offset prefix (EPREFIX). |
14 |
|
15 |
--- |
16 |
bin/repoman | 1 + |
17 |
pym/repoman/checks.py | 13 +++++++++++-- |
18 |
pym/repoman/errors.py | 3 ++- |
19 |
3 files changed, 14 insertions(+), 3 deletions(-) |
20 |
|
21 |
diff --git a/bin/repoman b/bin/repoman |
22 |
index 60c69fb..700b247 100755 |
23 |
--- a/bin/repoman |
24 |
+++ b/bin/repoman |
25 |
@@ -340,6 +340,7 @@ qahelp={ |
26 |
"ebuild.nesteddie":"Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.", |
27 |
"variable.invalidchar":"A variable contains an invalid character that is not part of the ASCII character set", |
28 |
"variable.readonly":"Assigning a readonly variable", |
29 |
+ "variable.usedwithhelpers":"Ebuild uses D, ROOT, ED, EROOT or EPREFIX with helpers", |
30 |
"LIVEVCS.stable":"This ebuild is a live checkout from a VCS but has stable keywords.", |
31 |
"LIVEVCS.unmasked":"This ebuild is a live checkout from a VCS but has keywords and is not masked in the global package.mask.", |
32 |
"IUSE.invalid":"This ebuild has a variable in IUSE that is not in the use.desc or its metadata.xml file", |
33 |
|
34 |
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py |
35 |
index baa7a38..d00e6d5 100644 |
36 |
--- a/pym/repoman/checks.py |
37 |
+++ b/pym/repoman/checks.py |
38 |
@@ -1,5 +1,5 @@ |
39 |
# repoman: Checks |
40 |
-# Copyright 2007, 2010 Gentoo Foundation |
41 |
+# Copyright 2007, 2011 Gentoo Foundation |
42 |
# Distributed under the terms of the GNU General Public License v2 |
43 |
|
44 |
"""This module contains functions used in Repoman to ascertain the quality |
45 |
@@ -327,6 +327,15 @@ class EprefixifyDefined(LineCheck): |
46 |
elif self._inherit_prefix_re.search(line) is not None: |
47 |
self._prefix_inherited = True |
48 |
|
49 |
+class NoOffsetWithHelpers(LineCheck): |
50 |
+ """ Check that the image location, the alternate root offset, and the |
51 |
+ offset prefix (D, ROOT, ED, EROOT and EPREFIX) are not used with |
52 |
+ helpers """ |
53 |
+ |
54 |
+ repoman_check_name = 'variable.usedwithhelpers' |
55 |
+ re = re.compile(r'.*\b(dodir|dohard|exeinto|insinto|into)\s+"?\$\{?(D|ROOT|ED|EROOT|EPREFIX)\}?.*') |
56 |
+ error = errors.EPREFIX_WITH_HELPERS |
57 |
+ |
58 |
class ImplicitRuntimeDeps(LineCheck): |
59 |
""" |
60 |
Detect the case where DEPEND is set and RDEPEND is unset in the ebuild, |
61 |
@@ -622,7 +631,7 @@ _constant_checks = tuple((c() for c in ( |
62 |
ImplicitRuntimeDeps, InheritAutotools, InheritDeprecated, IUseUndefined, |
63 |
EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, NoAsNeeded, |
64 |
DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue, |
65 |
- SrcCompileEconf, Eapi3DeprecatedFuncs, |
66 |
+ SrcCompileEconf, Eapi3DeprecatedFuncs, NoOffsetWithHelpers, |
67 |
Eapi4IncompatibleFuncs, Eapi4GoneVars, BuiltWithUse, |
68 |
PreserveOldLib, SandboxAddpredict))) |
69 |
|
70 |
|
71 |
diff --git a/pym/repoman/errors.py b/pym/repoman/errors.py |
72 |
index 5ad6be3..a19e8c5 100644 |
73 |
--- a/pym/repoman/errors.py |
74 |
+++ b/pym/repoman/errors.py |
75 |
@@ -1,5 +1,5 @@ |
76 |
# repoman: Error Messages |
77 |
-# Copyright 2007-2010 Gentoo Foundation |
78 |
+# Copyright 2007-2011 Gentoo Foundation |
79 |
# Distributed under the terms of the GNU General Public License v2 |
80 |
|
81 |
COPYRIGHT_ERROR = 'Invalid Gentoo Copyright on line: %d' |
82 |
@@ -20,4 +20,5 @@ NO_AS_NEEDED = 'Upstream asneeded linking bug (no-as-needed on line: %d)' |
83 |
PRESERVE_OLD_LIB = 'Upstream ABI change workaround on line: %d' |
84 |
BUILT_WITH_USE = 'built_with_use on line: %d' |
85 |
EPREFIXIFY_MISSING_INHERIT = "prefix.eclass is not inherited, but eprefixify is used on line: %d" |
86 |
+NO_OFFSET_WITH_HELPERS = "Helper function is used with D, ROOT, ED, EROOT or EPREFIX on line :%d" |
87 |
SANDBOX_ADDPREDICT = 'Ebuild calls addpredict on line: %d' |