aboutsummaryrefslogtreecommitdiff
blob: e85f4399d56a4c90d4171c1487bda9cb596d2800 (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
# Copyright 2015 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 SonameDepcleanTestCase(TestCase):
    def testSonameDepclean(self):
        installed = {
            "app-misc/A-1": {
                "RDEPEND": "dev-libs/B",
                "DEPEND": "dev-libs/B",
                "REQUIRES": "x86_32: libB.so.1 libc.so.6",
            },
            "dev-libs/B-1": {
                "PROVIDES": "x86_32: libB.so.1",
            },
            "sys-libs/glibc-2.19-r1": {"PROVIDES": "x86_32: libc.so.6"},
        }

        world = ("app-misc/A",)

        test_cases = (
            ResolverPlaygroundTestCase(
                [],
                options={
                    "--depclean": True,
                    "--ignore-soname-deps": "n",
                },
                success=True,
                cleanlist=[],
            ),
            ResolverPlaygroundTestCase(
                [],
                options={
                    "--depclean": True,
                    "--ignore-soname-deps": "y",
                },
                success=True,
                cleanlist=["sys-libs/glibc-2.19-r1"],
            ),
        )

        playground = ResolverPlayground(debug=False, 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:
            # Disable debug so that cleanup works.
            playground.debug = False
            playground.cleanup()