From: Fabian Groffen Date: Wed, 26 Jan 2011 21:15:46 +0000 (+0100) Subject: repoman: add check for using EPREFIX with helpers X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dd912b0bd99842436d28580f2b378b7911a893df;p=portage.git repoman: add check for using EPREFIX with helpers Bail when ED, EROOT or EPREFIX is being used with dodir, dohard, exeinto, insinto or into. These helper functions are commonly used with paths, but should not be mistaken by developers to accept the offset prefix. (nor ROOT or D, but that is not checked) --- diff --git a/bin/repoman b/bin/repoman index d87e23a0a..b5c7444fe 100755 --- a/bin/repoman +++ b/bin/repoman @@ -296,6 +296,7 @@ qahelp={ "inherit.autotools":"Ebuild inherits autotools but does not call eautomake, eautoconf or eautoreconf", "inherit.deprecated":"Ebuild inherits a deprecated eclass", "java.eclassesnotused":"With virtual/jdk in DEPEND you must inherit a java eclass", + "prefix.usedwithhelpers":"Ebuild uses ED or EPREFIX with helpers (doins)", "wxwidgets.eclassnotused":"Ebuild DEPENDs on x11-libs/wxGTK without inheriting wxwidgets.eclass", "KEYWORDS.dropped":"Ebuilds that appear to have dropped KEYWORDS for some arch", "KEYWORDS.missing":"Ebuilds that have a missing or empty KEYWORDS variable", diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index baa7a3812..cf364ca7e 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -327,6 +327,13 @@ class EprefixifyDefined(LineCheck): elif self._inherit_prefix_re.search(line) is not None: self._prefix_inherited = True +class EprefixWithHelpers(LineCheck): + """ Check that ED, EROOT and EPREFIX aren't used with helpers (doins) """ + + repoman_check_name = 'prefix.usedwithhelpers' + re = re.compile(r'.*\b(dodir|dohard|exeinto|insinto|into)\s+"?\$\{?(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 +629,7 @@ _constant_checks = tuple((c() for c in ( ImplicitRuntimeDeps, InheritAutotools, InheritDeprecated, IUseUndefined, EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, NoAsNeeded, DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue, - SrcCompileEconf, Eapi3DeprecatedFuncs, + SrcCompileEconf, Eapi3DeprecatedFuncs, EprefixWithHelpers, Eapi4IncompatibleFuncs, Eapi4GoneVars, BuiltWithUse, PreserveOldLib, SandboxAddpredict))) diff --git a/pym/repoman/errors.py b/pym/repoman/errors.py index 5ad6be31f..530b42fc9 100644 --- a/pym/repoman/errors.py +++ b/pym/repoman/errors.py @@ -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" +EPREFIX_WITH_HELPERS = "Helper function is used with ED, EROOT or ERPREFIX on line :%d" SANDBOX_ADDPREDICT = 'Ebuild calls addpredict on line: %d'