summaryrefslogtreecommitdiffstats
path: root/t/superuser--srpm-bootstrapping.t
blob: e1823fc0037eb622b29aade84e225a2df76c8b31 (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
#!/usr/bin/perl

use strict;
use lib '.', 't';
use helper;
use Test::More 'no_plan';

need_root_and_prepare();

my $name = 'srpm-bootstrapping';

urpmi_addmedia("$name $::pwd/media/$name");
test("media/SRPMS-$name/$name-*.src.rpm");

urpmi_addmedia("$name-src $::pwd/media/SRPMS-$name");
test("--buildrequires $name");

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

    urpmi("--buildrequires --auto $para");
    check_installed_names($name); # check the buildrequires is installed
    #is(run_urpm_cmd('urpmq --auto-orphans'),''); # test for bug #52169

    install_src_rpm($para);
    check_installed_and_remove($name);
}

sub install_src_rpm {
    my ($para) = @_;
    
    system_('mkdir -p root/root/rpmbuild/SOURCES');

    $ENV{HOME} = '/root';
    urpmi("--install-src $para");

    system_("cmp root/root/rpmbuild/SPECS/$name.spec data/SPECS/$name.spec");
    system_('rm -rf root/usr/src/rpm');
}