public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: Zac Medico <zmedico@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH] emerge: make --binpkg-respect-use=y imply --autounmask-use=n
Date: Mon,  1 Mar 2021 01:39:07 -0800	[thread overview]
Message-ID: <20210301093907.1541710-1-zmedico@gentoo.org> (raw)

If --binpkg-respect-use=y is given explicitly, then it implies
--autounmask-use=n, because these options naturally oppose
eachother.

Bug: https://bugs.gentoo.org/773469
Signed-off-by: Zac Medico <zmedico@gentoo.org>
---
 lib/_emerge/create_depgraph_params.py       | 22 ++++++++++-----------
 lib/portage/tests/resolver/test_useflags.py | 20 +++++++++++++------
 man/emerge.1                                | 11 +++++++----
 3 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/lib/_emerge/create_depgraph_params.py b/lib/_emerge/create_depgraph_params.py
index 25dd2a1b4..267600fb6 100644
--- a/lib/_emerge/create_depgraph_params.py
+++ b/lib/_emerge/create_depgraph_params.py
@@ -41,12 +41,22 @@ def create_depgraph_params(myopts, myaction):
 	# binpkg_changed_deps: reject binary packages with outdated deps
 	myparams = {"recurse" : True}
 
+	binpkg_respect_use = myopts.get("--binpkg-respect-use")
+	if binpkg_respect_use is not None:
+		myparams["binpkg_respect_use"] = binpkg_respect_use
+	elif "--usepkgonly" not in myopts:
+		# If --binpkg-respect-use is not explicitly specified, we enable
+		# the behavior automatically (like requested in bug #297549), as
+		# long as it doesn't strongly conflict with other options that
+		# have been specified.
+		myparams["binpkg_respect_use"] = "auto"
+
 	autounmask_keep_keywords = myopts.get("--autounmask-keep-keywords")
 	autounmask_keep_masks = myopts.get("--autounmask-keep-masks")
 
 	autounmask = myopts.get("--autounmask")
 	autounmask_license = myopts.get('--autounmask-license', 'y' if autounmask is True else 'n')
-	autounmask_use = myopts.get('--autounmask-use')
+	autounmask_use = 'n' if myparams.get('binpkg_respect_use') == 'y' else myopts.get('--autounmask-use')
 	if autounmask == 'n':
 		autounmask = False
 	else:
@@ -153,16 +163,6 @@ def create_depgraph_params(myopts, myaction):
 		'--update' in myopts:
 		myparams['rebuilt_binaries'] = True
 
-	binpkg_respect_use = myopts.get('--binpkg-respect-use')
-	if binpkg_respect_use is not None:
-		myparams['binpkg_respect_use'] = binpkg_respect_use
-	elif '--usepkgonly' not in myopts:
-		# If --binpkg-respect-use is not explicitly specified, we enable
-		# the behavior automatically (like requested in bug #297549), as
-		# long as it doesn't strongly conflict with other options that
-		# have been specified.
-		myparams['binpkg_respect_use'] = 'auto'
-
 	binpkg_changed_deps = myopts.get('--binpkg-changed-deps')
 	if binpkg_changed_deps is not None:
 		myparams['binpkg_changed_deps'] = binpkg_changed_deps
diff --git a/lib/portage/tests/resolver/test_useflags.py b/lib/portage/tests/resolver/test_useflags.py
index d66da0866..b799e62ff 100644
--- a/lib/portage/tests/resolver/test_useflags.py
+++ b/lib/portage/tests/resolver/test_useflags.py
@@ -46,15 +46,23 @@ class UseFlagsTestCase(TestCase):
 				success = True,
 				mergelist = ["dev-libs/A-1"]),
 
-			# In the unit test case for bug 773469, the --autounmask-backtrack option
-			# is needed in order to trigger the --binpkg-respect-use=y behavior that
-			# appears confusingly similar to --binpkg-respect-use=n behavior.
+			# For bug 773469, we wanted --binpkg-respect-use=y to trigger a
+			# slot collision. Instead, a combination of default --autounmask-use
+			# combined with --autounmask-backtrack=y from EMERGE_DEFAULT_OPTS
+			# triggered this behavior which appeared confusingly similar to
+			#--binpkg-respect-use=n behavior.
+			#ResolverPlaygroundTestCase(
+			#	["dev-libs/C", "dev-libs/D"],
+			#	options={"--usepkg": True, "--binpkg-respect-use": "y", "--autounmask-backtrack": "y"},
+			#	success=True,
+			#	use_changes={"dev-libs/C-1": {"abi_x86_32": True}},
+			#	mergelist=["[binary]dev-libs/C-1", "[binary]dev-libs/D-1"],
 			ResolverPlaygroundTestCase(
 				["dev-libs/C", "dev-libs/D"],
 				options={"--usepkg": True, "--binpkg-respect-use": "y", "--autounmask-backtrack": "y"},
-				success=True,
-				use_changes={"dev-libs/C-1": {"abi_x86_32": True}},
-				mergelist=["[binary]dev-libs/C-1", "[binary]dev-libs/D-1"],
+				success=False,
+				slot_collision_solutions=[{"dev-libs/C-1": {"abi_x86_32": True}}],
+				mergelist=["dev-libs/C-1", "[binary]dev-libs/D-1"],
 			),
 
 			#--binpkg-respect-use=n: use binpkgs with different use flags
diff --git a/man/emerge.1 b/man/emerge.1
index d9efc74cf..fe13e2145 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -1,4 +1,4 @@
-.TH "EMERGE" "1" "Feb 2021" "Portage VERSION" "Portage"
+.TH "EMERGE" "1" "Mar 2021" "Portage VERSION" "Portage"
 .SH "NAME"
 emerge \- Command\-line interface to the Portage system
 .SH "SYNOPSIS"
@@ -417,7 +417,8 @@ Allow autounmask package.license changes.
 .TP
 .BR "\-\-autounmask\-use < y | n >"
 Allow autounmask package.use changes. This option is enabled by default
-(either \fB\-\-autounmask=n\fR or \fB\-\-autounmask\-use=n\fR disables
+(any of \fB\-\-autounmask=n\fR, \fB\-\-autounmask\-use=n\fR,
+or \fB\-\-binpkg-\-respect\-use=y\fR  disables
 it). The \fBEMERGE_DEFAULT_OPTS\fR variable may be used to
 disable this option by default in \fBmake.conf\fR(5).
 .TP
@@ -447,8 +448,10 @@ dependencies is controlled by the \fB\-\-with\-bdeps\fR option.
 Tells emerge to ignore binary packages if their USE flags
 don't match the current configuration. In order to help avoid issues
 with resolving inconsistent USE flag settings, this option is
-automatically enabled unless the \fB\-\-usepkgonly\fR option
-is enabled.
+automatically enabled unless the \fB\-\-usepkgonly\fB option
+is enabled. If \fB\-\-binpkg\-respect\-use=y\fB is given explicitly,
+then it implies \fB\-\-autounmask\-use=n\fB, because these options
+naturally oppose eachother.
 .TP
 .BR "\-\-buildpkg [ y | n ]" ", " \-b
 Tells emerge to build binary packages for all ebuilds processed in
-- 
2.26.2



                 reply	other threads:[~2021-03-01  9:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210301093907.1541710-1-zmedico@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-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