public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: man/, pym/portage/tests/resolver/, pym/_emerge/
Date: Mon, 19 Sep 2011 14:37:31 +0000 (UTC)	[thread overview]
Message-ID: <d36be695ea48025ba195deb82f51846aee2254ec.zmedico@gentoo> (raw)

commit:     d36be695ea48025ba195deb82f51846aee2254ec
Author:     Sebastian Luther <SebastianLuther <AT> gmx <DOT> de>
AuthorDate: Mon Sep 19 14:32:08 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep 19 14:32:08 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=d36be695

autounmask: Add --autounmask-keep-masks option

Disables creation of p.unmask entries to allow users
to insist on their masks and hope for another conflict
resolution (i.e. missed update). This fixes bug 372485.

---
 man/emerge.1                                  |    5 +++
 pym/_emerge/depgraph.py                       |    4 ++-
 pym/_emerge/help.py                           |    8 +++++
 pym/_emerge/main.py                           |   10 ++++++
 pym/portage/tests/resolver/test_autounmask.py |   39 +++++++++++++++++++++++++
 5 files changed, 65 insertions(+), 1 deletions(-)

diff --git a/man/emerge.1 b/man/emerge.1
index d6d74e0..cf7b0e2 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -309,6 +309,11 @@ If \-\-autounmask is enabled, changes using the \'=\' operator
 will be written. With this option, \'>=\' operators will be used
 whenever possible.
 .TP
+.BR "\-\-autounmask\-keep\-masks [ y | n ]"
+If \-\-autounmask is enabled, no changes to package.unmask
+will be created. This leads to unsatisfied dependencies if
+no other solution exists.
+.TP
 .BR "\-\-autounmask\-write [ y | n ]"
 If \-\-autounmask is enabled, changes are written
 to config files, respecting \fBCONFIG_PROTECT\fR and \fB\-\-ask\fR.

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index a5015b8..52d4545 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -3411,6 +3411,8 @@ class depgraph(object):
 
 		default_selection = (pkg, existing)
 
+		autounmask_keep_masks = self._frozen_config.myopts.get("--autounmask-keep-masks", "n") != "n"
+
 		if self._dynamic_config._autounmask is True:
 			if pkg is not None and \
 				pkg.installed and \
@@ -3422,7 +3424,7 @@ class depgraph(object):
 					break
 
 				for allow_unmasks in (False, True):
-					if only_use_changes and allow_unmasks:
+					if allow_unmasks and (only_use_changes or autounmask_keep_masks):
 						continue
 
 					if pkg is not None:

diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py
index f5ff7a3..4334bcb 100644
--- a/pym/_emerge/help.py
+++ b/pym/_emerge/help.py
@@ -331,6 +331,14 @@ def help(myopts, havecolor=1):
 		for line in wrap(desc, desc_width):
 			print(desc_indent + line)
 		print()
+		print("       " + green("--autounmask-keep-masks") + " [ %s | %s ]" % \
+			(turquoise("y"), turquoise("n")))
+		desc = "If --autounmask is enabled, no changes to " + \
+			"package.unmask will be created. This leads to unsatisfied " + \
+			"dependencies if no other solution exists."
+		for line in wrap(desc, desc_width):
+			print(desc_indent + line)
+		print()
 		print("       " + green("--autounmask-write") + " [ %s | %s ]" % \
 			(turquoise("y"), turquoise("n")))
 		desc = "If --autounmask is enabled, changes are written " + \

diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 73d0795..3f47af7 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -431,6 +431,7 @@ def insert_optional_args(args):
 	default_arg_opts = {
 		'--ask'                  : y_or_n,
 		'--autounmask'           : y_or_n,
+		'--autounmask-keep-masks': y_or_n,
 		'--autounmask-unrestricted-atoms' : y_or_n,
 		'--autounmask-write'     : y_or_n,
 		'--buildpkg'             : y_or_n,
@@ -610,6 +611,12 @@ def parse_opts(tmpcmdline, silent=False):
 			"choices" : true_y_or_n
 		},
 
+		"--autounmask-keep-masks": {
+			"help"    : "don't add package.unmask entries",
+			"type"    : "choice",
+			"choices" : true_y_or_n
+		},
+
 		"--autounmask-write": {
 			"help"    : "write changes made by --autounmask to disk",
 			"type"    : "choice",
@@ -936,6 +943,9 @@ def parse_opts(tmpcmdline, silent=False):
 	if myoptions.autounmask_unrestricted_atoms in true_y:
 		myoptions.autounmask_unrestricted_atoms = True
 
+	if myoptions.autounmask_keep_masks in true_y:
+		myoptions.autounmask_keep_masks = True
+
 	if myoptions.autounmask_write in true_y:
 		myoptions.autounmask_write = True
 

diff --git a/pym/portage/tests/resolver/test_autounmask.py b/pym/portage/tests/resolver/test_autounmask.py
index ff13789..3da1c25 100644
--- a/pym/portage/tests/resolver/test_autounmask.py
+++ b/pym/portage/tests/resolver/test_autounmask.py
@@ -388,3 +388,42 @@ class AutounmaskTestCase(TestCase):
 				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
 		finally:
 			playground.cleanup()
+
+
+	def testAutounmaskKeepMasks(self):
+
+		ebuilds = {
+			"app-text/A-1": {},
+			}
+
+		test_cases = (
+				#Test mask and keyword changes.
+				ResolverPlaygroundTestCase(
+					["app-text/A"],
+					options = {"--autounmask": True,
+								"--autounmask-keep-masks": "y"},
+					success = False),
+				ResolverPlaygroundTestCase(
+					["app-text/A"],
+					options = {"--autounmask": True,
+								"--autounmask-keep-masks": "n"},
+					success = False,
+					mergelist = ["app-text/A-1"],
+					needed_p_mask_changes = ["app-text/A-1"]),
+			)
+
+		profile = {
+			"package.mask":
+				(
+					"app-text/A",
+				),
+		}
+
+		playground = ResolverPlayground(ebuilds=ebuilds, profile=profile)
+
+		try:
+			for test_case in test_cases:
+				playground.run_TestCase(test_case)
+				self.assertEqual(test_case.test_success, True, test_case.fail_msg)
+		finally:
+			playground.cleanup()



             reply	other threads:[~2011-09-19 14:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-19 14:37 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-07-10 22:45 [gentoo-commits] proj/portage:master commit in: man/, pym/portage/tests/resolver/, pym/_emerge/ Zac Medico
2011-09-21 19:34 Zac Medico
2011-08-26 18:10 Zac Medico
2011-05-04 17:06 Zac Medico
2011-05-03 22:59 Zac Medico
2011-05-02 19:12 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d36be695ea48025ba195deb82f51846aee2254ec.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox