From c281261a8c23137d09c616e1fd5f08e20c78ab39 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 12 Nov 2009 23:34:36 +0000 Subject: Bug #292820 - Make the Package constructor handle invalid SLOT values. svn path=/main/trunk/; revision=14819 --- bin/repoman | 1 + man/repoman.1 | 2 ++ pym/_emerge/Package.py | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/repoman b/bin/repoman index 74bbdab92..0df7c00ae 100755 --- a/bin/repoman +++ b/bin/repoman @@ -283,6 +283,7 @@ qahelp={ "EAPI.definition":"EAPI is defined after an inherit call (must be defined before)", "EAPI.incompatible":"Ebuilds that use features that are only available with a different EAPI", "EAPI.unsupported":"Ebuilds that have an unsupported EAPI version (you must upgrade portage)", + "SLOT.invalid":"Ebuilds that have an invalid SLOT variable value", "SLOT.missing":"Ebuilds that have a missing or empty SLOT variable", "HOMEPAGE.missing":"Ebuilds that have a missing or empty HOMEPAGE variable", "DEPEND.bad":"User-visible ebuilds with bad DEPEND settings (matched against *visible* ebuilds)", diff --git a/man/repoman.1 b/man/repoman.1 index 4ca110fab..5fab376b6 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -206,6 +206,8 @@ Syntax error in PROPERTIES (usually an extra/missing space/parenthesis) .TP .B RESTRICT.syntax Syntax error in RESTRICT (usually an extra/missing space/parenthesis) +.B SLOT.invalid +Ebuilds that have an invalid SLOT variable value .TP .B SLOT.missing Ebuilds that have a missing or empty SLOT variable diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index d6970b5f2..dc8b975e6 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -8,7 +8,7 @@ from itertools import chain import portage from portage.cache.mappings import slot_dict_class from portage.dep import paren_reduce, use_reduce, \ - paren_normalize, paren_enclose + paren_normalize, paren_enclose, _slot_re from _emerge.Task import Task if sys.hexversion >= 0x3000000: @@ -40,7 +40,9 @@ class Package(Task): self.metadata['CHOST'] = self.root_config.settings.get('CHOST', '') self.cp = portage.cpv_getkey(self.cpv) slot = self.slot - if not slot: + if _slot_re.match(slot) is None: + self._invalid_metadata('SLOT.invalid', + "SLOT: invalid value: '%s'" % slot) # Avoid an InvalidAtom exception when creating slot_atom. # This package instance will be masked due to empty SLOT. slot = '0' -- cgit v1.2.3-1-g7c22