annotate translate.pl @ 6:2a5f38eb25a9

migrated to saxon8 as xslt processor fixed dependency calculation when a container has a dependency on his grandchild
author cin
date Wed, 02 Sep 2015 20:43:38 +0300
parents d2efec56373f
children 29309bc8d932
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
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
3 use JSON;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
4 use YAML::XS qw(LoadFile Dump);
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
5 use URI;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
6 use XML::Writer;
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
7 use IPC::Run qw(start finish);
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
8
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
9 our @ClassPath = qw(
d1400de5832b improved xsl
cin
parents: 0
diff changeset
10 /usr/share/java/xalan-j2-serializer.jar
d1400de5832b improved xsl
cin
parents: 0
diff changeset
11 /usr/share/java/xalan-j2.jar
d1400de5832b improved xsl
cin
parents: 0
diff changeset
12 /usr/share/java/xerces-j2.jar
d1400de5832b improved xsl
cin
parents: 0
diff changeset
13 /usr/share/java/xml-commons-resolver.jar
d1400de5832b improved xsl
cin
parents: 0
diff changeset
14 .
d1400de5832b improved xsl
cin
parents: 0
diff changeset
15 );
d1400de5832b improved xsl
cin
parents: 0
diff changeset
16
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
17 my $config = LoadFile("config.yaml");
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
18
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
19 if ( !( $config->{bugzilla}{url} =~ /\/$/ ) ) {
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
20 $config->{bugzilla}{url} .= "/";
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
21 }
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
22
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
23 my $bz = BzRest->new(
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
24 url => $config->{bugzilla}{url},
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
25 apikey => $config->{bugzilla}{apikey}
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
26 );
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
27
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
28 my @fields = qw(
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
29 id
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
30 summary
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
31 creation_time
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
32 last_change_time
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
33 creator
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
34 assigned_to
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
35
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
36 status
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
37 resolution
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
38
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
39 priority
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
40 severity
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
41 url
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
42
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
43 blocks
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
44 depends_on
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
45 cc
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
46
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
47 component
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
48 product
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
49 classification
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
50 version
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
51
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
52 actual_time
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
53 estimated_time
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
54 remainig_time
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
55 deadline
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
56 );
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
57
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
58 my %fieldsMap = (
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
59 summary => 'short_desc',
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
60 id => 'bug_id',
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
61 creator => 'reporter',
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
62 status => 'bug_status',
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
63 severity => 'bug_severity',
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
64 blocks => 'blocked',
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
65 depends_on => 'dependson',
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
66 creation_time => 'creation_ts',
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
67 last_change_time => 'delta_ts'
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
68 );
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
69
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
70 local (*HIN);
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
71
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
72 my $proc = start( [ 'saxon8', '-novw', '-', 'bug-list.xsl' ],
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
73 '<pipe', \*HIN, '>', \*STDOUT )
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
74 or die "failed to create pipe: $!";
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
75
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
76 my $writer = XML::Writer->new( OUTPUT => \*HIN, ENCODING => 'utf-8' );
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
77
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
78 $writer->xmlDecl("UTF-8");
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
79 $writer->startTag("bugzilla");
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
80
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
81 my %visited;
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
82 my @queue = (283);
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
83
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
84 while (@queue) {
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
85 @queue = grep not( $visited{$_}++ ), @queue;
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
86
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
87 last unless @queue;
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
88
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
89 print "#Fetching: ", join( ', ', @queue ), "\n";
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
90
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
91 my $bugs = $bz->GetBugs( { ids => \@queue } );
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
92
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
93 @queue = ();
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
94
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
95 foreach my $bug (@$bugs) {
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
96
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
97 push @queue, @{ $bug->{depends_on} }
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
98 if ( $bug->{depends_on} );
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
99
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
100 $writer->startTag("bug");
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
101 foreach my $field (@fields) {
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
102 next unless $bug->{$field};
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
103
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
104 my $tagName = $fieldsMap{$field} || $field;
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
105 my @values =
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
106 ref( $bug->{$field} )
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
107 && ref( $bug->{$field} ) eq 'ARRAY'
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
108 ? @{ $bug->{$field} }
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
109 : $bug->{$field};
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
110
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
111 foreach my $v (@values) {
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
112 $writer->dataElement( $tagName, $v );
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
113 }
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
114 }
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
115 $writer->endTag();
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
116
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
117 }
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
118 }
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
119
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
120 $writer->endTag();
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
121
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
122 close HIN;
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
123 finish($proc);
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
124
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
125 #xalan(
6
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
126 # in => \*OUT,
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
127 # out => \*STDOUT,
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
128 # params => [
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
129 #
2a5f38eb25a9 migrated to saxon8 as xslt processor
cin
parents: 5
diff changeset
130 # ]
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
131 #);
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
132
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
133 sub xalan {
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
134 my @params = @_;
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
135 return system 'java',
d1400de5832b improved xsl
cin
parents: 0
diff changeset
136 -cp => join( ':', @ClassPath ),
5
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
137 "org.apache.xalan.xslt.Process", @params;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
138 }
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
139
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
140 package BzRest;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
141 use fields qw(url apikey);
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
142 use LWP::UserAgent;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
143 use XMLRPC::Lite;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
144 use YAML::XS qw(Dump);
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
145
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
146 use constant { SELF => __PACKAGE__ };
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
147
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
148 sub new {
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
149 my $class = shift;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
150 $class = ref $class || $class;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
151
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
152 my $inst = fields::new($class);
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
153 $inst->CTOR(@_);
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
154
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
155 return $inst;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
156 }
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
157
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
158 sub CTOR {
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
159 my SELF $this = shift;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
160 my %params = @_;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
161
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
162 $this->{url} = $params{url} or die "An url is required";
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
163 $this->{apikey} = $params{apikey} if $params{apikey};
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
164 }
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
165
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
166 sub GetBug {
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
167 my SELF $this = shift;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
168 my $id = shift;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
169 my %params = @_;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
170
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
171 $params{api_key} = $this->{apikey};
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
172
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
173 my $bugurl = URI->new_abs( 'rest/bug/' . $id, $this->{url} );
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
174 $bugurl->query_form( \%params );
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
175
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
176 my $agent = LWP::UserAgent->new();
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
177 my $res = $agent->get($bugurl);
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
178
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
179 return $this->_AssertResponse( $res, $bugurl );
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
180 }
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
181
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
182 sub GetBugs {
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
183 my SELF $this = shift;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
184
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
185 return $this->CallXMLRPC( 'Bug.get', shift )->{bugs};
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
186 }
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
187
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
188 sub CallXMLRPC {
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
189 my SELF $this = shift;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
190 my ( $method, $params ) = @_;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
191
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
192 die "Method must be specified" unless $method;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
193 $params ||= {};
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
194
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
195 $params->{api_key} = $this->{apikey};
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
196 my $url = URI->new_abs( 'xmlrpc.cgi', $this->{url} );
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
197
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
198 my $result = XMLRPC::Lite->proxy($url)->call( $method, $params );
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
199
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
200 die $result->fault if $result->fault;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
201 return $result->result;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
202 }
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
203
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
204 sub _AssertResponse {
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
205 my SELF $this = shift;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
206 my ( $res, $url ) = @_;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
207
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
208 die "Failed to get any response: " . $url unless $res;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
209
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
210 die "Failed to fetch: " . $url . ": " . $res->code unless $res->is_success;
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
211
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
212 my $bug = JSON->new()->utf8()->decode( $res->content );
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
213
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
214 die "Bugzilla failed: " . $bug->{message} if $bug->{error};
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
215
d2efec56373f working buglist transform and bugs fetching
cin
parents: 1
diff changeset
216 return $bug->{bugs};
0
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
217 }
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
218
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
219 __END__
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
220
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
221 =pod
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
222
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
223 =head1 NAME
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
224
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
225 C<translate.pl> - translates bugzilla xml buglist to TaskJuggler format
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
226
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
227 =head1 METHODS
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
228
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
229 =head2 xalan(%args)
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
230
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
231 =over
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
232
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
233 =item * -IN
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
234
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
235 Input file
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
236
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
237 =item * -OUT
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
238
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
239 Output file
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
240
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
241 =item * -XSL
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
242
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
243 XSLT file
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
244
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
245 =back
8cae44c166d3 initial xslt and sample xml
cin
parents:
diff changeset
246
1
d1400de5832b improved xsl
cin
parents: 0
diff changeset
247 =cut