aboutsummaryrefslogtreecommitdiff
blob: 17394162963dc2d794aea6d3d16ef657f1e973fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Copyright 2014 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 AutounmaskUseBreakageTestCase(TestCase):

	def testAutounmaskUseBreakage(self):

		ebuilds = {

			"app-misc/A-0" : {
				"EAPI": "5",
				"RDEPEND": "app-misc/D[-foo]",
			},

			"app-misc/B-0" : {
				"EAPI": "5",
				"RDEPEND": "app-misc/D[foo]"
			},

			"app-misc/C-0" : {
				"EAPI": "5",
				"RDEPEND": ">=app-misc/D-1"
			},

			"app-misc/D-0" : {
				"EAPI": "5",
				"IUSE": "foo"
			},

			"app-misc/D-1" : {
				"EAPI": "5",
				"IUSE": "bar"
			},

		}

		test_cases = (

			# Bug 510270
			# _solve_non_slot_operator_slot_conflicts throws
			# IndexError: tuple index out of range
			# due to autounmask USE breakage.
			ResolverPlaygroundTestCase(
				["app-misc/C", "app-misc/B", "app-misc/A"],
				options={"--autounmask-backtrack": "y"},
				all_permutations = True,
				success = False,
				ambiguous_slot_collision_solutions = True,
				slot_collision_solutions = [None, []]
			),

			# With --autounmask-backtrack=y:
			#emerge: there are no ebuilds built with USE flags to satisfy "app-misc/D[foo]".
			#!!! One of the following packages is required to complete your request:
			#- app-misc/D-0::test_repo (Change USE: +foo)
			#(dependency required by "app-misc/B-0::test_repo" [ebuild])
			#(dependency required by "app-misc/B" [argument])

			# Without --autounmask-backtrack=y:
			#[ebuild  N     ] app-misc/D-0  USE="foo"
			#[ebuild  N     ] app-misc/D-1  USE="-bar"
			#[ebuild  N     ] app-misc/C-0
			#[ebuild  N     ] app-misc/B-0
			#[ebuild  N     ] app-misc/A-0
			#
			#!!! Multiple package instances within a single package slot have been pulled
			#!!! into the dependency graph, resulting in a slot conflict:
			#
			#app-misc/D:0
			#
			#  (app-misc/D-0:0/0::test_repo, ebuild scheduled for merge) pulled in by
			#    app-misc/D[-foo] required by (app-misc/A-0:0/0::test_repo, ebuild scheduled for merge)
			#               ^^^^
			#    app-misc/D[foo] required by (app-misc/B-0:0/0::test_repo, ebuild scheduled for merge)
			#               ^^^
			#
			#  (app-misc/D-1:0/0::test_repo, ebuild scheduled for merge) pulled in by
			#    >=app-misc/D-1 required by (app-misc/C-0:0/0::test_repo, ebuild scheduled for merge)
			#    ^^           ^
			#
			#The following USE changes are necessary to proceed:
			# (see "package.use" in the portage(5) man page for more details)
			## required by app-misc/B-0::test_repo
			## required by app-misc/B (argument)
			#=app-misc/D-0 foo

			# NOTE: The --autounmask-backtrack=n output is preferable here,
			# because it highlights the unsolvable dependency conflict.
			# It would be better if it eliminated the autounmask suggestion,
			# since that suggestion won't solve the conflict.
		)

		playground = ResolverPlayground(ebuilds=ebuilds, 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()