Fix repo atom breakage in getmaskingreason().
authorZac Medico <zmedico@gentoo.org>
Sun, 3 Oct 2010 00:19:24 +0000 (17:19 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 3 Oct 2010 00:19:24 +0000 (17:19 -0700)
pym/portage/dep/__init__.py
pym/portage/package/ebuild/getmaskingreason.py

index 0867263cfa18e1ea02909e8273e52a6b720e8877..db66f02a20fff600a7cd497b8dbcfbfbe1f1b9f8 100644 (file)
@@ -1112,6 +1112,12 @@ class Atom(_atom_base):
                                        _("Strong blocks are not allowed in EAPI %s: '%s'") \
                                                % (eapi, self), category='EAPI.incompatible')
 
+       @property
+       def without_repo(self):
+               if self.repo is None:
+                       return self
+               return Atom(self.replace(_repo_separator + self.repo, '', 1))
+
        def __setattr__(self, name, value):
                raise AttributeError("Atom instances are immutable",
                        self.__class__, name, value)
index 62a1f29a2157c6596458fc3c116584c631992a1d..04454617909d4947a53ee9769f1cbf5d5b0ff83c 100644 (file)
@@ -6,7 +6,8 @@ __all__ = ['getmaskingreason']
 import portage
 from portage import os
 from portage.const import USER_CONFIG_PATH
-from portage.dep import match_from_list, _slot_separator, _repo_separator
+from portage.dep import Atom, match_from_list, _slot_separator, _repo_separator
+from portage.exception import InvalidAtom
 from portage.localization import _
 from portage.util import grablines, normalize_path
 from portage.versions import catpkgsplit
@@ -52,19 +53,25 @@ def getmaskingreason(mycpv, metadata=None, settings=None, portdb=None, return_lo
        if mycp in pmaskdict:
                for x in pmaskdict[mycp]:
                        if match_from_list(x, cpv_slot_list):
+                               x = x.without_repo
                                for pmask in pmasklists:
                                        comment = ""
                                        comment_valid = -1
                                        pmask_filename = os.path.join(pmask[0], "package.mask")
                                        for i in range(len(pmask[1])):
                                                l = pmask[1][i].strip()
+                                               try:
+                                                       l_atom = Atom(l, allow_repo=True,
+                                                               allow_wildcard=True).without_repo
+                                               except InvalidAtom:
+                                                       l_atom = None
                                                if l == "":
                                                        comment = ""
                                                        comment_valid = -1
                                                elif l[0] == "#":
                                                        comment += (l+"\n")
                                                        comment_valid = i + 1
-                                               elif l == x:
+                                               elif l_atom == x:
                                                        if comment_valid != i:
                                                                comment = ""
                                                        if return_location: