[Libreoffice-commits] dev-tools.git: 2 commits - export-validation/README export-validation/setup.sh

Miklos Vajna vmiklos at collabora.co.uk
Mon Dec 22 14:48:32 PST 2014


 export-validation/README   |    2 +
 export-validation/setup.sh |   90 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+)

New commits:
commit 4aebb31a0368ecdc80086e42888a19b12095420c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Dec 22 23:48:01 2014 +0100

    fdo#84600 export-validation: add officeotron part

diff --git a/export-validation/setup.sh b/export-validation/setup.sh
index cfbecb7..d7fe6a5 100755
--- a/export-validation/setup.sh
+++ b/export-validation/setup.sh
@@ -28,6 +28,18 @@ if ! type -p mvn >/dev/null; then
     exit 1
 fi
 
+if ! type -p ant >/dev/null; then
+    echo "Error: can't find ant in PATH"
+
+    if [ -e /etc/os-release ]; then
+        . /etc/os-release
+        if [ "$NAME" == "openSUSE" ]; then
+            echo "Hint: type 'zypper in ant-junit' to install it."
+        fi
+    fi
+    exit 1
+fi
+
 instdir="$2"
 if [ ! -d "$instdir" ]; then
     echo "Error: please create '$instdir'."
@@ -57,4 +69,22 @@ java -Djavax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure/1.0=or
 EOF
 chmod +x odfvalidator
 
+# OOXML validation
+
+cd "$workdir"
+if [ ! -d officeotron ]; then
+    svn co http://officeotron.googlecode.com/svn/trunk officeotron
+fi
+cd officeotron
+if [ ! -e dist/officeotron-*.jar ]; then
+    ant
+fi
+
+cd "$instdir"
+cat > officeotron << EOF
+#!/usr/bin/env bash
+java -jar $workdir/officeotron/dist/officeotron-*.jar "\$@"
+EOF
+chmod +x officeotron
+
 # vi:set shiftwidth=4 expandtab:
commit 11f24b61fad1b5cb7c4016dc5ecfd8132a198b23
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Dec 22 23:31:45 2014 +0100

    fdo#84600 Add script to download/build/install odfvalidator

diff --git a/export-validation/README b/export-validation/README
index 2488e46..9508d13 100644
--- a/export-validation/README
+++ b/export-validation/README
@@ -3,5 +3,7 @@ We use ODF Validator [1] for ODF export validation and officeotron [2] for OOXML
 Both tools should be available through a wrapper script that is in the path and is called officeotron respectively
 odfvalidator and should have a form similar to the ones of the two scripts in this directory.
 
+Use the 'setup.sh' script in this directory if you want to set them up automatically.
+
 [1] http://incubator.apache.org/odftoolkit/conformance/ODFValidator.html
 [2] https://code.google.com/p/officeotron/
diff --git a/export-validation/setup.sh b/export-validation/setup.sh
new file mode 100755
index 0000000..cfbecb7
--- /dev/null
+++ b/export-validation/setup.sh
@@ -0,0 +1,60 @@
+#!/bin/bash -e
+
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+# Run this script to download, build and install the validators.
+
+if [ -z "$1" -o -z "$2" ]; then
+    echo "Usage: $0 <workdir> <instdir>"
+    echo
+    echo "Example: $0 $HOME/scm/svn /opt/lo/bin"
+    exit 1
+fi
+
+if ! type -p mvn >/dev/null; then
+    echo "Error: can't find mvn in PATH"
+
+    if [ -e /etc/os-release ]; then
+        . /etc/os-release
+        if [ "$NAME" == "openSUSE" ]; then
+            echo "Hint: type 'zypper -p http://download.opensuse.org/repositories/devel:/tools:/building/openSUSE_$VERSION_ID/ in maven' to install it."
+        fi
+    fi
+    exit 1
+fi
+
+instdir="$2"
+if [ ! -d "$instdir" ]; then
+    echo "Error: please create '$instdir'."
+    exit 1
+fi
+
+workdir="$1"
+if [ ! -d "$workdir" ]; then
+    mkdir -p "$workdir"
+fi
+
+# ODF validation
+
+cd "$workdir"
+if [ ! -d odf ]; then
+    svn co https://svn.apache.org/repos/asf/incubator/odf/trunk odf
+fi
+cd odf
+if [ ! -e validator/target/odfvalidator-*-incubating-SNAPSHOT-jar-with-dependencies.jar ]; then
+    mvn install -DskipTests
+fi
+
+cd "$instdir"
+cat > odfvalidator << EOF
+#!/usr/bin/env bash
+java -Djavax.xml.validation.SchemaFactory:http://relaxng.org/ns/structure/1.0=org.iso_relax.verifier.jaxp.validation.RELAXNGSchemaFactoryImpl -Dorg.iso_relax.verifier.VerifierFactoryLoader=com.sun.msv.verifier.jarv.FactoryLoaderImpl -jar $workdir/odf/validator/target/odfvalidator-*-incubating-SNAPSHOT-jar-with-dependencies.jar -e "\$@"
+EOF
+chmod +x odfvalidator
+
+# vi:set shiftwidth=4 expandtab:


More information about the Libreoffice-commits mailing list