From c2718b681824e82119393aa61316250b5b1e32f9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 16 Nov 2009 00:34:15 +0000 Subject: [PATCH] Bug #292820 - Make the Package constructor handle invalid SLOT values. (trunk r14819) svn path=/main/branches/2.1.7/; revision=14837 --- 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 80e7a97df..79c55e447 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 5a3c47b15..6c08ebf0c 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' -- 2.26.2