Eliminate confusing false positive error messages
authorZac Medico <zmedico@gentoo.org>
Wed, 3 Oct 2007 07:50:57 +0000 (07:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 3 Oct 2007 07:50:57 +0000 (07:50 -0000)
for SRC_URI.syntax and digestentry.unused that are
reported when the SRC_URI for one or more ebuilds
can't be parsed for some reason. There's no point
in producing a false error here since the root
cause will produce a valid error elsewhere, such
as "SRC_URI.syntax" or "ebuild.sytax". Also,
update the docs for the "ebuild.syntax" error to
indicate that a digest verification failure can
trigger it.

svn path=/main/trunk/; revision=7905

bin/repoman
man/repoman.1

index a3b86e3586435b3a832369eb764fab4a7b1408e5..90c3be9739e7ddb202811561f161c0f7790b35b4 100755 (executable)
@@ -190,7 +190,7 @@ qahelp={
        "PROVIDE.syntax":"Syntax error in PROVIDE (usually an extra/missing space/parenthesis)",
        "RESTRICT.syntax":"Syntax error in RESTRICT (usually an extra/missing space/parenthesis)",
        "SRC_URI.syntax":"Syntax error in SRC_URI (usually an extra/missing space/parenthesis)",
-       "ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error",
+       "ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error or digest verification failure",
        "ebuild.output":"A simple sourcing of the ebuild produces output; this breaks ebuild policy.",
        "ebuild.nesteddie":"Placing 'die' inside ( ) prints an error, but doesn't stop the ebuild.",
        "variable.readonly":"Assigning a readonly variable",
@@ -910,18 +910,33 @@ for x in scanlist:
 
        fetchlist_dict = portage.FetchlistDict(checkdir, repoman_settings, portdb)
        myfiles_all = []
+       src_uri_error = False
        for mykey in fetchlist_dict:
                try:
                        myfiles_all.extend(fetchlist_dict[mykey])
                except portage.exception.InvalidDependString, e:
-                       stats["SRC_URI.syntax"] = stats["SRC_URI.syntax"] + 1
-                       fails["SRC_URI.syntax"].append(mykey+".ebuild SRC_URI: "+str(e))
+                       src_uri_error = True
+                       try:
+                               portdb.aux_get(mykey, ["SRC_URI"])
+                       except KeyError:
+                               # This will be reported as an "ebuild.syntax" error.
+                               pass
+                       else:
+                               stats["SRC_URI.syntax"] = stats["SRC_URI.syntax"] + 1
+                               fails["SRC_URI.syntax"].append(
+                                       "%s.ebuild SRC_URI: %s" % (mykey, e))
        del fetchlist_dict
-       myfiles_all = set(myfiles_all)
-       for entry in mydigests:
-               if entry not in myfiles_all:
-                       stats["digestentry.unused"] += 1
-                       fails["digestentry.unused"].append(checkdir+"::"+entry)
+       if not src_uri_error:
+               # This test can produce false positives if SRC_URI could not
+               # be parsed for one or more ebuilds. There's no point in
+               # producing a false error here since the root cause will
+               # produce a valid error elsewhere, such as "SRC_URI.syntax"
+               # or "ebuild.sytax".
+               myfiles_all = set(myfiles_all)
+               for entry in mydigests:
+                       if entry not in myfiles_all:
+                               stats["digestentry.unused"] += 1
+                               fails["digestentry.unused"].append(checkdir+"::"+entry)
        del myfiles_all
 
        if os.path.exists(checkdir+"/files"):
index 7b97a0abcb7fcc35a53f0abd1363af552ebdb76c..edbc7afd038b859536c6c5c0a8d97057144a491c 100644 (file)
@@ -221,6 +221,7 @@ A simple sourcing of the ebuild produces output; this breaks ebuild policy.
 .TP
 .B ebuild.syntax
 Error generating cache entry for ebuild; typically caused by ebuild syntax error
+or digest verification failure.
 .TP
 .B file.UTF8
 File is not UTF8 compliant