public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, man/, pym/portage/package/ebuild/, ...
@ 2012-09-13 22:56 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2012-09-13 22:56 UTC (permalink / raw
  To: gentoo-commits

commit:     6b19f71b39b6af43307abf20654511bace041217
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 13 22:47:13 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Sep 13 22:47:13 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6b19f71b

Bind FEATURES=-test to USE=-test for bug #373209.

Also, make options like emerge --newuse ignore the state of USE=test,
since users typically don't want to trigger a bunch of rebuilds when
they enable or disable FEATURES=test.

---
 man/emerge.1                                       |    9 +++
 man/make.conf.5                                    |    7 ++-
 pym/_emerge/depgraph.py                            |    7 ++-
 pym/_emerge/resolver/output_helpers.py             |    8 ++-
 pym/portage/package/ebuild/config.py               |    7 ++
 pym/portage/tests/resolver/ResolverPlayground.py   |    2 +-
 .../tests/resolver/test_features_test_use.py       |   68 ++++++++++++++++++++
 7 files changed, 100 insertions(+), 8 deletions(-)

diff --git a/man/emerge.1 b/man/emerge.1
index a25c573..65eefa2 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -369,6 +369,10 @@ changed since installation. This option also implies the
 \fB\-\-selective\fR option. Unlike \fB\-\-newuse\fR, the
 \fB\-\-changed\-use\fR option does not trigger reinstallation when
 flags that the user has not enabled are added or removed.
+
+NOTE: This option ignores the state of the "test" USE flag, since that flag
+has a special binding to FEATURES="test" (see \fBmake.conf\fR(5) for more
+information about \fBFEATURES\fR settings).
 .TP
 .BR "\-\-changelog " (\fB\-l\fR)
 Use this in conjunction with the \fB\-\-pretend\fR option.  This will
@@ -538,6 +542,10 @@ settings. If you would like to skip rebuilds for which disabled flags have
 been added to or removed from IUSE, see the related
 \fB\-\-changed\-use\fR option. If you would like to skip rebuilds for
 specific packages, see the \fB\-\-exclude\fR option.
+
+NOTE: This option ignores the state of the "test" USE flag, since that flag
+has a special binding to FEATURES="test" (see \fBmake.conf\fR(5) for more
+information about \fBFEATURES\fR settings).
 .TP
 .BR "\-\-noconfmem"
 Causes portage to disregard merge records indicating that a config file
@@ -781,6 +789,7 @@ Symbol	Location	Meaning
 *	suffix	transition to or from the enabled state
 %	suffix	newly added or removed
 ()	circumfix	forced, masked, or removed
+{}	circumfix	state is bound to FEATURES settings
 .TE
 .TP
 .BR "\-\-verbose\-main\-repo\-display"

diff --git a/man/make.conf.5 b/man/make.conf.5
index e2a16a5..f11bfcb 100644
--- a/man/make.conf.5
+++ b/man/make.conf.5
@@ -1,4 +1,4 @@
-.TH "MAKE.CONF" "5" "Aug 2012" "Portage VERSION" "Portage"
+.TH "MAKE.CONF" "5" "Sep 2012" "Portage VERSION" "Portage"
 .SH "NAME"
 make.conf \- custom settings for Portage
 .SH "SYNOPSIS"
@@ -514,7 +514,10 @@ bits from any file that is not listed in \fI/etc/portage/suidctl.conf\fR.
 Run package\-specific tests during each merge to help make sure 
 the package compiled properly.  See \fItest\fR in \fBebuild\fR(1) 
 and \fIsrc_test()\fR in \fBebuild\fR(5). This feature implies the "test"
-\fBUSE\fR flag.
+\fBUSE\fR flag if it is a member of \fBIUSE\fR, either explicitly or
+implicitly (see \fBebuild\fR(5) for more information about \fBIUSE\fR).
+The "test" \fBUSE\fR flag is also automatically disabled when the
+"test" feature is disabled.
 .TP
 .B test\-fail\-continue
 If "test" is enabled \fBFEATURES\fR and the test phase of an ebuild fails,

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index e388065..ac70d43 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -29,6 +29,7 @@ from portage.exception import (InvalidAtom, InvalidDependString,
 from portage.output import colorize, create_color_func, \
 	darkgreen, green
 bad = create_color_func("BAD")
+from portage.package.ebuild.config import _feature_flags
 from portage.package.ebuild.getmaskingstatus import \
 	_getmaskingstatus, _MaskReason
 from portage._sets import SETPREFIX
@@ -1234,12 +1235,14 @@ class depgraph(object):
 				cur_iuse).difference(forced_flags))
 			flags.update(orig_iuse.intersection(orig_use).symmetric_difference(
 				cur_iuse.intersection(cur_use)))
+			flags.difference_update(_feature_flags)
 			if flags:
 				return flags
 
 		elif changed_use or binpkg_respect_use:
-			flags = orig_iuse.intersection(orig_use).symmetric_difference(
-				cur_iuse.intersection(cur_use))
+			flags = set(orig_iuse.intersection(orig_use).symmetric_difference(
+				cur_iuse.intersection(cur_use)))
+			flags.difference_update(_feature_flags)
 			if flags:
 				return flags
 		return None

diff --git a/pym/_emerge/resolver/output_helpers.py b/pym/_emerge/resolver/output_helpers.py
index e751dd8..dc622bd 100644
--- a/pym/_emerge/resolver/output_helpers.py
+++ b/pym/_emerge/resolver/output_helpers.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 """Contains private support functions for the Display class
@@ -17,6 +17,7 @@ from portage._sets.base import InternalPackageSet
 from portage.output import (blue, bold, colorize, create_color_func,
 	green, red, teal, yellow)
 bad = create_color_func("BAD")
+from portage.package.ebuild.config import _feature_flags
 from portage.util import shlex_split, writemsg
 from portage.versions import catpkgsplit
 
@@ -245,7 +246,6 @@ def _format_size(mysize):
 		mystr=mystr[:mycount]+","+mystr[mycount:]
 	return mystr+" kB"
 
-
 def _create_use_string(conf, name, cur_iuse, iuse_forced, cur_use,
 	old_iuse, old_use,
 	is_new, reinst_flags):
@@ -299,7 +299,9 @@ def _create_use_string(conf, name, cur_iuse, iuse_forced, cur_use,
 			elif flag in old_use:
 				flag_str = green("-" + flag) + "*"
 		if flag_str:
-			if flag in iuse_forced:
+			if flag in _feature_flags:
+				flag_str = "{" + flag_str + "}"
+			elif flag in iuse_forced:
 				flag_str = "(" + flag_str + ")"
 			if isEnabled:
 				enabled.append(flag_str)

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 6ca1cb5..bb0a7c1 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -60,6 +60,8 @@ from portage.package.ebuild._config.helper import ordered_by_atom_specificity, p
 if sys.hexversion >= 0x3000000:
 	basestring = str
 
+_feature_flags = frozenset(["test"])
+
 def autouse(myvartree, use_cache=1, mysettings=None):
 	warnings.warn("portage.autouse() is deprecated",
 		DeprecationWarning, stacklevel=2)
@@ -1479,6 +1481,11 @@ class config(object):
 				if ebuild_force_test and "test" in self.usemask:
 					self.usemask = \
 						frozenset(x for x in self.usemask if x != "test")
+		elif "test" in explicit_iuse or iuse_implicit_match("test"):
+			if "test" in self.usemask or "test" not in self.features:
+				use.discard("test")
+			elif "test" in self.features:
+				use.add("test")
 
 		# Allow _* flags from USE_EXPAND wildcards to pass through here.
 		use.difference_update([x for x in use \

diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py
index 324ef9d..3bda607 100644
--- a/pym/portage/tests/resolver/ResolverPlayground.py
+++ b/pym/portage/tests/resolver/ResolverPlayground.py
@@ -34,7 +34,7 @@ class ResolverPlayground(object):
 	its work.
 	"""
 
-	config_files = frozenset(("eapi", "package.accept_keywords", "package.use",
+	config_files = frozenset(("eapi", "make.conf", "package.accept_keywords", "package.use",
 		"package.use.stable.mask", "package.mask", "package.keywords",
 		"package.unmask", "package.properties", "package.license", "use.mask", "use.force",
 		"layout.conf",))

diff --git a/pym/portage/tests/resolver/test_features_test_use.py b/pym/portage/tests/resolver/test_features_test_use.py
new file mode 100644
index 0000000..bdd179d
--- /dev/null
+++ b/pym/portage/tests/resolver/test_features_test_use.py
@@ -0,0 +1,68 @@
+# Copyright 2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+from portage.tests import TestCase
+from portage.tests.resolver.ResolverPlayground import (ResolverPlayground,
+	ResolverPlaygroundTestCase)
+
+class FeaturesTestUse(TestCase):
+
+	def testFeaturesTestUse(self):
+		ebuilds = {
+			"dev-libs/A-1" : {
+				"IUSE": "test"
+			},
+			"dev-libs/B-1" : {
+				"IUSE": "test foo"
+			},
+		}
+
+		installed = {
+			"dev-libs/A-1" : {
+				"USE": "",
+				"IUSE": "test"
+			},
+			"dev-libs/B-1" : {
+				"USE": "foo",
+				"IUSE": "test foo"
+			},
+		}
+
+		user_config = {
+			"make.conf" : ("FEATURES=test", "USE=\"-test -foo\"")
+		}
+
+		test_cases = (
+
+			# USE=test state should not trigger --newuse rebuilds, as
+			# specified in bug #373209, comment #3.
+			ResolverPlaygroundTestCase(
+				["dev-libs/A"],
+				options = {"--newuse": True, "--selective": True},
+				success = True,
+				mergelist = []),
+
+			# USE=-test -> USE=test, with USE=test forced by FEATURES=test
+			ResolverPlaygroundTestCase(
+				["dev-libs/A"],
+				options = {},
+				success = True,
+				mergelist = ["dev-libs/A-1"]),
+
+			# USE=foo -> USE=-foo, with USE=test forced by FEATURES=test
+			ResolverPlaygroundTestCase(
+				["dev-libs/B"],
+				options = {"--newuse": True, "--selective": True},
+				success = True,
+				mergelist = ["dev-libs/B-1"]),
+		)
+
+		playground = ResolverPlayground(ebuilds=ebuilds,
+			installed=installed, user_config=user_config, debug=False)
+		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()
+


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-13 22:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-13 22:56 [gentoo-commits] proj/portage:master commit in: pym/_emerge/resolver/, man/, pym/portage/package/ebuild/, Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox