-
Notifications
You must be signed in to change notification settings - Fork 2
/
project_status.pl
executable file
·61 lines (51 loc) · 1.32 KB
/
project_status.pl
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
57
58
59
60
61
#!/usr/bin/perl -w
use strict;
use warnings;
use LWP::UserAgent;
use Data::Dumper;
my $ua = LWP::UserAgent->new;
$ua->agent("$0/0.1 " . $ua->agent);
my %Packages;
my %all;
my @repos = (['home:lbt:MINT', 'http://repo.pub.meego.com/home:/lbt:/MINT/Debian_6.0/Packages'],
['Project:MINT:Devel:BOSSlink', 'http://repo.pub.meego.com/Project:/MINT:/Devel:/BOSSlink/Debian_6.0/Packages'],
['Project:MINT:Testing', 'http://repo.pub.meego.com/Project:/MINT:/Testing/Debian_6.0/Packages'],
);
foreach my $repo (@repos) {
my $req = HTTP::Request->new(GET => $repo->[1]);
$req->header('Accept' => 'text/html');
# send request
my $res = $ua->request($req);
# check the outcome
my $pkg;
if ($res->is_success) {
open my $RH, '<', \$res->decoded_content;
while (<$RH>) {
if (/^Package: (.*)$/) {
$pkg = $1;
$all{$pkg}++;
next;
}
if (/^Version: (.*)$/) {
$Packages{$repo->[0]}->{$pkg} = $1;
}
}
}
else {
print "Error: " . $res->status_line . "\n";
}
}
printf "%-30s", "Package";
foreach my $repo (@repos) {
print "\t$repo->[0]";
}
print "\n";
foreach my $pkg (sort keys %all) {
printf "%-30s", $pkg;
foreach my $repo (@repos) {
print "\t";
print defined $Packages{$repo->[0]}->{$pkg}?$Packages{$repo->[0]}->{$pkg}:"-";
}
print "\n";
}
#print Dumper \%Packages;