[gentoo-commits] proj/portage:master commit in: pym/_emerge/, man/, pym/portage/tests/resolver/

2018-03-27 Thread Zac Medico
commit: 1879d3ca019ebe4b870c3ee8d80910a90a8e4408
Author: Zac Medico  gentoo  org>
AuthorDate: Mon Mar 26 20:59:57 2018 +
Commit: Zac Medico  gentoo  org>
CommitDate: Wed Mar 28 05:51:50 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=1879d3ca

emerge: add --changed-slot [ y | n ] option (bug 631358)

This is similar to --changed-deps, but for SLOT metadata.

Bug: https://bugs.gentoo.org/631358

 man/emerge.1  |  7 +++
 pym/_emerge/create_depgraph_params.py |  6 ++
 pym/_emerge/depgraph.py   | 11 +++
 pym/_emerge/main.py   | 13 +
 .../resolver/test_slot_change_without_revbump.py  | 19 +++
 5 files changed, 56 insertions(+)

diff --git a/man/emerge.1 b/man/emerge.1
index 27a1193fe..a3c8dd7cd 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -471,6 +471,13 @@ changed since the installed instance was built. Behavior 
with respect to
 changed build\-time dependencies is controlled by the
 \fB\-\-with\-bdeps\fR option.
 .TP
+.BR "\-\-changed\-slot [ y | n ]"
+Tells emerge to replace installed packages for which the corresponding
+ebuild SLOT metadata has changed since the packages were built. This
+option also implies the \fB\-\-selective\fR option. This may also result
+in rebuilds for any installed packages that have slot/sub\-slot :=
+operator dependencies that are sensitive to the relevant SLOT metadata.
+.TP
 .BR \-\-changed\-use ", " \-U
 Tells emerge to include installed packages where USE flags have
 changed since installation. This option also implies the

diff --git a/pym/_emerge/create_depgraph_params.py 
b/pym/_emerge/create_depgraph_params.py
index ff18f3acc..1fd1f5e36 100644
--- a/pym/_emerge/create_depgraph_params.py
+++ b/pym/_emerge/create_depgraph_params.py
@@ -30,6 +30,7 @@ def create_depgraph_params(myopts, myaction):
# with_test_deps: pull in test deps for packages matched by arguments
# changed_deps: rebuild installed packages with outdated deps
# changed_deps_report: report installed packages with outdated deps
+   # changed_slot: rebuild installed packages with outdated SLOT metadata
# binpkg_changed_deps: reject binary packages with outdated deps
myparams = {"recurse" : True}
 
@@ -64,12 +65,17 @@ def create_depgraph_params(myopts, myaction):
if rebuild_if_new_slot is not None:
myparams['rebuild_if_new_slot'] = rebuild_if_new_slot
 
+   changed_slot = myopts.get('--changed-slot') is True
+   if changed_slot:
+   myparams["changed_slot"] = True
+
if "--update" in myopts or \
"--newrepo" in myopts or \
"--newuse" in myopts or \
"--reinstall" in myopts or \
"--noreplace" in myopts or \
myopts.get("--changed-deps", "n") != "n" or \
+   changed_slot or \
myopts.get("--selective", "n") != "n":
myparams["selective"] = True
 

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index ac7ec9d84..6af7d5714 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -2667,6 +2667,10 @@ class depgraph(object):
 
return changed
 
+   def _changed_slot(self, pkg):
+   ebuild = self._equiv_ebuild(pkg)
+   return ebuild is not None and (ebuild.slot, ebuild.sub_slot) != 
(pkg.slot, pkg.sub_slot)
+
def _create_graph(self, allow_unsatisfied=False):
dep_stack = self._dynamic_config._dep_stack
dep_disjunctive_stack = 
self._dynamic_config._dep_disjunctive_stack
@@ -6474,6 +6478,13 @@ class depgraph(object):

modified_use=self._pkg_use_enabled(pkg))):
if myeb and "--newrepo" in 
self._frozen_config.myopts and myeb.repo != pkg.repo:
break
+   elif 
self._dynamic_config.myparams.get("changed_slot") and self._changed_slot(pkg):
+   if installed:
+   break
+   else:
+   # Continue 
searching for a binary package
+   # with the 
desired SLOT metadata.
+   continue
elif reinstall_use or (not 
installed and respect_use):
iuses = pkg.iuse.all
old_use = 
self._pkg_use_enabled(pkg)

diff --git 

[gentoo-commits] proj/portage:master commit in: pym/_emerge/, man/, pym/portage/tests/resolver/

2017-12-19 Thread Michał Górny
commit: 2905e1c2c28db495b74fde7d9b3bfdd4e7515dbd
Author: Michał Górny  gentoo  org>
AuthorDate: Fri Dec 15 22:48:33 2017 +
Commit: Michał Górny  gentoo  org>
CommitDate: Tue Dec 19 22:45:16 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2905e1c2

Disable dynamic-deps by default

We have prepared for this for quite a while and it's time to pull
the plug. Disable dynamic-deps by default and restore the standard
PMS behavior. This will cause some one-time pain but eventually will
result in improvement of ebuild quality, especially when developers
start experiencing the need for revbumps first hand.

Acked-by: Alexander Berntsen  gentoo.org>
Reviewed-by: Zac Medico  gentoo.org>

 man/emerge.1| 2 +-
 pym/_emerge/FakeVartree.py  | 2 +-
 pym/_emerge/Scheduler.py| 2 +-
 pym/_emerge/depgraph.py | 4 ++--
 pym/portage/tests/resolver/test_changed_deps.py | 1 +
 pym/portage/tests/resolver/test_virtual_slot.py | 2 +-
 6 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/man/emerge.1 b/man/emerge.1
index 3198ba028..b292954a3 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -547,7 +547,7 @@ In dependency calculations, substitute the dependencies of 
installed
 packages with the dependencies of corresponding unbuilt ebuilds from
 source repositories. This causes the effective dependencies of
 installed packages to vary dynamically when source ebuild dependencies
-are modified. This option is enabled by default.
+are modified. This option is disabled by default.
 
 \fBWARNING:\fR
 If you want to disable \-\-dynamic\-deps, then it may be necessary to

diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py
index ebe07bba2..3f82e97e9 100644
--- a/pym/_emerge/FakeVartree.py
+++ b/pym/_emerge/FakeVartree.py
@@ -54,7 +54,7 @@ class FakeVartree(vartree):
is not a matching ebuild in the tree). Instances of this class are not
populated until the sync() method is called."""
def __init__(self, root_config, pkg_cache=None, pkg_root_config=None,
-   dynamic_deps=True, ignore_built_slot_operator_deps=False,
+   dynamic_deps=False, ignore_built_slot_operator_deps=False,
soname_deps=False):
self._root_config = root_config
self._dynamic_deps = dynamic_deps

diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 3a38cbafd..9bbc48e0a 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -352,7 +352,7 @@ class Scheduler(PollScheduler):
"""
self._set_graph_config(graph_config)
self._blocker_db = {}
-   dynamic_deps = self.myopts.get("--dynamic-deps", "y") != "n"
+   dynamic_deps = self.myopts.get("--dynamic-deps", "n") != "n"
ignore_built_slot_operator_deps = self.myopts.get(
"--ignore-built-slot-operator-deps", "n") == "y"
for root in self.trees:

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 6e5ca6508..27bec3b32 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -137,7 +137,7 @@ class _frozen_depgraph_config(object):
self.soname_deps_enabled = (
("--usepkgonly" in myopts or "remove" in params) and
params.get("ignore_soname_deps") != "y")
-   dynamic_deps = myopts.get("--dynamic-deps", "y") != "n"
+   dynamic_deps = myopts.get("--dynamic-deps", "n") != "n"
ignore_built_slot_operator_deps = myopts.get(
"--ignore-built-slot-operator-deps", "n") == "y"
for myroot in trees:
@@ -627,7 +627,7 @@ class depgraph(object):
for myroot in self._frozen_config.trees:
 
dynamic_deps = self._dynamic_config.myparams.get(
-   "dynamic_deps", "y") != "n"
+   "dynamic_deps", "n") != "n"
preload_installed_pkgs = \
"--nodeps" not in self._frozen_config.myopts
 

diff --git a/pym/portage/tests/resolver/test_changed_deps.py 
b/pym/portage/tests/resolver/test_changed_deps.py
index 2421c531f..420a00172 100644
--- a/pym/portage/tests/resolver/test_changed_deps.py
+++ b/pym/portage/tests/resolver/test_changed_deps.py
@@ -52,6 +52,7 @@ class ChangedDepsTestCase(TestCase):
options = {
"--update": True,
"--deep": True,
+   "--dynamic-deps": "y",
"--usepkg": True,
},
mergelist = ["app-misc/B-0"]

diff --git a/pym/portage/tests/resolver/test_virtual_slot.py 

[gentoo-commits] proj/portage:master commit in: pym/_emerge/, man/, pym/portage/tests/resolver/

2017-05-14 Thread Zac Medico
commit: 40505ceeadc769f4f01c66e52a19ce0bf2f59761
Author: Zac Medico  gentoo  org>
AuthorDate: Wed May 10 03:44:56 2017 +
Commit: Zac Medico  gentoo  org>
CommitDate: Sun May 14 18:11:45 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=40505cee

emerge: terminate backtracking early for autounmask changes (bug 615680)

Since autounmask changes are a strong indicator that backtracking
will ultimately fail to produce a solution, terminate early for
autounmask changes, and add a --autounmask-backtrack= option
to modify this behavior. The --autounmask-continue option implies
--autounmask-backtrack=y behavior, for backward compatibility.

When backtracking terminates early, the following warning message
is displayed after the autounmask change(s):

 * In order to avoid wasting time, backtracking has terminated early
 * due to the above autounmask change(s). The --autounmask-backtrack=y
 * option can be used to force further backtracking, but there is no
 * guarantee that it will produce a solution.

With this change, five of the existing cases fail unless
--autounmask-backtrack=y is added to the options. For each of
these cases, comments below the test case document how it behaves
with and without --autounmask-backtrack=y enabled.

X-Gentoo-bug: 615680
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=615680
Acked-by: Brian Dolbec  gentoo.org>

 man/emerge.1   | 10 ++-
 pym/_emerge/depgraph.py| 80 ++
 pym/_emerge/main.py|  6 ++
 pym/portage/tests/resolver/test_autounmask.py  | 57 ++-
 .../tests/resolver/test_autounmask_use_breakage.py | 40 +++
 .../test_slot_conflict_unsatisfied_deep_deps.py| 61 +
 6 files changed, 237 insertions(+), 17 deletions(-)

diff --git a/man/emerge.1 b/man/emerge.1
index f1a9d4f3f..94edc9095 100644
--- a/man/emerge.1
+++ b/man/emerge.1
@@ -363,12 +363,20 @@ the specified configuration file(s), or enable the
 \fBEMERGE_DEFAULT_OPTS\fR variable may be used to
 disable this option by default in \fBmake.conf\fR(5).
 .TP
+.BR "\-\-autounmask\-backtrack < y | n >"
+Allow backtracking after autounmask has detected that
+configuration changes are necessary. This option is not
+recommended, since it can cause a large amount of time to
+be wasted by backtracking calculations, even though there
+is no guarantee that it will produce a solution. This
+option is disabled by default.
+.TP
 .BR "\-\-autounmask\-continue [ y | n ]"
 Automatically apply autounmask changes to configuration
 files, and continue to execute the specified command. If
 the dependency calculation is not entirely successful, then
 emerge will simply abort without modifying any configuration
-files.
+files. This option implies \fB\-\-autounmask\-backtrack=y\fR.
 \fBWARNING:\fR
 This option is intended to be used only with great caution,
 since it is possible for it to make nonsensical configuration

diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index e1119af3c..53910dd25 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -444,6 +444,7 @@ class _dynamic_depgraph_config(object):
self._autounmask = 
depgraph._frozen_config.myopts.get('--autounmask') != 'n'
self._displayed_autounmask = False
self._success_without_autounmask = False
+   self._autounmask_backtrack_disabled = False
self._required_use_unsatisfied = False
self._traverse_ignored_deps = False
self._complete_mode = False
@@ -1129,7 +1130,8 @@ class depgraph(object):
 
self._show_merge_list()
 
-   self._dynamic_config._slot_conflict_handler = 
slot_conflict_handler(self)
+   if self._dynamic_config._slot_conflict_handler is None:
+   self._dynamic_config._slot_conflict_handler = 
slot_conflict_handler(self)
handler = self._dynamic_config._slot_conflict_handler
 
conflict = handler.get_conflict()
@@ -4243,17 +4245,7 @@ class depgraph(object):
# set below is reserved for cases where there are *zero* other
# problems. For reference, see backtrack_depgraph, where it 
skips the
# get_best_run() call when success_without_autounmask is True.
-
-   digraph_nodes = self._dynamic_config.digraph.nodes
-
-   if any(x in digraph_nodes for x in
-   self._dynamic_config._needed_unstable_keywords) or \
-   any(x in digraph_nodes for x in
-   self._dynamic_config._needed_p_mask_changes) or \
-   any(x in digraph_nodes for x in
-   self._dynamic_config._needed_use_config_changes) or \
-   any(x in digraph_nodes for x in
-