[Libreoffice-commits] .: solenv/bin solenv/inc
Caolán McNamara
caolan at kemper.freedesktop.org
Fri Jan 7 12:44:39 PST 2011
solenv/bin/striplanguagetags.sh | 39 +++++++++++++++
solenv/inc/_tg_zip.mk | 100 ++++++++++++++++++++++++++++++++++++++++
solenv/inc/tg_zip.mk | 10 ++++
3 files changed, 149 insertions(+)
New commits:
commit f25830734461140c7dd9747f1e096fefe066ba66
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jan 7 20:43:27 2011 +0000
Resolves: fdo#32897 strip out template language tags
diff --git a/solenv/bin/striplanguagetags.sh b/solenv/bin/striplanguagetags.sh
new file mode 100755
index 0000000..95aa3a7
--- /dev/null
+++ b/solenv/bin/striplanguagetags.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+#take a .zip containing a flat hierarchy of odf files and strip out the
+#language and country tags in each of them and repack it all up
+#should convert templates so that documents based on them use
+#the default-document-language rather than the hardcoded lang-tag
+
+#All a bit hacky, but it should work
+
+XSL=`mktemp`
+
+cat > $XSL << EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
+
+<xsl:template match="node()|@*">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+</xsl:template>
+
+<xsl:template match="@fo:language"/>
+<xsl:template match="@fo:country"/>
+
+</xsl:stylesheet>
+EOF
+
+WRKDIR=`mktemp -d`
+unzip -q $1 -d $WRKDIR
+pushd $WRKDIR
+for a in *; do
+ unzip -qc $a styles.xml > styles.tmp
+ eval "$CALLXSLTPROC -o styles.xml $XSL styles.tmp"
+ zip -qr $a styles.xml
+ rm styles.xml styles.tmp
+done
+popd
+zip -qrj $1 $WRKDIR
+rm -rf $WRKDIR
+rm -f $XSL
diff --git a/solenv/inc/_tg_zip.mk b/solenv/inc/_tg_zip.mk
index 608819d..8d74896 100644
--- a/solenv/inc/_tg_zip.mk
+++ b/solenv/inc/_tg_zip.mk
@@ -14,6 +14,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP1TARGET)"!=""
+.IF "$(ZIP1STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP1EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP1LIST:s/LANGDIR//)" == "$(ZIP1LIST)"
@@ -117,6 +122,11 @@ $(ZIP1TARGETN) : delzip $(ZIP1DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP1STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP1DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
@@ -137,6 +147,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP2TARGET)"!=""
+.IF "$(ZIP2STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP2EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP2LIST:s/LANGDIR//)" == "$(ZIP2LIST)"
@@ -240,6 +255,11 @@ $(ZIP2TARGETN) : delzip $(ZIP2DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP2STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP2DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
@@ -260,6 +280,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP3TARGET)"!=""
+.IF "$(ZIP3STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP3EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP3LIST:s/LANGDIR//)" == "$(ZIP3LIST)"
@@ -363,6 +388,11 @@ $(ZIP3TARGETN) : delzip $(ZIP3DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP3STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP3DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
@@ -383,6 +413,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP4TARGET)"!=""
+.IF "$(ZIP4STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP4EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP4LIST:s/LANGDIR//)" == "$(ZIP4LIST)"
@@ -486,6 +521,11 @@ $(ZIP4TARGETN) : delzip $(ZIP4DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP4STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP4DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
@@ -506,6 +546,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP5TARGET)"!=""
+.IF "$(ZIP5STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP5EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP5LIST:s/LANGDIR//)" == "$(ZIP5LIST)"
@@ -609,6 +654,11 @@ $(ZIP5TARGETN) : delzip $(ZIP5DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP5STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP5DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
@@ -629,6 +679,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP6TARGET)"!=""
+.IF "$(ZIP6STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP6EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP6LIST:s/LANGDIR//)" == "$(ZIP6LIST)"
@@ -732,6 +787,11 @@ $(ZIP6TARGETN) : delzip $(ZIP6DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP6STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP6DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
@@ -752,6 +812,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP7TARGET)"!=""
+.IF "$(ZIP7STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP7EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP7LIST:s/LANGDIR//)" == "$(ZIP7LIST)"
@@ -855,6 +920,11 @@ $(ZIP7TARGETN) : delzip $(ZIP7DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP7STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP7DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
@@ -875,6 +945,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP8TARGET)"!=""
+.IF "$(ZIP8STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP8EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP8LIST:s/LANGDIR//)" == "$(ZIP8LIST)"
@@ -978,6 +1053,11 @@ $(ZIP8TARGETN) : delzip $(ZIP8DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP8STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP8DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
@@ -998,6 +1078,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP9TARGET)"!=""
+.IF "$(ZIP9STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP9EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP9LIST:s/LANGDIR//)" == "$(ZIP9LIST)"
@@ -1101,6 +1186,11 @@ $(ZIP9TARGETN) : delzip $(ZIP9DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP9STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP9DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
@@ -1121,6 +1211,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP10TARGET)"!=""
+.IF "$(ZIP10STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP10EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP10LIST:s/LANGDIR//)" == "$(ZIP10LIST)"
@@ -1224,6 +1319,11 @@ $(ZIP10TARGETN) : delzip $(ZIP10DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP10STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP10DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
diff --git a/solenv/inc/tg_zip.mk b/solenv/inc/tg_zip.mk
index 0a0364e..d3236fd 100644
--- a/solenv/inc/tg_zip.mk
+++ b/solenv/inc/tg_zip.mk
@@ -42,6 +42,11 @@ avoid_cvs_dir=-x "*CVS*" -x "*.svn*"
.IF "$(ZIP$(TNR)TARGET)"!=""
+.IF "$(ZIP$(TNR)STRIPLANGUAGETAGS)" != ""
+CALLXSLTPROC:=$(XSLTPROC)
+.EXPORT: CALLXSLTPROC
+.ENDIF
+
ZIP$(TNR)EXT*=.zip
.IF "$(common_build_zip)"!=""
.IF "$(ZIP$(TNR)LIST:s/LANGDIR//)" == "$(ZIP$(TNR)LIST)"
@@ -145,6 +150,11 @@ $(ZIP$(TNR)TARGETN) : delzip $(ZIP$(TNR)DEPS)
$(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
$(PERL) -w $(SOLARENV)/bin/cleanzip.pl $@ \
$(FI)
+.IF "$(ZIP$(TNR)STRIPLANGUAGETAGS)" != ""
+ $(COMMAND_ECHO)$(IFEXIST) $@ $(THEN) \
+ $(SOLARENV)/bin/striplanguagetags.sh $@ \
+ $(FI)
+.ENDIF
.ENDIF # "$(ZIP$(TNR)DIR)" != ""
.ENDIF # "$(common_build_zip)"!=""
.ENDIF
More information about the Libreoffice-commits
mailing list