0
|
1 #!/usr/bin/perl -w
|
|
2
|
9
|
3 use IMPL::require {
|
|
4 BzClient => 'Benzin::Bugzilla::XmlRpcClient',
|
|
5 Bug => 'Benzin::Bugzilla::Bug'
|
|
6 };
|
5
|
7 use YAML::XS qw(LoadFile Dump);
|
|
8 use XML::Writer;
|
6
|
9 use IPC::Run qw(start finish);
|
5
|
10
|
1
|
11 our @ClassPath = qw(
|
|
12 /usr/share/java/xalan-j2-serializer.jar
|
|
13 /usr/share/java/xalan-j2.jar
|
|
14 /usr/share/java/xerces-j2.jar
|
|
15 /usr/share/java/xml-commons-resolver.jar
|
|
16 .
|
|
17 );
|
|
18
|
5
|
19 my $config = LoadFile("config.yaml");
|
|
20
|
|
21 if ( !( $config->{bugzilla}{url} =~ /\/$/ ) ) {
|
|
22 $config->{bugzilla}{url} .= "/";
|
|
23 }
|
|
24
|
9
|
25 my $bz = BzClient->new(
|
5
|
26 url => $config->{bugzilla}{url},
|
|
27 apikey => $config->{bugzilla}{apikey}
|
|
28 );
|
|
29
|
6
|
30 local (*HIN);
|
|
31
|
|
32 my $proc = start( [ 'saxon8', '-novw', '-', 'bug-list.xsl' ],
|
|
33 '<pipe', \*HIN, '>', \*STDOUT )
|
|
34 or die "failed to create pipe: $!";
|
|
35
|
9
|
36 eval {
|
|
37 my %visited;
|
|
38 my @queue = (283);
|
|
39 my @fetched;
|
6
|
40
|
9
|
41 while (@queue) {
|
|
42 @queue = grep not( $visited{$_}++ ), @queue;
|
6
|
43
|
9
|
44 last unless @queue;
|
6
|
45
|
9
|
46 print "#Fetching: ", join( ', ', @queue ), "\n";
|
6
|
47
|
9
|
48 my $bugs = $bz->GetBugs( { ids => \@queue } );
|
|
49 @queue = ();
|
6
|
50
|
9
|
51 foreach my $bug (@$bugs) {
|
6
|
52
|
9
|
53 push @queue, @{ $bug->{depends_on} }
|
|
54 if ( $bug->{depends_on} );
|
|
55 push @fetched, $bug;
|
|
56 }
|
|
57 }
|
|
58 print Dump( \@fetched );
|
6
|
59
|
9
|
60 $bz->PopulateBugsWithComments( \@fetched );
|
|
61 $bz->PopulateBugsHistory( \@fetched );
|
6
|
62
|
9
|
63 print Dump( [ map $_->GetTimeReports(0.25), @fetched ] );
|
5
|
64
|
9
|
65 };
|
|
66 warn Dump($@) and die $@ if $@;
|
5
|
67
|
6
|
68 close HIN;
|
|
69 finish($proc);
|
5
|
70
|
9
|
71 1;
|