summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2011-01-30 21:52:50 +0100
committerFabian Groffen <grobian@gentoo.org>2011-01-30 21:52:50 +0100
commit8e1c57067c4556ee2c730f0722d344c52cf4888c (patch)
tree38abff2a89ab194ab96fd068751b000f19198878
parentf3d72b4418d19cae39d3c327699d244bbfad6461 (diff)
downloadportage-8e1c57067c4556ee2c730f0722d344c52cf4888c.tar.gz
portage-8e1c57067c4556ee2c730f0722d344c52cf4888c.tar.bz2
portage-8e1c57067c4556ee2c730f0722d344c52cf4888c.zip
repoman: add check for using offset vars with helpers
New check: NoOffsetWithHelpers. Checks whether helper functions, such as dodir and insinto, are used with offset variables either referring to the installation image (D, ED), the alternate root location (ROOT, EROOT), or the offset prefix (EPREFIX).
-rwxr-xr-xbin/repoman1
-rw-r--r--pym/repoman/checks.py13
-rw-r--r--pym/repoman/errors.py3
3 files changed, 14 insertions, 3 deletions
diff --git a/bin/repoman b/bin/repoman
index 60c69fb59..700b247a1 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -340,6 +340,7 @@ qahelp={
"ebuild.nesteddie":"Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.",
"variable.invalidchar":"A variable contains an invalid character that is not part of the ASCII character set",
"variable.readonly":"Assigning a readonly variable",
+ "variable.usedwithhelpers":"Ebuild uses D, ROOT, ED, EROOT or EPREFIX with helpers",
"LIVEVCS.stable":"This ebuild is a live checkout from a VCS but has stable keywords.",
"LIVEVCS.unmasked":"This ebuild is a live checkout from a VCS but has keywords and is not masked in the global package.mask.",
"IUSE.invalid":"This ebuild has a variable in IUSE that is not in the use.desc or its metadata.xml file",
diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py
index baa7a3812..d00e6d59d 100644
--- a/pym/repoman/checks.py
+++ b/pym/repoman/checks.py
@@ -1,5 +1,5 @@
# repoman: Checks
-# Copyright 2007, 2010 Gentoo Foundation
+# Copyright 2007, 2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
"""This module contains functions used in Repoman to ascertain the quality
@@ -327,6 +327,15 @@ class EprefixifyDefined(LineCheck):
elif self._inherit_prefix_re.search(line) is not None:
self._prefix_inherited = True
+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'
+ re = re.compile(r'.*\b(dodir|dohard|exeinto|insinto|into)\s+"?\$\{?(D|ROOT|ED|EROOT|EPREFIX)\}?.*')
+ error = errors.EPREFIX_WITH_HELPERS
+
class ImplicitRuntimeDeps(LineCheck):
"""
Detect the case where DEPEND is set and RDEPEND is unset in the ebuild,
@@ -622,7 +631,7 @@ _constant_checks = tuple((c() for c in (
ImplicitRuntimeDeps, InheritAutotools, InheritDeprecated, IUseUndefined,
EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, NoAsNeeded,
DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue,
- SrcCompileEconf, Eapi3DeprecatedFuncs,
+ SrcCompileEconf, Eapi3DeprecatedFuncs, NoOffsetWithHelpers,
Eapi4IncompatibleFuncs, Eapi4GoneVars, BuiltWithUse,
PreserveOldLib, SandboxAddpredict)))
diff --git a/pym/repoman/errors.py b/pym/repoman/errors.py
index 5ad6be31f..a19e8c5c0 100644
--- a/pym/repoman/errors.py
+++ b/pym/repoman/errors.py
@@ -1,5 +1,5 @@
# repoman: Error Messages
-# Copyright 2007-2010 Gentoo Foundation
+# Copyright 2007-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
COPYRIGHT_ERROR = 'Invalid Gentoo Copyright on line: %d'
@@ -20,4 +20,5 @@ NO_AS_NEEDED = 'Upstream asneeded linking bug (no-as-needed on line: %d)'
PRESERVE_OLD_LIB = 'Upstream ABI change workaround on line: %d'
BUILT_WITH_USE = 'built_with_use on line: %d'
EPREFIXIFY_MISSING_INHERIT = "prefix.eclass is not inherited, but eprefixify is used on line: %d"
+NO_OFFSET_WITH_HELPERS = "Helper function is used with D, ROOT, ED, EROOT or EPREFIX on line :%d"
SANDBOX_ADDPREDICT = 'Ebuild calls addpredict on line: %d'