From: Zac Medico Date: Sat, 10 Jan 2009 10:14:17 +0000 (-0000) Subject: Add a new 'metadata.warning' category and a check which detects local USE X-Git-Tag: v2.2_rc21~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4e1ab70684b925f4b5d4caab9670dca2b0ffd262;p=portage.git Add a new 'metadata.warning' category and a check which detects local USE descriptions that are not used in any ebuilds. Thanks to Markus Meier for the initial patch. svn path=/main/trunk/; revision=12413 --- diff --git a/bin/repoman b/bin/repoman index 0fdef5181..726939293 100755 --- a/bin/repoman +++ b/bin/repoman @@ -315,6 +315,7 @@ qahelp={ "ebuild.badheader":"This ebuild has a malformed header", "metadata.missing":"Missing metadata.xml files", "metadata.bad":"Bad metadata.xml files", + "metadata.warning":"Warnings in metadata.xml files", "virtual.versioned":"PROVIDE contains virtuals with versions", "virtual.exists":"PROVIDE contains existing package names", "virtual.unavailable":"PROVIDE contains a virtual which contains no profile default", @@ -351,6 +352,7 @@ qawarnings = set(( "file.size", "inherit.autotools", "java.eclassesnotused", +"metadata.warning", "virtual.versioned", "virtual.exists", "virtual.unavailable", @@ -1063,11 +1065,14 @@ for x in scanlist: fails["metadata.bad"].append(x+"/metadata.xml") del metadata_bad + muselist = frozenset(muselist) changelog_path = os.path.join(checkdir_relative, "ChangeLog") changelog_modified = changelog_path in modified_changelogs allmasked = True + # detect unused local USE-descriptions + used_useflags = set() for y in ebuildlist: relative_path = os.path.join(x, y + ".ebuild") @@ -1368,6 +1373,7 @@ for x in scanlist: default_use.append(myflag) if flag_name not in uselist: myuse.append(flag_name) + used_useflags.update(myuse) # uselist checks - metadata for mypos in range(len(myuse)-1,-1,-1): @@ -1576,6 +1582,12 @@ for x in scanlist: stats["ebuild.allmasked"]+=1 fails["ebuild.allmasked"].append(x) + # check if there are unused local USE-descriptions in metadata.xml + for myflag in muselist.difference(used_useflags): + stats["metadata.warning"] += 1 + fails["metadata.warning"].append( + "unused local USE-description: '%s'" % myflag) + if options.mode == "manifest": sys.exit(dofail) diff --git a/man/repoman.1 b/man/repoman.1 index 0380adfd6..754214049 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -263,6 +263,9 @@ Bad metadata.xml files .B metadata.missing Missing metadata.xml files .TP +.B metadata.warning +Warnings in metadata.xml files +.TP .B upstream.workaround The ebuild works around an upstream bug, an upstream bug should be filed and tracked in bugs.gentoo.org