summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-15 00:27:09 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-15 00:27:09 -0700
commit9f29682eb4429e5b2ac7cbb54361fb24092ab0fd (patch)
treed39e9de14112f064b646e6d9d20fc9f075e8542d
parentd36cba7fdd5b9663aa10e0f701ae7ca0ee933a70 (diff)
downloadportage-9f29682eb4429e5b2ac7cbb54361fb24092ab0fd.tar.gz
portage-9f29682eb4429e5b2ac7cbb54361fb24092ab0fd.tar.bz2
portage-9f29682eb4429e5b2ac7cbb54361fb24092ab0fd.zip
Bug #337180 - Add a --unmatched-removal option for stricter checking
of package.mask and package.unmask files for unmatched removal atoms.
-rwxr-xr-xbin/repoman4
-rw-r--r--man/repoman.14
-rw-r--r--pym/portage/package/ebuild/_config/MaskManager.py17
-rw-r--r--pym/portage/package/ebuild/config.py9
4 files changed, 27 insertions, 7 deletions
diff --git a/bin/repoman b/bin/repoman
index 70e7cdaf2..1f7b21bce 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -216,6 +216,9 @@ def ParseArgs(argv, qahelp):
parser.add_option('-d', '--include-dev', dest='include_dev', action='store_true',
default=False, help='include dev profiles in dependency checks')
+ parser.add_option('--unmatched-removal', dest='unmatched_removal', action='store_true',
+ default=False, help='enable strict checking of package.mask and package.unmask files for unmatched removal atoms')
+
parser.add_option('--without-mask', dest='without_mask', action='store_true',
default=False, help='behave as if no package.mask entries exist (not allowed with commit mode)')
@@ -1818,6 +1821,7 @@ for x in scanlist:
config_profile_path=prof.abs_path,
config_incrementals=repoman_incrementals,
local_config=False,
+ _unmatched_removal=options.unmatched_removal,
env=env)
if options.without_mask:
dep_settings._mask_manager = \
diff --git a/man/repoman.1 b/man/repoman.1
index 2e0e5a540..e7234b0a0 100644
--- a/man/repoman.1
+++ b/man/repoman.1
@@ -50,6 +50,10 @@ Ignore masked packages (not allowed with commit mode)
\fB\-d\fR, \fB\-\-include\-dev\fR
Include dev profiles in dependency checks.
.TP
+\fB\-\-unmatched\-removal\fR
+Enable strict checking of package.mask and package.unmask files for
+unmatched removal atoms.
+.TP
\fB\-\-without\-mask\fR
Behave as if no package.mask entries exist (not allowed with commit mode)
.TP
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)