From e966e570c933de80863f093e7436e18e6c905e10 Mon Sep 17 00:00:00 2001 From: wired Date: Fri, 25 Jun 2010 09:54:35 +0300 Subject: [PATCH] repoman: check for deprecated eclasses compare the inherited eclasses to a list of deprecated eclasses. print QA warnings for each deprecated eclass found and suggest an alternative for those that have one. first eclass we need to migrate away from (and the reason I wrote this): qt4 it should be replaced by: qt4-r2 --- bin/repoman | 2 ++ man/repoman.1 | 3 +++ pym/repoman/checks.py | 26 +++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletions(-) diff --git a/bin/repoman b/bin/repoman index f9fdc74..733e300 100755 --- a/bin/repoman +++ b/bin/repoman @@ -279,6 +279,7 @@ qahelp={ "file.name":"File/dir name must be composed of only the following chars: %s " % allowed_filename_chars, "file.UTF8":"File is not UTF8 compliant", "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", "KEYWORDS.dropped":"Ebuilds that appear to have dropped KEYWORDS for some arch", "KEYWORDS.missing":"Ebuilds that have a missing or empty KEYWORDS variable", @@ -387,6 +388,7 @@ qawarnings = set(( "ebuild.patches", "file.size", "inherit.autotools", +"inherit.deprecated", "java.eclassesnotused", "metadata.warning", "virtual.versioned", diff --git a/man/repoman.1 b/man/repoman.1 index 9d8f299..8abb8b5 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -294,6 +294,9 @@ Package lacks a files directory .B inherit.autotools Ebuild inherits autotools but does not call eautomake, eautoconf or eautoreconf .TP +.B inherit.deprecated +Ebuild inherits a deprecated eclass +.TP .B java.eclassesnotused With virtual/jdk in DEPEND you must inherit a java eclass. Refer to \fIhttp://www.gentoo.org/proj/en/java/java\-devel.xml\fR for more information. diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index 79ba892..c18d7a1 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -294,6 +294,30 @@ class EbuildQuotedA(LineCheck): if match: return "Quoted \"${A}\" on line: %d" +class InheritDeprecated(LineCheck): + """Check if ebuild inherits a deprecated eclass""" + + repoman_check_name = 'inherit.deprecated' + + # deprecated eclass : new eclass (0 if no new eclass) + deprecated_classes = { + "qt4": "qt4-r2" + } + + def new(self, pkg): + self.matched_eclasses = frozenset(self.deprecated_classes.keys()).intersection(pkg.inherited); + + def check(self, num, line): + if not self.matched_eclasses: + return + + def end(self): + for i in self.matched_eclasses: + if self.deprecated_classes[i] == 0: + yield i + ": deprecated eclass" + else: + yield "uses deprecated eclass '"+i+"'. please migrate to '"+self.deprecated_classes[i]+"'" + class InheritAutotools(LineCheck): """ Make sure appropriate functions are called in @@ -492,7 +516,7 @@ _constant_checks = tuple((c() for c in ( EbuildAssignment, EbuildUselessDodoc, EbuildUselessCdS, EbuildNestedDie, EbuildPatches, EbuildQuotedA, EapiDefinition, - IUseUndefined, InheritAutotools, + IUseUndefined, InheritAutotools, InheritDeprecated, EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, NoAsNeeded, DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue, SrcCompileEconf, Eapi3DeprecatedFuncs, -- 1.7.1