aboutsummaryrefslogtreecommitdiff
blob: 6ccd00bc0fe937108d13190904cd02d165106df7 (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
# 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 SlotOperatorRequiredUseTestCase(TestCase):
    def testSlotOperatorRequiredUse(self):
        ebuilds = {
            "app-misc/A-1": {"EAPI": "5", "SLOT": "0/1"},
            "app-misc/A-2": {"EAPI": "5", "SLOT": "0/2"},
            "app-misc/B-0": {
                "EAPI": "5",
                "RDEPEND": "app-misc/A:=",
                "IUSE": "x y",
                "REQUIRED_USE": "|| ( x y )",
            },
        }

        installed = {
            "app-misc/A-1": {"EAPI": "5", "SLOT": "0/1"},
            "app-misc/B-0": {
                "EAPI": "5",
                "RDEPEND": "app-misc/A:0/1=",
                "IUSE": "x y",
                "USE": "x",
            },
        }

        world = ["app-misc/B"]

        test_cases = (
            # bug 523048
            # Ensure that unsatisfied REQUIRED_USE is reported when
            # it blocks necessary slot-operator rebuilds.
            ResolverPlaygroundTestCase(
                ["app-misc/A"], success=False, required_use_unsatisfied=["app-misc/B:0"]
            ),
        )

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