annotate translate.pl @ 11:4eb9fdf4efa9

refactoring, non-working bookings
author cin
date Mon, 07 Sep 2015 19:18:21 +0300
parents 14a966369278
children 52b34ea50eff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
1 #!/usr/bin/perl -w
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
2
9
cc7244ab1b9f implemented time reports on bugs
cin
parents: 7
diff changeset
3 use IMPL::require {
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
4 BzClient => 'Benzin::Bugzilla::XmlRpcClient',
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
5 BugWriter => 'Benzin::Bugzilla::XmlWriter'
9
cc7244ab1b9f implemented time reports on bugs
cin
parents: 7
diff changeset
6 };
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
7 use YAML::XS qw(LoadFile Dump);
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
8 use XML::Writer;
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
9 use IPC::Run qw(start finish);
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
10
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
11 my $config = LoadFile("config.yaml");
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
12
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
13 if ( !( $config->{bugzilla}{url} =~ /\/$/ ) ) {
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
14 $config->{bugzilla}{url} .= "/";
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
15 }
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
16
9
cc7244ab1b9f implemented time reports on bugs
cin
parents: 7
diff changeset
17 my $bz = BzClient->new(
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
18 url => $config->{bugzilla}{url},
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
19 apikey => $config->{bugzilla}{apikey}
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
20 );
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
21
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
22 my $bugs = $config->{bugzilla}{bugs} or die "No bugs specified";
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
23 $bugs = [$bugs] unless ref $bugs eq 'ARRAY';
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
24
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
25 local (*HIN);
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
26
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
27 my $proc = start(
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
28 [ 'saxon8', '-novw', '-', 'bug-list.xsl' ],
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
29
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
30 #[ 'cat' ],
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
31 '<pipe', \*HIN, '>', \*STDOUT
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
32 ) or die "failed to create pipe: $!";
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
33
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
34 binmode *HIN, ":encoding(utf-8)";
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
35 my $writer =
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
36 BugWriter->new( OUTPUT => *HIN, DATA_INDENT => 2, DATA_MODE => 'on' );
11
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
37 $writer->timereports('on');
4eb9fdf4efa9 refactoring, non-working bookings
cin
parents: 10
diff changeset
38 $writer->timeresolution(0.25);
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
39
9
cc7244ab1b9f implemented time reports on bugs
cin
parents: 7
diff changeset
40 eval {
cc7244ab1b9f implemented time reports on bugs
cin
parents: 7
diff changeset
41 my %visited;
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
42
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
43 my $fetched = $bz->GetBugsHierarchy( { ids => [283] } );
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
44
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
45 $bz->PopulateBugsComments($fetched);
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
46 $bz->PopulateBugsHistory($fetched);
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
47
10
14a966369278 working version of exporting bugs from bugzilla in tj3 format (without bookings)
cin
parents: 9
diff changeset
48 $writer->WriteBugList($fetched);
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
49
9
cc7244ab1b9f implemented time reports on bugs
cin
parents: 7
diff changeset
50 };
cc7244ab1b9f implemented time reports on bugs
cin
parents: 7
diff changeset
51 warn Dump($@) and die $@ if $@;
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
52
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
53 close HIN;
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
54 finish($proc);
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
55
9
cc7244ab1b9f implemented time reports on bugs
cin
parents: 7
diff changeset
56 1;