Bug #209418 - Add a new KEYWORDS.dropped check that compares keywords
authorZac Medico <zmedico@gentoo.org>
Fri, 28 Mar 2008 13:02:47 +0000 (13:02 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 28 Mar 2008 13:02:47 +0000 (13:02 -0000)
against the keywords of earlier ebuild versions within a slot. (trunk r9522)

svn path=/main/branches/2.1.2/; revision=9575

bin/repoman
man/repoman.1

index f1cb3016eead7b4200c9fbf1f4adbebdb5c06225..cb6c7efc957d9ab7047ec7e80180a8cea618ef00 100755 (executable)
@@ -166,6 +166,7 @@ qahelp={
        "file.size":"Files in the files directory must be under 20k",
        "file.name":"File/dir name must be composed of only the following chars: %s " % allowed_filename_chars,
        "file.UTF8":"File is not UTF8 compliant",
+       "KEYWORDS.dropped":"Ebuilds that appear to have dropped KEYWORDS for some arch",
        "KEYWORDS.missing":"Ebuilds that have a missing or empty KEYWORDS variable",
        "KEYWORDS.stable":"Ebuilds that have been added directly with stable KEYWORDS",
        "KEYWORDS.stupid":"Ebuilds that use KEYWORDS=-* instead of package.mask", 
@@ -234,6 +235,7 @@ qawarnings=[
 "DEPEND.badindev","RDEPEND.badindev","PDEPEND.badindev",
 "DEPEND.badmaskedindev","RDEPEND.badmaskedindev","PDEPEND.badmaskedindev",
 "DESCRIPTION.toolong",
+"KEYWORDS.dropped",
 "KEYWORDS.stupid",
 "KEYWORDS.missing",
 "RESTRICT.invalid",
@@ -1157,7 +1159,19 @@ for x in scanlist:
                                fails["EAPI.unsupported"].append(os.path.join(x, y))
                                continue
                        ebuild_metadata[pf] = myaux
-       ebuildlist.sort()
+
+       # Sort ebuilds in ascending order for the KEYWORDS.dropped check.
+       pkgsplits = {}
+       for i in xrange(len(ebuildlist)):
+               ebuild_split = tuple(portage.pkgsplit(ebuildlist[i]))
+               pkgsplits[ebuild_split] = ebuildlist[i]
+               ebuildlist[i] = ebuild_split
+       ebuildlist.sort(portage.pkgcmp)
+       for i in xrange(len(ebuildlist)):
+               ebuildlist[i] = pkgsplits[ebuildlist[i]]
+       del pkgsplits
+
+       slot_keywords = {}
 
        if len(ebuild_metadata) != len(ebuildlist):
                # If we can't access all the metadata then it's totally unsafe to
@@ -1508,6 +1522,22 @@ for x in scanlist:
                                        x + "/" + y + ".ebuild added with stable keywords: %s" % \
                                                " ".join(stable_keywords))
 
+               ebuild_archs = set(kw.lstrip("~") for kw in keywords \
+                       if not kw.startswith("-"))
+
+               previous_keywords = slot_keywords.get(myaux["SLOT"])
+               if previous_keywords is None:
+                       slot_keywords[myaux["SLOT"]] = set()
+               else:
+                       dropped_keywords = previous_keywords.difference(ebuild_archs)
+                       if dropped_keywords:
+                               stats["KEYWORDS.dropped"] += 1
+                               fails["KEYWORDS.dropped"].append(
+                                       relative_path + ": %s" % \
+                                       " ".join(sorted(dropped_keywords)))
+
+               slot_keywords[myaux["SLOT"]].update(ebuild_archs)
+
                # KEYWORDS="-*" is a stupid replacement for package.mask and screws general KEYWORDS semantics
                if "-*" in keywords:
                        haskeyword = False
index be0150aa135dcf32e85202d5cb0f7207a3720609..e10f2fd48650e86265060d8c3d08b7c5d0bff20d 100644 (file)
@@ -111,6 +111,9 @@ Ebuilds that have a missing or empty HOMEPAGE variable
 .B IUSE.invalid
 This build has a variable in IUSE that is not in the use.desc or use.local.desc file
 .TP
+.B KEYWORDS.dropped
+Ebuilds that appear to have dropped KEYWORDS for some arch
+.TP
 .B KEYWORDS.invalid
 This ebuild contains KEYWORDS that are not listed in profiles/arch.list or for which no valid profile was found
 .TP