From fa438396c42fb367db5bdfbfac19ed09e0592640 Mon Sep 17 00:00:00 2001 From: codehelp Date: Sun, 1 Nov 2009 16:15:47 +0000 Subject: [PATCH] Use genmanpages code from svn-buildpackage for translated content. git-svn-id: http://emdebian.org/svn/current@6660 563faec7-e20c-0410-992a-a66f704d0ccd --- debian/changelog | 3 +- doc/Makefile | 7 ++ doc/genmanpages | 180 +++++++++++++++++++++++++++++++---------------- manpages.conf | 38 ++++++++++ 4 files changed, 165 insertions(+), 63 deletions(-) create mode 100644 doc/Makefile create mode 100644 manpages.conf diff --git a/debian/changelog b/debian/changelog index 96cbc13..0082c1c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,9 @@ emdebian-rootfs (2.0.4) unstable; urgency=low * [INTL:fr] French manpage translation update (Closes: #552198) * Check for symlinks from lib64 to /lib and warn if not unset. (Closes: #553599) + * Use genmanpages code from svn-buildpackage for translated content. - -- Neil Williams Sun, 01 Nov 2009 14:52:05 +0000 + -- Neil Williams Sun, 01 Nov 2009 16:09:56 +0000 emdebian-rootfs (2.0.3) unstable; urgency=low diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..4e96902 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,7 @@ + +all: + +clean: + $(RM) *~ *.tmp + $(RM) -r html/* *.1 + $(RM) -r svn-buildpackage diff --git a/doc/genmanpages b/doc/genmanpages index 9b66904..e2f0a62 100755 --- a/doc/genmanpages +++ b/doc/genmanpages @@ -16,38 +16,45 @@ set -e # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# DEFAULTS: # name and location of the config file # relative to the top level source directory of the translations # i.e. the directory containing ./po/ -CONFIG="doc/po4a.config" +CONFIG="po4a.config" +# PODIR po directory for manpages/docs +PODIR="po" # POTFILE path -POTFILE="po/emdebian-rootfs.pot" +POTFILE="" +# base directory for generated files, e.g. doc +BASEDIR="" # The scripts with translated output -SCRIPTS="em_multistrap" -# The language to declare for the SCRIPTS -SCRIPTS_LANG="perl" +SCRIPTS="" +# The language to declare for the SCRIPTS (xgettext) +SCRIPTS_LANG="" # the binary packages that will contain generated manpages -BINARIES="emdebian-rootfs multistrap" +BINARIES="" # the binary packages with manpages in Section 3. -HASMAN3="emdebian-rootfs" +HASMAN3="" # the binary packages using DocBook XML & xsltproc -XMLPACKAGES="emdebian-rootfs" +XMLPACKAGES="" # the DocBook XML files (TODO: let this take paths) -XMLFILE="emdebian-rootfs.1.xml" -# the directory containing the XML files -XMLDIR="doc/xml" +XMLFILE="" +# the pattern to find the XML files +XMLDIR="" # the pattern to find the .docbook files DOCBOOKDIR="" # the XSL file to use for Docbook XSL XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" # the POD files (TODO: let this take paths) -PODFILE="em_multistrap" +PODFILE="" # the binary packages using POD -PODPACKAGES="multistrap" -# html output -HTMLDIR="doc/html" +PODPACKAGES="" +# html output (subdirectory of BASEDIR) +HTMLDIR="" # html DocBook file -HTMLFILE="emdebian-rootfs.1.xml" +HTMLFILE="" +# the XSL file to use for Docbook XSL +HTMLXSL="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl" # remember to add something to the clean:: rule in debian/rules # to remove each binary package sub-directory. @@ -55,6 +62,9 @@ HTMLFILE="emdebian-rootfs.1.xml" # below this point, no changes should be needed. +# use a default manpages.cnf in the current directory. +FILE="manpages.conf" + wrap_langs () { if [ -z "$LANGS" ]; then echo "$1 $2" >> $CONFIG @@ -63,17 +73,63 @@ wrap_langs () { fi } -if [ -f po4a.config ]; then - cd ../ +usagehelp () { + # print out help message + cat </dev/null || true` +LANGS=`ls $PODIR/*.po 2>/dev/null || true` if [ ! -z "$LANGS" ]; then - LANGS=`ls po/*.po | sed -e 's/.*\/\(.*\)\.po/\1 /' || true` + LANGS=`ls $PODIR/*.po | sed -e 's/.*\/\(.*\)\.po/\1 /' || true` fi if [ ! -z "$LANGS" ]; then LANGS=`echo $LANGS|tr -d '\n'` @@ -83,21 +139,6 @@ if [ ! -z "$LANGS" ]; then fi wrap_langs "[po4a_paths]" "$POTFILE" "\$lang:po/\$lang.po" -for d in $BINARIES; do - for l in $LANGS; do - mkdir -p doc/$d/man/$l/man1/ - if [ "$d" = "$HASMAN3" ]; then - mkdir -p doc/$d/man/$l/man3/ - fi - done - mkdir -p doc/$d/man/man1/ - if [ "$d" = "$HASMAN3" ]; then - mkdir -p doc/$d/man/man3/ - fi - mkdir -p doc/pod/$l/ -done -mkdir -p doc/html/ - #for file in $SCRIPTS; do # wrap_langs "[type:$SCRIPTS_LANG]" "$file" #done @@ -107,14 +148,34 @@ for file in $XMLDIR/*.xml; do done for file in $DOCBOOKDIR; do LOCAL=`basename $file` - wrap_langs "[type:docbook]" "$file" "\$lang:doc/\$lang/$LOCAL" + wrap_langs "[type:docbook]" "$file" "\$lang:$BASEDIR/\$lang/$LOCAL" done if [ -n "$PODFILE" ]; then for file in "$PODFILE"; do - wrap_langs "[type:pod]" "$file" "\$lang:doc/pod/\$lang/$file" + wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/\$lang/$file" done fi +if [ "$POTONLY" = "1" ]; then + po4a --no-translations $CONFIG + exit +fi + +for d in $BINARIES; do + for l in $LANGS; do + mkdir -p $BASEDIR/$d/man/$l/man1/ + if [ "$d" = "$HASMAN3" ]; then + mkdir -p $BASEDIR/$d/man/$l/man3/ + fi + mkdir -p $BASEDIR/$d/$l/html/ + done + mkdir -p $BASEDIR/$d/man/man1/ + if [ "$d" = "$HASMAN3" ]; then + mkdir -p $BASEDIR/$d/man/man3/ + fi + mkdir -p $BASEDIR/pod/$l/ +done + # use -k to create all XML even if untranslated or the XSL breaks the build. po4a -k 0 $CONFIG @@ -122,51 +183,46 @@ for d in $BINARIES; do for P in $XMLPACKAGES; do for X in $XMLFILE; do XML_CATALOG_FILES="/etc/xml/catalog" \ - xsltproc -o doc/$P/man/ --nonet $XSLFILE $XMLDIR/$X + xsltproc -o $BASEDIR/$P/man/ --nonet $XSLFILE $XMLDIR/$X done if [ "$d" = "$HASMAN3" ]; then - mv doc/$P/man/*.3 doc/$P/man/man3/ + mv $BASEDIR/$P/man/*.3 $BASEDIR/$P/man/man3/ else - rm -f doc/$P/man/*.3 + rm -f $BASEDIR/$P/man/*.3 fi - mv doc/$P/man/*.1 doc/$P/man/man1/ + mv $BASEDIR/$P/man/*.1 $BASEDIR/$P/man/man1/ done for POD in $PODPACKAGES; do - pod2man $PODFILE > doc/$POD/man/man1/$PODFILE.1 + pod2man $PODFILE > $BASEDIR/$POD/man/man1/$PODFILE.1 done - mkdir -p $HTMLDIR/$d/ - xsltproc -o $HTMLDIR/$d/ --nonet \ - http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl \ - $XMLDIR/$HTMLFILE + xsltproc -o $BASEDIR/$d/html/ --nonet $HTMLXSL $XMLDIR/$HTMLFILE for l in $LANGS; do for P in $XMLPACKAGES; do for X in $XMLFILE; do XML_CATALOG_FILES="/etc/xml/catalog" \ - xsltproc -o doc/$P/man/ --nonet $XSLFILE $XMLDIR/$l/$X + xsltproc -o $BASEDIR/$P/man/ --nonet $XSLFILE $XMLDIR/$l/$X done if [ "$d" = "$HASMAN3" ]; then - mv doc/$P/man/*.3 doc/$P/man/$l/man3/ + mv $BASEDIR/$P/man/*.3 $BASEDIR/$P/man/$l/man3/ else - rm -f doc/$P/man/*.3 + rm -f $BASEDIR/$P/man/*.3 fi - mv doc/$P/man/*.1 doc/$P/man/$l/man1/ + mv $BASEDIR/$P/man/*.1 $BASEDIR/$P/man/$l/man1/ done for POD in $PODPACKAGES; do - pod2man doc/pod/$l/$PODFILE > doc/$POD/man/$l/man1/$PODFILE.1 + pod2man $BASEDIR/pod/$l/$PODFILE > $BASEDIR/$POD/man/$l/man1/$PODFILE.1 done - mkdir -p $HTMLDIR/$d/$l/ - xsltproc -o $HTMLDIR/$d/$l/ --nonet \ - http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl \ - $XMLDIR/$l/$HTMLFILE + mkdir -p $BASEDIR/$d/html/$l/ + xsltproc -o $BASEDIR/$d/html/$l/ --nonet $HTMLXSL $XMLDIR/$l/$HTMLFILE done - for i in `ls doc/html/$d/*.html`; do - iconv -t utf-8 -f iso8859-1 $i > doc/html/tmp - sed < doc/html/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:' + for i in `ls $BASEDIR/$d/html/*.html`; do + iconv -t utf-8 -f iso8859-1 $i > $BASEDIR/html/tmp + sed < $BASEDIR/html/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:' done - rm -f doc/html/tmp + rm -f $BASEDIR/html/tmp done for l in $LANGS; do rm -rf $XMLDIR/$l done -rm -rf doc/pod/ +rm -rf $BASEDIR/pod/ diff --git a/manpages.conf b/manpages.conf new file mode 100644 index 0000000..7d75f10 --- /dev/null +++ b/manpages.conf @@ -0,0 +1,38 @@ +# name and location of the config file +# relative to the top level source directory of the translations +# i.e. the directory containing ./po/ +CONFIG="po4a.config" +# PODIR po directory for manpages/docs +PODIR="po" +# POTFILE path +POTFILE="po/emdebian-rootfs.pot" +# base directory for generated files, e.g. doc +BASEDIR="doc" +# The scripts with translated output +SCRIPTS="em_multistrap" +# The language to declare for the SCRIPTS (xgettext) +SCRIPTS_LANG="perl" +# the binary packages that will contain generated manpages +BINARIES="emdebian-rootfs multistrap" +# the binary packages with manpages in Section 3. +HASMAN3="emdebian-rootfs" +# the binary packages using DocBook XML & xsltproc +XMLPACKAGES="emdebian-rootfs" +# the DocBook XML files (TODO: let this take paths) +XMLFILE="emdebian-rootfs.1.xml" +# the pattern to find the XML files +XMLDIR="doc/xml/" +# the pattern to find the .docbook files +DOCBOOKDIR="" +# the XSL file to use for Docbook XSL +XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" +# the POD files (TODO: let this take paths) +PODFILE="em_multistrap" +# the binary packages using POD +PODPACKAGES="multistrap" +# html output (subdirectory of BASEDIR) +HTMLDIR="html" +# html DocBook file +HTMLFILE="emdebian-rootfs.1.xml" +# the XSL file to use for Docbook XSL +HTMLXSL="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"