Hello community,

here is the log from the commit of package saxon6 for openSUSE:Factory checked 
in at 2013-08-18 22:24:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/saxon6 (Old)
 and      /work/SRC/openSUSE:Factory/.saxon6.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "saxon6"

Changes:
--------
--- /work/SRC/openSUSE:Factory/saxon6/saxon6.changes    2013-07-16 
17:02:37.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.saxon6.new/saxon6.changes       2013-08-18 
22:24:01.000000000 +0200
@@ -1,0 +2,9 @@
+Mon Aug 12 08:55:15 UTC 2013 - [email protected]
+
+- implement batch support for saxon: saxon-batch
+  * requested by docu team
+  * adds saxon6-batch script with new -batch/-style arguments, which
+    allows to proceed more XML files per one JVM launch removing the
+    bootleneck in docu build
+
+-------------------------------------------------------------------

New:
----
  saxon6-batch.patch
  saxon6.saxon-batch.script

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ saxon6.spec ++++++
--- /var/tmp/diff_new_pack.1pzdzy/_old  2013-08-18 22:24:02.000000000 +0200
+++ /var/tmp/diff_new_pack.1pzdzy/_new  2013-08-18 22:24:02.000000000 +0200
@@ -31,12 +31,16 @@
 Source2:        %{name}.build.script
 Source3:        %{name}.1
 Source4:        http://www.xml.com/2000/08/09/xslt/StructXmlParser.java
+# implementes batch based interface to saxon6, SUSE specific
+Source5:        saxon6.saxon-batch.script
 Patch2:         %{name}-cmdlinefix.patch
 #PATCH-FIX-OPENSUSE: jdk7+ assumes ASCII as default encoding, so iso-8859-1 
does not work by default
 Patch3:         saxon-javac-encoding.patch
 #PATCH-FIX-OPENSUSE: bnc#739498 - backport changes from 
com/icl/saxon/aelfred/XmlParser.java
 # to older version released under more permissive license
 Patch4:         saxon-add-fixes-from-com-isl-saxon-aelfred.patch
+#PATCH-FIX-OPENSUSE: implements batch mode in which saxon is capable to 
proceed more files per one JVM launch
+Patch5:         saxon6-batch.patch
 BuildRequires:  fop >= 0.20.1
 BuildRequires:  jdom >= 1.0
 BuildRequires:  jpackage-utils >= 1.6
@@ -52,8 +56,6 @@
 %endif
 Requires:       /usr/sbin/update-alternatives
 Requires:       jaxp_parser_impl
-Recommends:     %{name}-scripts
-Recommends:     xml-commons-resolver
 Provides:       jaxp_transform_impl = %{name}-%{version}
 # bnc#780666
 Provides:       saxon
@@ -159,6 +161,7 @@
 %patch2 -p0
 %patch3 -p1
 %patch4 -p0
+%patch5 -p1
 cp XmlParser.java com/icl/saxon/aelfred/XmlParser.java
 # cleanup unnecessary stuff we'll build ourselves
 rm -rf *.jar docs/api
@@ -193,6 +196,8 @@
 sed 's,__RESOLVERDIR__,%{resolverdir},' < %{SOURCE1} \
   > %{buildroot}%{_bindir}/%{name}
 ln -s %{name} %{buildroot}%{_bindir}/saxon
+sed 's,__RESOLVERDIR__,%{resolverdir},' < %{SOURCE5} \
+  > %{buildroot}%{_bindir}/%{name}-batch
 
 mkdir -p %{buildroot}%{_mandir}/man1
 sed 's,__RESOLVERDIR__,%{resolverdir},' < %{SOURCE3} \
@@ -251,6 +256,7 @@
 %files scripts
 %defattr(0755,root,root,0755)
 %{_bindir}/%{name}
+%{_bindir}/%{name}-batch
 %{_bindir}/saxon
 %attr(0644,root,root) %{_mandir}/man1/%{name}.1*
 


++++++ saxon6-batch.patch ++++++
---
 com/icl/saxon/StyleSheetBatch.java |  160 +++++++++++++++++++++++++++++++++++++
 1 file changed, 160 insertions(+)

Index: saxon6-6.5.5/com/icl/saxon/StyleSheetBatch.java
===================================================================
--- /dev/null
+++ saxon6-6.5.5/com/icl/saxon/StyleSheetBatch.java
@@ -0,0 +1,160 @@
+/**
+  * This <B>StyleSheetBatch</B> class supports multiple input/output files 
proceed by StyleSheet.main().
+  * It does work around the performance problems when running an extra 
saxon/JVM process for each file<p>
+  *
+  * The XSLT syntax supported conforms to the W3C XSLT 1.0 and XPath 1.0 
recommendation.
+  * Only the transformation language is implemented (not the formatting 
objects).
+  * Saxon extensions are documented in the file extensions.html
+  *
+  * @author Michal Vyskocil
+  */
+
+package com.icl.saxon;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileNotFoundException;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Vector;
+
+public class StyleSheetBatch {
+
+    protected static String toString(List<String> lst) {
+        StringBuilder sb = new StringBuilder();
+        for (String s: lst) {
+            sb.append(s);
+            sb.append(", ");
+        }
+        return sb.toString();
+    }
+
+    public static void main (String args[])
+        throws java.lang.Exception {
+
+        int i = -1;
+        int bi = -1;    // -batch index
+        int si = -1;    // -style index
+        int pi = 65536; // param=value lowest index
+        String batchFileName = null;
+        String styleFileName = null;
+        String line = null;
+        String foo[] = null;
+        List<String> alist = null;
+        List<String> arglist = null;
+        File batchFile = null;
+        BufferedReader batchReader = null;
+
+        Boolean have_params = false;
+
+        if (args.length == 0) {
+            System.err.println("All arguments are missing, type saxon6 for 
help");
+            System.exit(1);
+        }
+
+        for(i = 0; i != args.length; i++) {
+            if (args[i].equals("-batch")) {
+                bi = i;
+                i++;
+                if (args.length < i+1) {
+                    System.err.println("No batch file specified after -batch 
argument");
+                    System.exit(1);
+                }
+                batchFileName = args[i];
+            }
+            if (args[i].equals("-style")) {
+                si = i;
+                i++;
+                if (args.length < i+1) {
+                    System.err.println("No xsl file specified after -style 
argument");
+                    System.exit(1);
+                }
+                styleFileName = args[i];
+            }
+        }
+
+        if (batchFileName == null) {
+            System.err.println("No batch file specified, call saxon6-batch 
with -batch <filename> -style <file.xsl> arguments");
+            System.exit(1);
+        }
+
+        // remove -batch <filename> from args
+        alist = new Vector<String>(args.length - 4);
+        for(i = 0; i != args.length; i++) {
+            //System.err.println(String.format("DEBUG: processing args[%d]: 
%s", i, args[i]));
+            if ((i == bi) || (i == bi + 1) || (i == si) || (i == si + 1)) {
+                //System.err.println(String.format("DEBUG: skipped args[%d]: 
%s", i, args[i]));
+                continue;
+            }
+            //System.err.println(String.format("DEBUG: added args[%d]: %s", i, 
args[i]));
+            alist.add(args[i]);
+        }
+
+        // get the index of first param
+        i = 0;
+        for (String s: alist) {
+            if (s.indexOf('=') != -1) {
+                pi = i;
+                have_params = true;
+                break;
+            }
+            i++;
+        }
+
+        batchFile = new File(batchFileName);
+
+        if (!batchFile.canRead()) {
+            System.err.println(String.format("Cannot read batch-file ``%s''", 
batchFileName));
+            return;
+        }
+
+        try {
+            batchReader = new BufferedReader(new FileReader(batchFile));
+        } catch (FileNotFoundException fnfe) {
+            System.err.println(String.format("Cannot read batch-file ``%s''", 
batchFileName));
+            return;
+        }
+
+        try {
+
+            while ((line = batchReader.readLine()) != null) {
+
+                foo = line.split(";", 2);
+                arglist = new Vector<String>(4+alist.size());
+                //output file
+                arglist.add("-o");
+                arglist.add(foo[1]);
+                if (have_params) {
+                    //System.err.println(String.format("DEBUG: 
arglist.addAll(alist.subList(0, %d))", pi-1));
+                    // everything up to first property
+                    arglist.addAll(alist.subList(0, pi-1));
+                }
+                else {
+                    arglist.addAll(alist);
+                }
+                // add inp file
+                arglist.add(foo[0]);
+                // add stylesheet
+                arglist.add(styleFileName);
+                if (have_params) {
+                    // add all properties
+                    arglist.addAll(alist.subList(pi, alist.size()));
+                }
+
+                //System.err.println("DEBUG: call 
com.icl.saxon.StyleSheet.main(" + toString(arglist));
+
+                StyleSheet.main(arglist.toArray(new String[0]));
+
+            }
+
+        } catch (IOException ioe) {
+            System.err.println(String.format("Can't read from ``%s''", 
batchFileName));
+            return;
+        }
+
+    }
+
+}
++++++ saxon6.saxon-batch.script ++++++
#!/bin/sh
# 
# saxon script
# JPackage Project <http://www.jpackage.org/>

. /usr/share/java-utils/java-functions

MAIN_CLASS=com.icl.saxon.StyleSheetBatch

BASE_JARS="saxon6.jar xml-commons-apis.jar jaxp_parser_impl.jar"

# Optional jars
CLASSPATH="$CLASSPATH:"$(build-classpath docbook-xsl-saxon saxon-fop \
  avalon-logkit xml-commons-resolver 2>/dev/null) || :

# If we have resolver, add the CatalogManager.properties dir to CLASSPATH,
# and tweak command line options so that it's used.
args=
if echo "$CLASSPATH" | grep xml-commons-resolver >/dev/null 2>&1 ; then
  CLASSPATH="$CLASSPATH:__RESOLVERDIR__"
  # Tune options to use resolver.
  r=org.apache.xml.resolver.tools.ResolvingXMLReader
  for opt in -x -y ; do
    if ! echo $@ | grep "\\$opt " >/dev/null 2>&1 ; then
      args="$args $opt $r"
    fi
  done
  r=org.apache.xml.resolver.tools.CatalogResolver
  if ! echo $@ | grep "\\-r " >/dev/null 2>&1 ; then
    args="$args -r $r"
  fi
fi

# Set parameters
set_jvm
set_classpath $BASE_JARS
set_flags $BASE_FLAGS
set_options $BASE_OPTIONS

# Let's start
run $args "$@"
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to