repoman: add 'VIRTUAL.suspect' class of warnings
authorSergei Trofimovich <slyfox@gentoo.org>
Sun, 17 Jun 2012 08:42:51 +0000 (11:42 +0300)
committerZac Medico <zmedico@gentoo.org>
Sun, 17 Jun 2012 15:45:01 +0000 (08:45 -0700)
Searches all the *DEPENDS against static
map of:
    { 'package' : 'virtual' }

Example output:

>  VIRTUAL.suspect               1
>   dev-haskell/cabal/cabal-1.15.0_pre20120608.ebuild: consider using 'virtual/pkgconfig' insted of 'dev-util/pkgconf'

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
bin/repoman
man/repoman.1

index 7204f50dc751bc19810bfb4606f86a51ca98197f..795c7ce77123fe1c84af9dfba2b82e973a0cbf99 100755 (executable)
@@ -393,6 +393,7 @@ qahelp={
        "metadata.warning":"Warnings in metadata.xml files",
        "portage.internal":"The ebuild uses an internal Portage function",
        "virtual.oldstyle":"The ebuild PROVIDEs an old-style virtual (see GLEP 37)",
+       "virtual.suspect":"Ebuild contains a package that usually should be pulled via virtual/, not directly.",
        "usage.obsolete":"The ebuild makes use of an obsolete construct",
        "upstream.workaround":"The ebuild works around an upstream bug, an upstream bug should be filed and tracked in bugs.gentoo.org"
 }
@@ -424,6 +425,7 @@ qawarnings = set((
 "PDEPEND.suspect",
 "RDEPEND.implicit",
 "RDEPEND.suspect",
+"virtual.suspect",
 "RESTRICT.invalid",
 "ebuild.minorsyn",
 "ebuild.badheader",
@@ -513,6 +515,13 @@ suspect_rdepend = frozenset([
        "x11-misc/imake",
 ])
 
+suspect_virtual = {
+       "dev-util/pkg-config-lite":"virtual/pkgconfig",
+       "dev-util/pkgconf":"virtual/pkgconfig",
+       "dev-util/pkgconfig":"virtual/pkgconfig",
+       "dev-util/pkgconfig-openbsd":"virtual/pkgconfig",
+}
+
 metadata_dtd_uri = 'http://www.gentoo.org/dtd/metadata.dtd'
 # force refetch if the local copy creation time is older than this
 metadata_dtd_ctime_interval = 60 * 60 * 24 * 7 # 7 days
@@ -1884,6 +1893,15 @@ for x in effective_scanlist:
 
                                        is_blocker = atom.blocker
 
+                                       if catdir != "virtual":
+                                               if not is_blocker and \
+                                                       atom.cp in suspect_virtual:
+                                                       stats['virtual.suspect'] += 1
+                                                       fails['virtual.suspect'].append(
+                                                               relative_path +
+                                                               ": %s: consider using '%s' instead of '%s'" %
+                                                               (mytype, suspect_virtual[atom.cp], atom))
+
                                        if mytype == "DEPEND" and \
                                                not is_blocker and \
                                                not inherited_java_eclass and \
index 26575a9ca293897b68baaf09486bcea7dcb732b2..b8c0f48e39feaef1325ee9d49ff600bac05f8cc1 100644 (file)
@@ -382,6 +382,10 @@ Ebuild uses D, ROOT, ED, EROOT or EPREFIX with helpers
 The ebuild PROVIDEs an old-style virtual (see GLEP 37). This is an error
 unless "allow\-provide\-virtuals = true" is set in metadata/layout.conf.
 .TP
+.B virtual.suspect
+Ebuild contains a package that usually should be pulled via virtual/,
+not directly.
+.TP
 .B wxwidgets.eclassnotused
 Ebuild DEPENDs on x11-libs/wxGTK without inheriting wxwidgets.eclass. Refer to
 bug #305469 for more information.