Add repoman check for REQUIRED_USE
authorSebastian Luther <SebastianLuther@gmx.de>
Tue, 13 Apr 2010 14:33:28 +0000 (16:33 +0200)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Aug 2010 01:27:37 +0000 (18:27 -0700)
bin/repoman
pym/portage/dep/__init__.py

index 0115c28852902572b559f8bdf12c933263898ae0..2a53bd27ee0588f19c4aa0a231d572ef79083a1d 100755 (executable)
@@ -322,6 +322,7 @@ qahelp={
        "PROVIDE.syntax":"Syntax error in PROVIDE (usually an extra/missing space/parenthesis)",
        "PROPERTIES.syntax":"Syntax error in PROPERTIES (usually an extra/missing space/parenthesis)",
        "RESTRICT.syntax":"Syntax error in RESTRICT (usually an extra/missing space/parenthesis)",
+       "REQUIRED_USE.syntax":"Syntax error in REQUIRED_USE (usually an extra/missing space/parenthesis)",
        "SRC_URI.syntax":"Syntax error in SRC_URI (usually an extra/missing space/parenthesis)",
        "SRC_URI.mirror":"A uri listed in profiles/thirdpartymirrors is found in SRC_URI",
        "ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error or digest verification failure",
@@ -1785,6 +1786,22 @@ for x in scanlist:
                                stats["RESTRICT.invalid"] += len(mybadrestrict)
                                for mybad in mybadrestrict:
                                        fails["RESTRICT.invalid"].append(x+"/"+y+".ebuild: %s" % mybad)
+               #REQUIRED_USE check
+               required_use = myaux["REQUIRED_USE"]
+               if required_use:
+                       if eapi in ("0", "1", "2", "3"):
+                               stats['EAPI.incompatible'] += 1
+                               fails['EAPI.incompatible'].append(
+                                       relative_path + ": REQUIRED_USE" + \
+                                       " not supported with EAPI='%s'" % (eapi,))
+                       try:
+                               portage.dep.check_required_use(required_use, "", myaux["IUSE"].split())
+                       except portage.exception.InvalidRequiredUseString as e:
+                               stats["REQUIRED_USE.syntax"] = stats["REQUIRED_USE.syntax"] + 1
+                               fails["REQUIRED_USE.syntax"].append(
+                                       "%s: REQUIRED_USE: %s" % (relative_path, e))
+                               del e
+
                # Syntax Checks
                relative_path = os.path.join(x, y + ".ebuild")
                full_path = os.path.join(repodir, relative_path)
index a2dbbe9d0bf09ff4d1e9eec63e04a26d3e8083d8..30b18198808d3b8dde83dfbd96bd4f8549a38eab 100644 (file)
@@ -1450,6 +1450,10 @@ def _check_required_use(constraints, use, iuse):
                                ("check_required_use(): '%s' constraint list without " + \
                                "use conditional or operator") % (constraints,))
 
+               if not constraint:
+                       raise portage.exception.InvalidRequiredUseString(
+                               ("check_required_use(): '%s' syntax error") % (constraints,) )
+
                if constraint[-1] == "?":
                        #a use conditional
                        skip_next = True