stats[mytype + '.suspect'] += 1
fails[mytype + '.suspect'].append(
relative_path + ": '%s'" % atom)
- if not eapi_has_slot_deps(eapi):
- if portage.dep.dep_getslot(atom):
- stats['EAPI.incompatible'] += 1
- fails['EAPI.incompatible'].append(
- (relative_path + ": %s slot dependency" + \
- " not supported with EAPI='%s':" + \
- " '%s'") % (mytype, eapi, atom))
- if atom.use and not eapi_has_use_deps(eapi):
- stats['EAPI.incompatible'] += 1
- fails['EAPI.incompatible'].append(
- (relative_path + ": %s use dependency" + \
- " not supported with EAPI='%s':" + \
- " '%s'") % (mytype, eapi, atom))
- if atom.use and (atom.use.missing_enabled or atom.use.missing_disabled) and \
- not eapi_has_use_dep_defaults(eapi):
- stats['EAPI.incompatible'] += 1
- fails['EAPI.incompatible'].append(
- (relative_path + ": %s use dependency" + \
- " not supported with EAPI='%s':" + \
- " '%s'") % (mytype, eapi, atom))
- if atom.blocker and atom.blocker.overlap.forbid \
- and not eapi_has_strong_blocks(eapi):
- stats['EAPI.incompatible'] += 1
- fails['EAPI.incompatible'].append(
- (relative_path + ": %s new blocker syntax" + \
- " not supported with EAPI='%s':" + \
- " '%s'") % (mytype, eapi, atom))
if atom.operator == "~" and \
portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
use_reduce(v, eapi=eapi,
is_valid_flag=self.iuse.is_valid_flag, token_class=Atom)
except portage.exception.InvalidDependString as e:
- self._invalid_metadata(k + ".syntax", "%s: %s" % (k, e))
+ 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))
k = 'REQUIRED_USE'
v = self.metadata.get(k)
token = token_class(token, eapi=eapi)
except InvalidAtom as e:
raise portage.exception.InvalidDependString(
- _("Invalid atom (%s) in '%s', token %s") % (e, depstr, pos+1))
+ _("Invalid atom (%s) in '%s', token %s") \
+ % (e, depstr, pos+1), errors=(e,))
+ except SystemExit:
+ raise
except Exception as e:
raise portage.exception.InvalidDependString(
_("Invalid token '%s' in '%s', token %s") % (token, depstr, pos+1))
if eapi is not None:
if self.slot and not eapi_has_slot_deps(eapi):
- raise InvalidAtom("Slot deps are not allowed in EAPI %s: '%s'" % (eapi, self))
+ raise InvalidAtom(
+ _("Slot deps are not allowed in EAPI %s: '%s'") \
+ % (eapi, self), category='EAPI.incompatible')
if self.use:
if not eapi_has_use_deps(eapi):
- raise InvalidAtom("Use deps are not allowed in EAPI %s: '%s'" % (eapi, self))
+ raise InvalidAtom(
+ _("Use deps are not allowed in EAPI %s: '%s'") \
+ % (eapi, self), category='EAPI.incompatible')
elif not eapi_has_use_dep_defaults(eapi) and \
(self.use.missing_enabled or self.use.missing_disabled):
- raise InvalidAtom("Use dep defaults are not allowed in EAPI %s: '%s'" % (eapi, self))
+ raise InvalidAtom(
+ _("Use dep defaults are not allowed in EAPI %s: '%s'") \
+ % (eapi, self), category='EAPI.incompatible')
if self.blocker and self.blocker.overlap.forbid and not eapi_has_strong_blocks(eapi):
- raise InvalidAtom("Strong blocks are not allowed in EAPI %s: '%s'" % (eapi, self))
+ raise InvalidAtom(
+ _("Strong blocks are not allowed in EAPI %s: '%s'") \
+ % (eapi, self), category='EAPI.incompatible')
def __setattr__(self, name, value):
raise AttributeError("Atom instances are immutable",
class InvalidDependString(PortageException):
"""An invalid depend string has been encountered"""
+ def __init__(self, value, errors=None):
+ PortageException.__init__(self, value)
+ self.errors = errors
class InvalidVersionString(PortageException):
"""An invalid version string has been encountered"""
class InvalidAtom(PortagePackageException):
"""Malformed atom spec"""
+ def __init__(self, value, category=None):
+ PortagePackageException.__init__(self, value)
+ self.category = category
class UnsupportedAPIException(PortagePackageException):
"""Unsupported API"""