summaryrefslogtreecommitdiffstats
path: root/t/superuser--split-transactions--strict-require-and-obsolete.t
blob: 0f8df7b50becfebe2322ed6f06e47fade7f020fe (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
#!/usr/bin/perl

# a requires b : bb or b
# bb requires c-1
# b requires c-2
# b obsoletes bb
#
# upgrading { bb, c-1 } to { b, c-2 } must be done in the same transaction,
# otherwise { c-1 } to { c-2 } implies removing { a, bb }
use strict;
use lib '.', 't';
use helper;
use urpm::util;
use Test::More 'no_plan';

need_root_and_prepare();

my $name = 'split-transactions--strict-require-and-obsolete';
urpmi_addmedia("$name-1 $::pwd/media/$name-1");    
urpmi_addmedia("$name-2 $::pwd/media/$name-2");

test('--split-length 0');
test('--split-level 1'); # was broken (#31969)

test_c('--split-length 0');
test_c('--split-level 1');

sub test {
    my ($option) = @_;

    urpmi("--media $name-1 --auto a");
    check_installed_fullnames('a-1-1', 'bb-1-1', 'c-1-1');

    urpmi("--media $name-2 $option --auto --auto-select");
    check_installed_fullnames_and_remove('a-1-1', 'b-2-1', 'c-2-1');
}

sub test_c {
    my ($option) = @_;

    urpmi("--media $name-1 --auto a");
    check_installed_fullnames('a-1-1', 'bb-1-1', 'c-1-1');

    #- below need the promotion of "b" (obsoleting bb) to work
    urpmi("--media $name-2 $option --auto c");
    check_installed_fullnames_and_remove('a-1-1', 'b-2-1', 'c-2-1');
}