summaryrefslogtreecommitdiffstats
path: root/t/02create_pkgs.t
blob: ff6dabbace03c2d43985b66c23de9194bc2d0995 (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
#!/usr/bin/perl

use strict;
use warnings;
use Test::More 'no_plan';

chdir 't' if -d 't';
system('rm -rf BUILD RPMS media');
for (qw(media BUILD RPMS RPMS/noarch)) {
    mkdir $_;
}
# locally build a test rpms
foreach my $spec (glob("SPECS/*.spec")) {
    system_("rpmbuild --quiet --define '_topdir .' -bb --clean $spec");
    my ($name) = $spec =~ m!([^/]*)\.spec$!;
    mkdir "media/$name";
    system_("mv RPMS/*/*.rpm media/$name");

    if ($name eq 'various') {
	system_("cp -r media/various media/various_nohdlist");
	system_("cp -r media/various media/various_no_subdir");
	system_("genhdlist --dest media/various_no_subdir");
    }

    system_("genhdlist --subdir media/$name/media_info media/$name");
}

sub system_ {
    my ($cmd) = @_;
    system($cmd);
    ok($? == 0, $cmd);
}