From 9f29682eb4429e5b2ac7cbb54361fb24092ab0fd Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 15 Sep 2010 00:27:09 -0700 Subject: Bug #337180 - Add a --unmatched-removal option for stricter checking of package.mask and package.unmask files for unmatched removal atoms. --- pym/portage/package/ebuild/_config/MaskManager.py | 17 ++++++++++++----- pym/portage/package/ebuild/config.py | 9 +++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'pym') diff --git a/pym/portage/package/ebuild/_config/MaskManager.py b/pym/portage/package/ebuild/_config/MaskManager.py index 34cc6ec26..f5b240a47 100644 --- a/pym/portage/package/ebuild/_config/MaskManager.py +++ b/pym/portage/package/ebuild/_config/MaskManager.py @@ -13,7 +13,8 @@ from portage.versions import cpv_getkey class MaskManager(object): - def __init__(self, pmask_locations, abs_user_config, user_config=True): + def __init__(self, pmask_locations, abs_user_config, + user_config=True, strict_umatched_removal=False): self._punmaskdict = ExtendedAtomDict(list) self._pmaskdict = ExtendedAtomDict(list) @@ -26,10 +27,14 @@ class MaskManager(object): 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)) + 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)) + 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)) @@ -43,9 +48,11 @@ class MaskManager(object): profile_pkgunmasklines.append(grabfile_package( os.path.join(x, "package.unmask"), recursive=1, remember_source_file=True, verify_eapi=True)) profile_pkgmasklines = stack_lists(profile_pkgmasklines, incremental=1, \ - remember_source_file=True, warn_for_unmatched_removal=True) + remember_source_file=True, warn_for_unmatched_removal=True, + strict_warn_for_unmatched_removal=strict_umatched_removal) profile_pkgunmasklines = stack_lists(profile_pkgunmasklines, incremental=1, \ - remember_source_file=True, warn_for_unmatched_removal=True) + remember_source_file=True, warn_for_unmatched_removal=True, + strict_warn_for_unmatched_removal=strict_umatched_removal) #Read /etc/portage/package.mask. Don't stack it to allow the user to #remove mask atoms from everywhere with -atoms. diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 733d36cfc..8ee93005a 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -157,7 +157,7 @@ class config(object): def __init__(self, clone=None, mycpv=None, config_profile_path=None, config_incrementals=None, config_root=None, target_root=None, - _eprefix=None, local_config=True, env=None): + _eprefix=None, local_config=True, env=None, _unmatched_removal=False): """ @param clone: If provided, init will use deepcopy to copy by value the instance. @type clone: Instance of config class. @@ -181,6 +181,9 @@ class config(object): @param env: The calling environment which is used to override settings. Defaults to os.environ if unspecified. @type env: dict + @param _unmatched_removal: Enabled by repoman when the + --unmatched-removal option is given. + @type _unmatched_removal: Boolean """ # rename local _eprefix variable for convenience @@ -542,7 +545,9 @@ 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, abs_user_config, user_config=local_config) + self._mask_manager = MaskManager(locations_manager.pmask_locations, + abs_user_config, user_config=local_config, + strict_umatched_removal=_unmatched_removal) self._virtuals_manager = VirtualsManager(self.profiles) -- cgit v1.2.3-1-g7c22