aboutsummaryrefslogtreecommitdiff
blob: 689ed31d00ebc2f03755f3bbf1c313d4c7c11fd0 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# 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 SlotOperatorExclusiveSlotsTestCase(TestCase):

	def testSlotOperatorExclusiveSlots(self):

		ebuilds = {

			"media-libs/mesa-17.0.1" : {
				"EAPI": "6",
				"SLOT": "0",
				"RDEPEND": "<sys-devel/llvm-5:="
			},

			"sys-devel/clang-4.0.0" : {
				"EAPI": "6",
				"SLOT": "4",
				"RDEPEND": ("~sys-devel/llvm-4.0.0:4= "
					"!sys-devel/llvm:0 !sys-devel/clang:0"),
			},

			"sys-devel/clang-3.9.1-r100" : {
				"EAPI": "6",
				"SLOT": "0/3.9.1",
				"RDEPEND": "~sys-devel/llvm-3.9.1",
			},

			"sys-devel/llvm-4.0.0" : {
				"EAPI": "6",
				"SLOT": "4",
				"RDEPEND": "!sys-devel/llvm:0",
			},

			"sys-devel/llvm-3.9.1" : {
				"EAPI": "6",
				"SLOT": "0/3.91",
				"RDEPEND": "!sys-devel/llvm:0",
				"PDEPEND": "=sys-devel/clang-3.9.1-r100",
			},

		}

		installed = {

			"media-libs/mesa-17.0.1" : {
				"EAPI": "6",
				"SLOT": "0",
				"RDEPEND": "<sys-devel/llvm-5:0/3.9.1="
			},

			"sys-devel/clang-3.9.1-r100" : {
				"EAPI": "6",
				"SLOT": "0/3.9.1",
				"RDEPEND": "~sys-devel/llvm-3.9.1",
			},

			"sys-devel/llvm-3.9.1" : {
				"EAPI": "6",
				"SLOT": "0/3.9.1",
				"RDEPEND": "!sys-devel/llvm:0",
				"PDEPEND": "=sys-devel/clang-3.9.1-r100",
			},

		}

		world = ["sys-devel/clang", "media-libs/mesa"]

		test_cases = (

			# Test bug #612772, where slot operator rebuilds are not
			# properly triggered (for things like mesa) during a
			# llvm:0 to llvm:4 upgrade with clang, resulting in
			# unsolved blockers.
			ResolverPlaygroundTestCase(
				["@world"],
				options = {"--update": True, "--deep": True},
				success = True,
				ambiguous_merge_order = True,
				mergelist = [
					'sys-devel/llvm-4.0.0',
					'media-libs/mesa-17.0.1',
					(
						'sys-devel/clang-4.0.0',
						'[uninstall]sys-devel/llvm-3.9.1',
						'!sys-devel/llvm:0',
						'[uninstall]sys-devel/clang-3.9.1-r100',
						'!sys-devel/clang:0',
					)
				],
			),

		)

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


		world = ["media-libs/mesa"]

		test_cases = (

			# Test bug #612874, where a direct circular dependency
			# between llvm-3.9.1 and clang-3.9.1-r100 causes a
			# missed update from llvm:0 to llvm:4. Since llvm:4 does
			# not have a dependency on clang, the upgrade from llvm:0
			# to llvm:4 makes the installed sys-devel/clang-3.9.1-r100
			# instance eligible for removal by emerge --depclean, which
			# explains why clang does not appear in the mergelist.
			ResolverPlaygroundTestCase(
				["@world"],
				options = {"--update": True, "--deep": True},
				success = True,
				ambiguous_merge_order = True,
				mergelist = [
					'sys-devel/llvm-4.0.0',
					(
						'media-libs/mesa-17.0.1',
						'[uninstall]sys-devel/llvm-3.9.1',
						'!sys-devel/llvm:0',
					)
				],
			),

		)

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