summaryrefslogtreecommitdiff
path: root/export-validation
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-12-22 23:31:45 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-12-22 23:48:12 +0100
commit11f24b61fad1b5cb7c4016dc5ecfd8132a198b23 (patch)
tree92ddedb9746ed356dbc1d4f0d7166540b2cf4d32 /export-validation
parenta0c3aeb943044cae4600fefb1528f871707215b0 (diff)
fdo#84600 Add script to download/build/install odfvalidator
Diffstat (limited to 'export-validation')
-rw-r--r--export-validation/README2
-rwxr-xr-xexport-validation/setup.sh60
2 files changed, 62 insertions, 0 deletions
diff --git a/export-validation/README b/export-validation/README
index 2488e464..9508d137 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 00000000..cfbecb76
--- /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: