repoman: check for deprecated eclasses
authorwired <wired@gentoo.org>
Sat, 14 Aug 2010 22:56:40 +0000 (01:56 +0300)
committerZac Medico <zmedico@gentoo.org>
Sun, 22 Aug 2010 18:59:42 +0000 (11:59 -0700)
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.

bin/repoman
man/repoman.1
pym/repoman/checks.py

index df4232516b0e217694106b968a3590aa6cfb28c8..3b28bf5be0e8dcf8fa161f2ca11fb3fb32b2e13e 100755 (executable)
@@ -285,6 +285,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",
@@ -396,6 +397,7 @@ qawarnings = set((
 "ebuild.patches",
 "file.size",
 "inherit.autotools",
+"inherit.deprecated",
 "java.eclassesnotused",
 "metadata.warning",
 "virtual.versioned",
index ad4c74cb30c9b9cee5046eea0d9a21c66a495f9c..28216d6e8bc4e68410f13fd8dcbff28d0256ef06 100644 (file)
@@ -304,6 +304,9 @@ Files in the files directory must be under 20k
 .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.
index ed30795744e52050088719ec6d81d97f9d667e70..f3ab6e4c2d9ae5885adb2365c2d26b3b063c68d1 100644 (file)
@@ -360,6 +360,35 @@ class ImplicitRuntimeDeps(LineCheck):
                if self._depend and not self._rdepend:
                        yield 'RDEPEND is not explicitly assigned'
 
+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 = {
+               "gems": "ruby-fakegem",
+               "php-pear": "php-pear-r1",
+               "qt3": 0,
+               "qt4": "qt4-r2",
+               "ruby": "ruby-ng",
+               "ruby-gnome2": "ruby-ng-gnome2"
+               }
+
+       def new(self, pkg):
+               self.matched_eclasses = frozenset(self.deprecated_classes.keys()).intersection(pkg.inherited)
+
+       def check(self, num, line):
+               pass
+
+       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
@@ -554,7 +583,7 @@ _constant_checks = tuple((c() for c in (
        EbuildAssignment, Eapi3EbuildAssignment, EbuildUselessDodoc,
        EbuildUselessCdS, EbuildNestedDie,
        EbuildPatches, EbuildQuotedA, EapiDefinition, EprefixifyDefined,
-       ImplicitRuntimeDeps, InheritAutotools, IUseUndefined,
+       ImplicitRuntimeDeps, InheritAutotools, InheritDeprecated, IUseUndefined,
        EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, NoAsNeeded,
        DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue,
        SrcCompileEconf, Eapi3DeprecatedFuncs,