summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-26 22:43:31 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-26 22:43:31 -0700
commit365e9a71e5dff59be90f4ca16eefb245031c1e7f (patch)
tree334ed847ad84acd72b33e37d03715f9ec66d0770
parenta6d1ea1a96194687463e320fa6ad39b2e5cff634 (diff)
downloadportage-365e9a71e5dff59be90f4ca16eefb245031c1e7f.tar.gz
portage-365e9a71e5dff59be90f4ca16eefb245031c1e7f.tar.bz2
portage-365e9a71e5dff59be90f4ca16eefb245031c1e7f.zip
Add a IUSE.missing repoman category for packages that have a USE
conditional which references a flag that is not listed in IUSE. Also split out a Package._metadata_exception() method to handle IUSE.missing for *DEPEND and SRC_URI.
-rwxr-xr-xbin/repoman1
-rw-r--r--man/repoman.13
-rw-r--r--pym/_emerge/Package.py47
-rw-r--r--pym/portage/dep/__init__.py8
-rw-r--r--pym/portage/exception.py3
5 files changed, 37 insertions, 25 deletions
diff --git a/bin/repoman b/bin/repoman
index 953a4912f..bf40d896c 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -336,6 +336,7 @@ qahelp={
"LIVEVCS.stable":"This ebuild is a live checkout from a VCS but has stable keywords.",
"LIVEVCS.unmasked":"This ebuild is a live checkout from a VCS but has keywords and is not masked in the global package.mask.",
"IUSE.invalid":"This ebuild has a variable in IUSE that is not in the use.desc or its metadata.xml file",
+ "IUSE.missing":"This ebuild has a USE conditional which references a flag that is not listed in IUSE",
"IUSE.undefined":"This ebuild does not define IUSE (style guideline says to define IUSE even when empty)",
"LICENSE.invalid":"This ebuild is listing a license that doesnt exist in portages license/ dir.",
"KEYWORDS.invalid":"This ebuild contains KEYWORDS that are not listed in profiles/arch.list or for which no valid profile was found",
diff --git a/man/repoman.1 b/man/repoman.1
index 28216d6e8..a1d240392 100644
--- a/man/repoman.1
+++ b/man/repoman.1
@@ -134,6 +134,9 @@ Virtuals that have a non-empty HOMEPAGE variable
.B IUSE.invalid
This ebuild has a variable in IUSE that is not in the use.desc or its metadata.xml file
.TP
+.B IUSE.missing
+This ebuild has a USE conditional which references a flag that is not listed in IUSE
+.TP
.B IUSE.undefined
This ebuild does not define IUSE (style guideline says to define IUSE even when empty)
.TP
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 495686ff4..f9b42f0de 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -87,27 +87,7 @@ class Package(Task):
use_reduce(v, eapi=dep_eapi,
is_valid_flag=dep_valid_flag, token_class=Atom)
except portage.exception.InvalidDependString as e:
- if not self.installed:
- categorized_error = False
- if e.errors:
- for error in e.errors:
- if getattr(error, 'category', None) is None:
- continue
- categorized_error = True
- self._invalid_metadata(error.category,
- "%s: %s" % (k, error))
-
- if not categorized_error:
- self._invalid_metadata(k + ".syntax",
- "%s: %s" % (k, e))
- else:
- # For installed packages, show the path of the file
- # containing the invalid metadata, since the user may
- # want to fix the deps by hand.
- vardb = self.root_config.trees['vartree'].dbapi
- path = vardb.getpath(self.cpv, filename=k)
- self._invalid_metadata(k + ".syntax",
- "%s: %s in '%s'" % (k, e, path))
+ self._metadata_exception(k, e)
k = 'REQUIRED_USE'
v = self.metadata.get(k)
@@ -131,7 +111,7 @@ class Package(Task):
is_valid_flag=self.iuse.is_valid_flag)
except portage.exception.InvalidDependString as e:
if not self.installed:
- self._invalid_metadata(k + ".syntax", "%s: %s" % (k, e))
+ self._metadata_exception(k, e)
def copy(self):
return Package(built=self.built, cpv=self.cpv, depth=self.depth,
@@ -216,6 +196,29 @@ class Package(Task):
return True
+ def _metadata_exception(self, k, e):
+ if not self.installed:
+ categorized_error = False
+ if e.errors:
+ for error in e.errors:
+ if getattr(error, 'category', None) is None:
+ continue
+ categorized_error = True
+ self._invalid_metadata(error.category,
+ "%s: %s" % (k, error))
+
+ if not categorized_error:
+ self._invalid_metadata(k + ".syntax",
+ "%s: %s" % (k, e))
+ else:
+ # For installed packages, show the path of the file
+ # containing the invalid metadata, since the user may
+ # want to fix the deps by hand.
+ vardb = self.root_config.trees['vartree'].dbapi
+ path = vardb.getpath(self.cpv, filename=k)
+ self._invalid_metadata(k + ".syntax",
+ "%s: %s in '%s'" % (k, e, path))
+
def _invalid_metadata(self, msg_type, msg):
if self.invalid is None:
self.invalid = {}
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index 499b43fc0..36b655f7c 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -307,9 +307,11 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
if is_valid_flag:
if not is_valid_flag(flag):
- raise portage.exception.InvalidDependString(
- _("use flag '%s' is not referencable in conditional '%s' (flag missing from IUSE?)") \
- % (flag, conditional))
+ msg = _("USE flag '%s' referenced in " + \
+ "conditional '%s' is not in IUSE") \
+ % (flag, conditional)
+ e = InvalidData(msg, category='IUSE.missing')
+ raise portage.exception.InvalidDependString(msg, errors=(e,))
else:
if _valid_use_re.match(flag) is None:
raise portage.exception.InvalidDependString(
diff --git a/pym/portage/exception.py b/pym/portage/exception.py
index b289b6285..9564af98a 100644
--- a/pym/portage/exception.py
+++ b/pym/portage/exception.py
@@ -52,6 +52,9 @@ class ParseError(PortageException):
class InvalidData(PortageException):
"""An incorrect formatting was passed instead of the expected one"""
+ def __init__(self, value, category=None):
+ PortageException.__init__(self, value)
+ self.category = category
class InvalidDataType(PortageException):
"""An incorrect type was passed instead of the expected one"""