Use genmanpages code from svn-buildpackage for translated content.

git-svn-id: http://emdebian.org/svn/current@6660 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2009-11-01 16:15:47 +00:00
parent ee2da812b2
commit fa438396c4
4 changed files with 165 additions and 63 deletions

3
debian/changelog vendored
View file

@ -3,8 +3,9 @@ emdebian-rootfs (2.0.4) unstable; urgency=low
* [INTL:fr] French manpage translation update (Closes: #552198) * [INTL:fr] French manpage translation update (Closes: #552198)
* Check for symlinks from lib64 to /lib and warn if not unset. * Check for symlinks from lib64 to /lib and warn if not unset.
(Closes: #553599) (Closes: #553599)
* Use genmanpages code from svn-buildpackage for translated content.
-- Neil Williams <codehelp@debian.org> Sun, 01 Nov 2009 14:52:05 +0000 -- Neil Williams <codehelp@debian.org> Sun, 01 Nov 2009 16:09:56 +0000
emdebian-rootfs (2.0.3) unstable; urgency=low emdebian-rootfs (2.0.3) unstable; urgency=low

7
doc/Makefile Normal file
View file

@ -0,0 +1,7 @@
all:
clean:
$(RM) *~ *.tmp
$(RM) -r html/* *.1
$(RM) -r svn-buildpackage

View file

@ -16,38 +16,45 @@ set -e
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# DEFAULTS:
# name and location of the config file # name and location of the config file
# relative to the top level source directory of the translations # relative to the top level source directory of the translations
# i.e. the directory containing ./po/ # i.e. the directory containing ./po/
CONFIG="doc/po4a.config" CONFIG="po4a.config"
# PODIR po directory for manpages/docs
PODIR="po"
# POTFILE path # POTFILE path
POTFILE="po/emdebian-rootfs.pot" POTFILE=""
# base directory for generated files, e.g. doc
BASEDIR=""
# The scripts with translated output # The scripts with translated output
SCRIPTS="em_multistrap" SCRIPTS=""
# The language to declare for the SCRIPTS # The language to declare for the SCRIPTS (xgettext)
SCRIPTS_LANG="perl" SCRIPTS_LANG=""
# the binary packages that will contain generated manpages # the binary packages that will contain generated manpages
BINARIES="emdebian-rootfs multistrap" BINARIES=""
# the binary packages with manpages in Section 3. # the binary packages with manpages in Section 3.
HASMAN3="emdebian-rootfs" HASMAN3=""
# the binary packages using DocBook XML & xsltproc # the binary packages using DocBook XML & xsltproc
XMLPACKAGES="emdebian-rootfs" XMLPACKAGES=""
# the DocBook XML files (TODO: let this take paths) # the DocBook XML files (TODO: let this take paths)
XMLFILE="emdebian-rootfs.1.xml" XMLFILE=""
# the directory containing the XML files # the pattern to find the XML files
XMLDIR="doc/xml" XMLDIR=""
# the pattern to find the .docbook files # the pattern to find the .docbook files
DOCBOOKDIR="" DOCBOOKDIR=""
# the XSL file to use for Docbook XSL # the XSL file to use for Docbook XSL
XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
# the POD files (TODO: let this take paths) # the POD files (TODO: let this take paths)
PODFILE="em_multistrap" PODFILE=""
# the binary packages using POD # the binary packages using POD
PODPACKAGES="multistrap" PODPACKAGES=""
# html output # html output (subdirectory of BASEDIR)
HTMLDIR="doc/html" HTMLDIR=""
# html DocBook file # 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 # remember to add something to the clean:: rule in debian/rules
# to remove each binary package sub-directory. # to remove each binary package sub-directory.
@ -55,6 +62,9 @@ HTMLFILE="emdebian-rootfs.1.xml"
# below this point, no changes should be needed. # below this point, no changes should be needed.
# use a default manpages.cnf in the current directory.
FILE="manpages.conf"
wrap_langs () { wrap_langs () {
if [ -z "$LANGS" ]; then if [ -z "$LANGS" ]; then
echo "$1 $2" >> $CONFIG echo "$1 $2" >> $CONFIG
@ -63,17 +73,63 @@ wrap_langs () {
fi fi
} }
if [ -f po4a.config ]; then usagehelp () {
cd ../ # print out help message
cat <<EOF
genmanpages - po4a frontend
Syntax: genmanpages
genmanpages --pot-only
Commands:
-?|-h|--help|-version: print this help message and exit
--pot-only: only create the POT file
Options:
-f|--file FILE: manpages.conf config file path
EOF
}
while [ -n "$1" ]; do
case "$1" in
--help|-h|-\?|--version)
echo usagehelp
exit;
;;
--pot-only)
POTONLY=1
break;
;;
-f|--file)
shift
FILE=$1
break;
;;
*)
echo "Unrecognised command: $1"
exit;
;;
esac
done
if [ ! -f "debian/changelog" ]; then
echo "genmanpages started from the wrong directory.";
exit 2
fi fi
if [ -f ../po4a.config ]; then
cd ../../ if [ ! -f "$FILE" ]; then
# without config, there's nothing to do.
echo "Cannot find config file! '$FILE'";
exit 3
else
. ./$FILE
fi fi
# calculate the langs, automatically. # calculate the langs, automatically.
LANGS=`ls po/*.po 2>/dev/null || true` LANGS=`ls $PODIR/*.po 2>/dev/null || true`
if [ ! -z "$LANGS" ]; then 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 fi
if [ ! -z "$LANGS" ]; then if [ ! -z "$LANGS" ]; then
LANGS=`echo $LANGS|tr -d '\n'` LANGS=`echo $LANGS|tr -d '\n'`
@ -83,21 +139,6 @@ if [ ! -z "$LANGS" ]; then
fi fi
wrap_langs "[po4a_paths]" "$POTFILE" "\$lang:po/\$lang.po" 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 #for file in $SCRIPTS; do
# wrap_langs "[type:$SCRIPTS_LANG]" "$file" # wrap_langs "[type:$SCRIPTS_LANG]" "$file"
#done #done
@ -107,14 +148,34 @@ for file in $XMLDIR/*.xml; do
done done
for file in $DOCBOOKDIR; do for file in $DOCBOOKDIR; do
LOCAL=`basename $file` LOCAL=`basename $file`
wrap_langs "[type:docbook]" "$file" "\$lang:doc/\$lang/$LOCAL" wrap_langs "[type:docbook]" "$file" "\$lang:$BASEDIR/\$lang/$LOCAL"
done done
if [ -n "$PODFILE" ]; then if [ -n "$PODFILE" ]; then
for file in "$PODFILE"; do 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 done
fi 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. # use -k to create all XML even if untranslated or the XSL breaks the build.
po4a -k 0 $CONFIG po4a -k 0 $CONFIG
@ -122,51 +183,46 @@ for d in $BINARIES; do
for P in $XMLPACKAGES; do for P in $XMLPACKAGES; do
for X in $XMLFILE; do for X in $XMLFILE; do
XML_CATALOG_FILES="/etc/xml/catalog" \ 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 done
if [ "$d" = "$HASMAN3" ]; then if [ "$d" = "$HASMAN3" ]; then
mv doc/$P/man/*.3 doc/$P/man/man3/ mv $BASEDIR/$P/man/*.3 $BASEDIR/$P/man/man3/
else else
rm -f doc/$P/man/*.3 rm -f $BASEDIR/$P/man/*.3
fi fi
mv doc/$P/man/*.1 doc/$P/man/man1/ mv $BASEDIR/$P/man/*.1 $BASEDIR/$P/man/man1/
done done
for POD in $PODPACKAGES; do for POD in $PODPACKAGES; do
pod2man $PODFILE > doc/$POD/man/man1/$PODFILE.1 pod2man $PODFILE > $BASEDIR/$POD/man/man1/$PODFILE.1
done done
mkdir -p $HTMLDIR/$d/ xsltproc -o $BASEDIR/$d/html/ --nonet $HTMLXSL $XMLDIR/$HTMLFILE
xsltproc -o $HTMLDIR/$d/ --nonet \
http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl \
$XMLDIR/$HTMLFILE
for l in $LANGS; do for l in $LANGS; do
for P in $XMLPACKAGES; do for P in $XMLPACKAGES; do
for X in $XMLFILE; do for X in $XMLFILE; do
XML_CATALOG_FILES="/etc/xml/catalog" \ 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 done
if [ "$d" = "$HASMAN3" ]; then 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 else
rm -f doc/$P/man/*.3 rm -f $BASEDIR/$P/man/*.3
fi fi
mv doc/$P/man/*.1 doc/$P/man/$l/man1/ mv $BASEDIR/$P/man/*.1 $BASEDIR/$P/man/$l/man1/
done done
for POD in $PODPACKAGES; do 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 done
mkdir -p $HTMLDIR/$d/$l/ mkdir -p $BASEDIR/$d/html/$l/
xsltproc -o $HTMLDIR/$d/$l/ --nonet \ xsltproc -o $BASEDIR/$d/html/$l/ --nonet $HTMLXSL $XMLDIR/$l/$HTMLFILE
http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl \
$XMLDIR/$l/$HTMLFILE
done done
for i in `ls doc/html/$d/*.html`; do for i in `ls $BASEDIR/$d/html/*.html`; do
iconv -t utf-8 -f iso8859-1 $i > doc/html/tmp iconv -t utf-8 -f iso8859-1 $i > $BASEDIR/html/tmp
sed < doc/html/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:' sed < $BASEDIR/html/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:'
done done
rm -f doc/html/tmp rm -f $BASEDIR/html/tmp
done done
for l in $LANGS; do for l in $LANGS; do
rm -rf $XMLDIR/$l rm -rf $XMLDIR/$l
done done
rm -rf doc/pod/ rm -rf $BASEDIR/pod/

38
manpages.conf Normal file
View file

@ -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"