From 255b4048ccae4a73e69edf5329ce61f526079a6e Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 2 Oct 2010 17:19:24 -0700 Subject: [PATCH] Fix repo atom breakage in getmaskingreason(). --- pym/portage/dep/__init__.py | 6 ++++++ pym/portage/package/ebuild/getmaskingreason.py | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 0867263cf..db66f02a2 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -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) diff --git a/pym/portage/package/ebuild/getmaskingreason.py b/pym/portage/package/ebuild/getmaskingreason.py index 62a1f29a2..044546179 100644 --- a/pym/portage/package/ebuild/getmaskingreason.py +++ b/pym/portage/package/ebuild/getmaskingreason.py @@ -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: -- 2.26.2