# HG changeset patch
# User cin
# Date 1441215818 -10800
# Node ID 2a5f38eb25a94ca9902cf11182a02017f68d6c59
# Parent d2efec56373f9a2bfcc1b844f8522d9716112a06
migrated to saxon8 as xslt processor
fixed dependency calculation when a container has a dependency on his grandchild
diff -r d2efec56373f -r 2a5f38eb25a9 .hgignore
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore Wed Sep 02 20:43:38 2015 +0300
@@ -0,0 +1,3 @@
+syntax: glob
+config.yaml
+resources.xml
diff -r d2efec56373f -r 2a5f38eb25a9 bug-list.xsl
--- a/bug-list.xsl Tue Sep 01 19:47:30 2015 +0300
+++ b/bug-list.xsl Wed Sep 02 20:43:38 2015 +0300
@@ -51,6 +51,7 @@
+
@@ -61,12 +62,14 @@
+
-
-
+
+
+
@@ -83,22 +86,25 @@
+ level="{$parent/@level}">
+
+
-
+
-
+
+
@@ -120,8 +126,9 @@
+
+ select="dependson[not(text() = exsl:node-set($parents)/bug/parent[@id=$id]/@bugid)][key('bugid', .)]" />
@@ -132,7 +139,7 @@
-
+
@@ -141,6 +148,8 @@
+
@@ -152,11 +161,12 @@
-
+
-
-
+
+
@@ -175,8 +185,7 @@
-
+
@@ -186,6 +195,7 @@
select="$details/estimated_time | $details/actual_time | $details/remaining_time | $details/assigned_to"
mode="task-details">
+
@@ -196,6 +206,7 @@
+
@@ -243,13 +254,17 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -376,7 +391,7 @@
-
+
diff -r d2efec56373f -r 2a5f38eb25a9 translate.pl
--- a/translate.pl Tue Sep 01 19:47:30 2015 +0300
+++ b/translate.pl Wed Sep 02 20:43:38 2015 +0300
@@ -4,7 +4,7 @@
use YAML::XS qw(LoadFile Dump);
use URI;
use XML::Writer;
-use IPC::Run qw(run);
+use IPC::Run qw(start finish);
our @ClassPath = qw(
/usr/share/java/xalan-j2-serializer.jar
@@ -25,78 +25,109 @@
apikey => $config->{bugzilla}{apikey}
);
-my $bugs = $bz->GetBugs( { ids => [ 283, 284 ] } );
+my @fields = qw(
+ id
+ summary
+ creation_time
+ last_change_time
+ creator
+ assigned_to
+
+ status
+ resolution
-my @fields = qw(
- id
- creation_time
- last_change_time
- creator
- assigned_to
-
- status
- resolution
-
- priority
- severity
- url
-
- blocks
- depends_on
- cc
-
- component
- product
- classification
- version
-
- actual_time
- estimated_time
- remainig_time
- deadline
+ priority
+ severity
+ url
+
+ blocks
+ depends_on
+ cc
+
+ component
+ product
+ classification
+ version
+
+ actual_time
+ estimated_time
+ remainig_time
+ deadline
);
my %fieldsMap = (
- id => 'bug_id',
- creator => 'reporter',
- status => 'bug_status',
- severity => 'bug_severity',
- blocks => 'blocked',
- depends_on => 'dependson',
- creation_time => 'creation_ts',
+ summary => 'short_desc',
+ id => 'bug_id',
+ creator => 'reporter',
+ status => 'bug_status',
+ severity => 'bug_severity',
+ blocks => 'blocked',
+ depends_on => 'dependson',
+ creation_time => 'creation_ts',
last_change_time => 'delta_ts'
);
-my $writer = XML::Writer->new( OUTPUT => \*STDOUT, ENCODING => 'utf-8' );
+local (*HIN);
+
+my $proc = start( [ 'saxon8', '-novw', '-', 'bug-list.xsl' ],
+ '', \*STDOUT )
+ or die "failed to create pipe: $!";
+
+my $writer = XML::Writer->new( OUTPUT => \*HIN, ENCODING => 'utf-8' );
$writer->xmlDecl("UTF-8");
$writer->startTag("bugzilla");
-foreach my $bug ( @$bugs ) {
- $writer->startTag("bug");
- foreach my $field ( @fields ) {
- next unless $bug->{$field};
-
- my $tagName = $fieldsMap{$field} || $field;
- my @values = ref($bug->{$field}) && ref($bug->{$field}) eq 'ARRAY' ? @{$bug->{$field}} : $bug->{$field};
-
- foreach my $v (@values) {
- $writer->dataElement($tagName, $v);
+my %visited;
+my @queue = (283);
+
+while (@queue) {
+ @queue = grep not( $visited{$_}++ ), @queue;
+
+ last unless @queue;
+
+ print "#Fetching: ", join( ', ', @queue ), "\n";
+
+ my $bugs = $bz->GetBugs( { ids => \@queue } );
+
+ @queue = ();
+
+ foreach my $bug (@$bugs) {
+
+ push @queue, @{ $bug->{depends_on} }
+ if ( $bug->{depends_on} );
+
+ $writer->startTag("bug");
+ foreach my $field (@fields) {
+ next unless $bug->{$field};
+
+ my $tagName = $fieldsMap{$field} || $field;
+ my @values =
+ ref( $bug->{$field} )
+ && ref( $bug->{$field} ) eq 'ARRAY'
+ ? @{ $bug->{$field} }
+ : $bug->{$field};
+
+ foreach my $v (@values) {
+ $writer->dataElement( $tagName, $v );
+ }
}
+ $writer->endTag();
+
}
- $writer->endTag();
}
$writer->endTag();
-
+close HIN;
+finish($proc);
#xalan(
-# -IN => "bug-list2.xml",
-# -XSL => "bug-list.xsl",
-# -URIRESOLVER => "org.apache.xml.resolver.tools.CatalogResolver",
-# -ENTITYRESOLVER => "org.apache.xml.resolver.tools.CatalogResolver",
-# -PARAM => (chargeset => "dev")
+# in => \*OUT,
+# out => \*STDOUT,
+# params => [
+#
+# ]
#);
sub xalan {