diff options
Diffstat (limited to 'pym/portage/package')
-rw-r--r-- | pym/portage/package/ebuild/_config/LocationsManager.py | 5 | ||||
-rw-r--r-- | pym/portage/package/ebuild/_config/MaskManager.py | 53 | ||||
-rw-r--r-- | pym/portage/package/ebuild/config.py | 2 |
3 files changed, 33 insertions, 27 deletions
diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py index 83d61050f..b857f3262 100644 --- a/pym/portage/package/ebuild/_config/LocationsManager.py +++ b/pym/portage/package/ebuild/_config/LocationsManager.py @@ -176,8 +176,3 @@ class LocationsManager(object): self.profile_locations = tuple(self.profile_locations) self.profile_and_user_locations = tuple(self.profile_and_user_locations) - - self.pmask_locations = ( - tuple([os.path.join(portdir, "profiles")] + self.overlay_profiles), - tuple(self.profiles), - ) diff --git a/pym/portage/package/ebuild/_config/MaskManager.py b/pym/portage/package/ebuild/_config/MaskManager.py index c06e34663..f41636b48 100644 --- a/pym/portage/package/ebuild/_config/MaskManager.py +++ b/pym/portage/package/ebuild/_config/MaskManager.py @@ -5,38 +5,49 @@ __all__ = ( 'MaskManager', ) -from itertools import chain from portage import os from portage.dep import ExtendedAtomDict, match_from_list, _repo_separator, _slot_separator -from portage.util import grabfile_package, stack_lists +from portage.util import append_repo, grabfile_package, stack_lists from portage.versions import cpv_getkey class MaskManager(object): - def __init__(self, pmask_locations, abs_user_config, + def __init__(self, repositories, profiles, abs_user_config, user_config=True, strict_umatched_removal=False): self._punmaskdict = ExtendedAtomDict(list) self._pmaskdict = ExtendedAtomDict(list) - repo_profiles, profiles = pmask_locations + #Read profile/package.mask form every repo. + #Repositories inherit masks from their parent profiles and + #are able to remove mask from them with -atoms. + #Such a removal affects only the current repo, but not the parent. + #Add ::repo specs to every atom to make sure atoms only affect + #packages from the current repo. - #Read profile/package.mask form every repo. Stack them immediately - #to make sure that -atoms don't effect other repos. repo_pkgmasklines = [] - repo_pkgunmasklines = [] - for x in repo_profiles: - repo_pkgmasklines.append(stack_lists([grabfile_package( - os.path.join(x, "package.mask"), recursive=1, remember_source_file=True, verify_eapi=True)], \ - incremental=1, remember_source_file=True, - warn_for_unmatched_removal=True, + for repo in repositories.repos_with_profiles(): + lines = [] + repo_lines = grabfile_package(os.path.join(repo.location, "profiles", "package.mask"), \ + recursive=1, remember_source_file=True, verify_eapi=True) + masters = repo.masters + if masters is None: + masters = [repositories.mainRepo()] + for master in masters: + master_lines = grabfile_package(os.path.join(master.location, "profiles", "package.mask"), \ + recursive=1, remember_source_file=True, verify_eapi=True) + lines.append(stack_lists([master_lines, repo_lines], incremental=1, + remember_source_file=True, warn_for_unmatched_removal=True, strict_warn_for_unmatched_removal=strict_umatched_removal)) - repo_pkgunmasklines.append(stack_lists([grabfile_package( - os.path.join(x, "package.unmask"), recursive=1, remember_source_file=True, verify_eapi=True)], \ - incremental=1, remember_source_file=True, - warn_for_unmatched_removal=True, - strict_warn_for_unmatched_removal=strict_umatched_removal)) - repo_pkgmasklines = list(chain.from_iterable(repo_pkgmasklines)) - repo_pkgunmasklines = list(chain.from_iterable(repo_pkgunmasklines)) + repo_pkgmasklines.extend(append_repo(stack_lists(lines), repo.name, remember_source_file=True)) + + repo_pkgunmasklines = [] + for repo in repositories.repos_with_profiles(): + repo_lines = grabfile_package(os.path.join(repo.location, "profiles", "package.unmask"), \ + recursive=1, remember_source_file=True, verify_eapi=True) + lines = stack_lists([repo_lines], incremental=1, \ + remember_source_file=True, warn_for_unmatched_removal=True, + strict_warn_for_unmatched_removal=strict_umatched_removal) + repo_pkgmasklines.extend(append_repo(lines, repo.name)) #Read package.mask form the user's profile. Stack them in the end #to allow profiles to override masks from their parent profiles. @@ -69,9 +80,9 @@ class MaskManager(object): #Stack everything together. At this point, only user_pkgmasklines may contain -atoms. #Don't warn for unmatched -atoms here, since we don't do it for any other user config file. pkgmasklines = stack_lists([repo_pkgmasklines, profile_pkgmasklines, user_pkgmasklines], \ - incremental=1, remember_source_file=True, warn_for_unmatched_removal=False) + incremental=1, remember_source_file=True, warn_for_unmatched_removal=False, ignore_repo=True) pkgunmasklines = stack_lists([repo_pkgunmasklines, profile_pkgunmasklines, user_pkgunmasklines], \ - incremental=1, remember_source_file=True, warn_for_unmatched_removal=False) + incremental=1, remember_source_file=True, warn_for_unmatched_removal=False, ignore_repo=True) for x, source_file in pkgmasklines: self._pmaskdict.setdefault(x.cp, []).append(x) diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index e6e5d01c7..477444b3c 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -558,7 +558,7 @@ class config(object): self.configdict["conf"].get("ACCEPT_LICENSE", "")) #Read package.mask and package.unmask from profiles and optionally from user config - self._mask_manager = MaskManager(locations_manager.pmask_locations, + self._mask_manager = MaskManager(self.repositories, self.profiles, abs_user_config, user_config=local_config, strict_umatched_removal=_unmatched_removal) |