blob: bc6036e6aec499c58a35bb48d66e3e1adacd0d4b (
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
|
#!/usr/bin/perl -w
use strict;
use File::Temp qw(tempfile);
use Youri::Package::RPM::Updater;
use LWP::UserAgent;
use MDK::Common;
use Cwd;
my $status_page = 'http://pkgsubmit.mageia.org/';
my $svn_root = 'svn+ssh://svn.mageia.org/svn/packages/cauldron/';
my $commit_msg = 'Distro Rebuild';
my $bs_max_todo_queue = 5;
my $updater = Youri::Package::RPM::Updater->new;
my ($ci_fh, $ci_fname) = tempfile(UNLINK => 1);
print $ci_fh $commit_msg;
close $ci_fh;
sub list_from_file {
chomp_(cat_($_[0]));
}
sub get_bs_queue_todo() {
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(HEAD => $status_page);
my $res = $ua->request($req);
return $res->is_success ? $res->header('X-BS-Queue-Todo') : 9999;
}
sub bump_release {
my ($pkgname) = @_;
my $oldcwd = getcwd();
my $tmpdir = File::Temp->newdir;
chdir $tmpdir->dirname;
system('svn', 'co', "${svn_root}/${pkgname}/current");
chdir 'current';
$updater->update_from_spec(glob('SPECS/*.spec'));
system('svn', 'ci', '--file', $ci_fname);
chdir $oldcwd;
}
sub submit_package {
my ($pkgname) = @_;
while (get_bs_queue_todo() > $bs_max_todo_queue) {
sleep 20;
}
system('mgarepo', 'submit', $pkgname);
}
my @packages_list = list_from_file($ARGV[0]);
foreach (@packages_list) {
bump_release($_);
submit_package($_);
}
|