From 3b9488a32d6f170387b6dfbf1985e87db556f998 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 4 Aug 2010 22:06:59 -0700 Subject: Bug #285191 - Add back the RDEPEND.implicit warning to detect the cases where DEPEND is set and RDEPEND is unset in the ebuild, since this triggers implicit RDEPEND=$DEPEND assignment (prior to EAPI 4) and is forbidden by the QA team. --- bin/repoman | 2 +- man/repoman.1 | 4 ++++ pym/repoman/checks.py | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/bin/repoman b/bin/repoman index fc184e2f1..9f64701b8 100755 --- a/bin/repoman +++ b/bin/repoman @@ -328,7 +328,7 @@ qahelp={ "IUSE.undefined":"This ebuild does not define IUSE (style guideline says to define IUSE even when empty)", "LICENSE.invalid":"This ebuild is listing a license that doesnt exist in portages license/ dir.", "KEYWORDS.invalid":"This ebuild contains KEYWORDS that are not listed in profiles/arch.list or for which no valid profile was found", - "RDEPEND.implicit":"RDEPEND is unset in the ebuild which triggers implicit RDEPEND=$DEPEND assignment", + "RDEPEND.implicit":"RDEPEND is unset in the ebuild which triggers implicit RDEPEND=$DEPEND assignment (prior to EAPI 4)", "RDEPEND.suspect":"RDEPEND contains a package that usually only belongs in DEPEND.", "RESTRICT.invalid":"This ebuild contains invalid RESTRICT values.", "digest.assumed":"Existing digest must be assumed correct (Package level only)", diff --git a/man/repoman.1 b/man/repoman.1 index ce9d0ba50..ad4c74cb3 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -210,6 +210,10 @@ Masked ebuilds with RDEPEND settings (matched against *all* ebuilds) in developi .B RDEPEND.badtilde RDEPEND uses the ~ dep operator with a non-zero revision part, which is useless (the revision is ignored) .TP +.B RDEPEND.implicit +RDEPEND is unset in the ebuild which triggers implicit RDEPEND=$DEPEND +assignment (prior to EAPI 4) +.TP .B RDEPEND.suspect RDEPEND contains a package that usually only belongs in DEPEND .TP diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index 5588fa867..7e76bf782 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -324,6 +324,39 @@ class EprefixifyDefined(LineCheck): elif self._inherit_prefix_re.search(line) is not None: self._prefix_inherited = True +class ImplicitRuntimeDeps(LineCheck): + """ + Detect the case where DEPEND is set and RDEPEND is unset in the ebuild, + since this triggers implicit RDEPEND=$DEPEND assignment (prior to EAPI 4). + """ + + repoman_check_name = 'RDEPEND.implicit' + _assignment_re = re.compile(r'^\s*(R?DEPEND)=') + + def new(self, pkg): + self._rdepend = False + self._depend = False + + def check_eapi(self, eapi): + # Beginning with EAPI 4, there is no + # implicit RDEPEND=$DEPEND assignment + # to be concerned with. + return eapi in ('0', '1', '2', '3') + + def check(self, num, line): + if not self._rdepend: + m = self._assignment_re.match(line) + if m is None: + pass + elif m.group(1) == "RDEPEND": + self._rdepend = True + elif m.group(1) == "DEPEND": + self._depend = True + + def end(self): + if self._depend and not self._rdepend: + yield 'RDEPEND is not explicitly assigned' + class InheritAutotools(LineCheck): """ Make sure appropriate functions are called in @@ -512,7 +545,7 @@ _constant_checks = tuple((c() for c in ( EbuildAssignment, Eapi3EbuildAssignment, EbuildUselessDodoc, EbuildUselessCdS, EbuildNestedDie, EbuildPatches, EbuildQuotedA, EapiDefinition, EprefixifyDefined, - IUseUndefined, InheritAutotools, + ImplicitRuntimeDeps, InheritAutotools, IUseUndefined, EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, NoAsNeeded, DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue, SrcCompileEconf, Eapi3DeprecatedFuncs, -- cgit v1.2.3-1-g7c22