On Sun, 3 Dec 2017 15:19:44 -0800
Zac Medico wrote:
> Since built-time deps tend to be a superset of run-time deps, evaluate
> disjunctive build-time deps before run-time deps, so that choices for
> build-time deps influence choices for run-time deps.
>
> Also, fix OnlydepsMinimalTestCase to specify ambiguous_merge_order,
> since the merge order is affected by the order of evaluation.
>
> Bug: https://bugs.gentoo.org/639346
> ---
> pym/_emerge/depgraph.py| 12 ++-
> .../resolver/test_disjunctive_depend_order.py | 87
> ++ .../tests/resolver/test_onlydeps_minimal.py
> | 5 +- 3 files changed, 98 insertions(+), 6 deletions(-)
> create mode 100644
> pym/portage/tests/resolver/test_disjunctive_depend_order.py
>
> diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
> index f54acdc26..6e5ca6508 100644
> --- a/pym/_emerge/depgraph.py
> +++ b/pym/_emerge/depgraph.py
> @@ -3234,7 +3234,15 @@ class depgraph(object):
> if ignore_hdepend_deps:
> edepend["HDEPEND"] = ""
>
> + # Since build-time deps tend to be a superset of
> run-time deps, order
> + # dep processing such that build-time deps are
> popped from
> + # _dep_disjunctive_stack first, so that choices for
> build-time
> + # deps influence choices for run-time deps (bug
> 639346). deps = (
> + (myroot, edepend["RDEPEND"],
> + self._priority(runtime=True)),
> + (myroot, edepend["PDEPEND"],
> + self._priority(runtime_post=True)),
> (depend_root, edepend["DEPEND"],
> self._priority(buildtime=True,
> optional=(pkg.built or
> ignore_depend_deps), @@ -3243,10 +3251,6 @@ class depgraph(object):
> self._priority(buildtime=True,
> optional=(pkg.built or
> ignore_hdepend_deps), ignored=ignore_hdepend_deps)),
> - (myroot, edepend["RDEPEND"],
> - self._priority(runtime=True)),
> - (myroot, edepend["PDEPEND"],
> - self._priority(runtime_post=True))
> )
>
> debug = "--debug" in self._frozen_config.myopts
> diff --git
> a/pym/portage/tests/resolver/test_disjunctive_depend_order.py
> b/pym/portage/tests/resolver/test_disjunctive_depend_order.py new
> file mode 100644 index 0..88f6dac2d --- /dev/null
> +++ b/pym/portage/tests/resolver/test_disjunctive_depend_order.py
> @@ -0,0 +1,87 @@
> +# Copyright 2017 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 DisjunctiveDependOrderTestCase(TestCase):
> +
> + def testDisjunctiveDependOrderTestCase(self):
> + ebuilds = {
> + 'virtual/jre-1.8': {
> + 'EAPI': '6',
> + 'SLOT' : '1.8',
> + 'RDEPEND' : '||
> ( dev-java/oracle-jre-bin:1.8 virtual/jdk:1.8 )',
> + },
> + 'virtual/jdk-1.8': {
> + 'EAPI': '6',
> + 'SLOT' : '1.8',
> + 'RDEPEND' : '|| ( dev-java/icedtea:8
> dev-java/oracle-jdk-bin:1.8 )',
> + },
> + 'dev-java/icedtea-3.6': {
> + 'SLOT' : '8',
> + },
> + 'dev-java/oracle-jdk-bin-1.8': {
> + 'SLOT' : '1.8',
> + },
> + 'dev-java/oracle-jre-bin-1.8': {
> + 'SLOT' : '1.8',
> + },
> + 'dev-db/hsqldb-1.8' : {
> + 'DEPEND' : 'virtual/jdk',
> + 'RDEPEND' : 'virtual/jre',
> + },
> + }
> +
> + binpkgs = {
> + 'dev-db/hsqldb-1.8' : {
> + 'DEPEND' : 'virtual/jdk',
> + 'RDEPEND' : 'virtual/jre',
> + },
> + }
> +
> + test_cases = (
> + # Test bug 639346, where a redundant jre
> implementation
> + # was pulled in because DEPEND was evaluated
> after
> + # RDEPEND.
> + ResolverPlaygroundTestCase(
> + ['dev-db/hsqldb'],
> + success=True,
> + mergelist=[
> + 'dev-java/icedtea-3.6',
> +