improve flexibility of genmanpages with changes from po4a.

git-svn-id: http://emdebian.org/svn/current@6675 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2009-11-10 21:50:24 +00:00
parent a90ab5a093
commit 6c6f08b6bf
3 changed files with 142 additions and 31 deletions

3
debian/changelog vendored
View file

@ -7,8 +7,9 @@ emdebian-rootfs (2.0.4) unstable; urgency=low
* Apply useNativeDist to package POT file
* Add support for translated program output in multistrap
* [INTL:pt] Initial Portuguese program translation (Closes: #555485)
* improve flexibility of genmanpages with changes from po4a.
-- Neil Williams <codehelp@debian.org> Mon, 09 Nov 2009 23:12:55 +0000
-- Neil Williams <codehelp@debian.org> Tue, 10 Nov 2009 21:45:07 +0000
emdebian-rootfs (2.0.3) unstable; urgency=low

View file

@ -41,8 +41,12 @@ XMLDIR=""
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)
# the POD files for man1
PODFILE=""
# the POD files for man3/ - module names regenerated from the path.
PODMODULES=""
# POD files for section 7
POD7FILES=""
# the binary packages using POD
PODPACKAGES=""
# html output (subdirectory of BASEDIR)
@ -51,6 +55,8 @@ HTMLDIR=""
HTMLFILE=""
# the XSL file to use for Docbook XSL
HTMLXSL="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"
# Minimal threshold for translation percentage to keep
KEEP=
# remember to add something to the clean:: rule in debian/rules
# to remove each binary package sub-directory.
@ -95,12 +101,12 @@ case "$1" in
;;
--pot-only)
POTONLY=1
break;
shift
;;
-f|--file)
shift
FILE=$1
break;
shift
;;
*)
echo "Unrecognised command: $1"
@ -109,11 +115,6 @@ case "$1" in
esac
done
if [ ! -f "debian/changelog" ]; then
echo "genmanpages started from the wrong directory.";
exit 2
fi
if [ ! -f "$FILE" ]; then
# without config, there's nothing to do.
echo "Cannot find config file! '$FILE'";
@ -121,6 +122,8 @@ if [ ! -f "$FILE" ]; then
else
. ./$FILE
fi
OURS=`pwd|tr -d '\n'`
cd `dirname $FILE`
# calculate the langs, automatically.
LANGS=`ls $PODIR/*.po 2>/dev/null || true`
@ -135,22 +138,44 @@ if [ ! -z "$LANGS" ]; then
fi
wrap_langs "[po4a_paths]" "$POTFILE" "\$lang:$PODIR/\$lang.po"
for file in $XMLDIR/*.xml; do
LOCAL=`basename $file`
wrap_langs "[type:docbook]" "$file" "\$lang:$XMLDIR/\$lang/$LOCAL"
done
for file in $DOCBOOKDIR; do
LOCAL=`basename $file`
wrap_langs "[type:docbook]" "$file" "\$lang:$BASEDIR/\$lang/$LOCAL"
done
if [ -n "$XMLDIR" ]; then
for file in $XMLDIR/*.xml; do
LOCAL=`basename $file`
wrap_langs "[type:docbook]" "$file" "\$lang:$XMLDIR/\$lang/$LOCAL"
done
fi
if [ -n "$DOCBOOKDIR" ]; then
for file in $DOCBOOKDIR; do
LOCAL=`basename $file`
wrap_langs "[type:docbook]" "$file" "\$lang:$BASEDIR/\$lang/$LOCAL"
done
fi
if [ -n "$PODFILE" ]; then
for file in "$PODFILE"; do
wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/\$lang/$file"
for file in $PODFILE; do
LOCAL=`basename $file`
wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/1/\$lang/$LOCAL"
done
fi
if [ -n "$POD7FILES" ]; then
for file in $POD7FILES; do
LOCAL=`basename $file`
wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/7/\$lang/$LOCAL"
done
fi
if [ -n "$PODMODULES" ]; then
for file in $PODMODULES; do
wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/3/\$lang/$file"
done
fi
if [ "$POTONLY" = "1" ]; then
po4a --no-translations $CONFIG
# Allow internal builds within po4a
if [ "$USE_INTERNAL_PO4A" = "yes" ]; then
echo "Internal po4a from $OURS being used instead of /usr/bin/"
PERL5LIB=$OURS/lib perl $OURS/po4a --no-translations $CONFIG
else
po4a --no-translations $CONFIG
fi
exit
fi
@ -160,17 +185,41 @@ for d in $BINARIES; do
if [ "$d" = "$HASMAN3" ]; then
mkdir -p $BASEDIR/$d/man/$l/man3/
fi
mkdir -p $BASEDIR/$d/$l/$HTMLDIR/
if [ -n "$PODMODULES" ]; then
mkdir -p $BASEDIR/$d/man/$l/man3/
fi
if [ -n "$HTMLDIR" ]; then
mkdir -p $BASEDIR/$d/$l/$HTMLDIR/
fi
if [ -n "$POD7FILES" ]; then
mkdir -p $BASEDIR/$d/man/$l/man7/
fi
done
mkdir -p $BASEDIR/$d/man/man1/
if [ "$d" = "$HASMAN3" ]; then
mkdir -p $BASEDIR/$d/man/man3/
fi
mkdir -p $BASEDIR/pod/$l/
if [ -n "$PODMODULES" ]; then
mkdir -p $BASEDIR/$d/man/man3/
fi
if [ -n "$POD7FILES" ]; then
mkdir -p $BASEDIR/$d/man/man7/
fi
done
# use -k to create all XML even if untranslated or the XSL breaks the build.
po4a -k 0 $CONFIG
if [ -n "$KEEP" ]; then
K="-k $KEEP"
fi
# Allow internal builds within po4a
if [ "$USE_INTERNAL_PO4A" = "yes" ]; then
echo "Internal po4a from $OURS being used instead of /usr/bin/"
PERL5LIB=$OURS/lib perl $OURS/po4a $K $CONFIG
else
po4a $K $CONFIG
fi
for d in $BINARIES; do
for P in $XMLPACKAGES; do
@ -190,8 +239,32 @@ for d in $BINARIES; do
done
for POD in $PODPACKAGES; do
if [ $d = "$POD" ]; then
echo "Processing untranslated files for $POD . . ."
pod2man $PODFILE > $BASEDIR/$POD/man/man1/$PODFILE.1
for file in $PODFILE; do
LOCAL=`basename $file`
echo "Processing untranslated files for $file (1) . . ."
pod2man $file $BASEDIR/$POD/man/man1/$LOCAL.1
done
if [ -n "$PODMODULES" ]; then
for file in $PODMODULES; do
# a bit of sed magic to convert a path to a module name.
name=`echo $file| sed -e 's/^lib\///'|sed -e 's/\//::/g'|sed -e 's/\.pm$//'`
echo "Processing untranslated files for $name (3) . . ."
pod2man $file $BASEDIR/$POD/man/man3/$name.3
done
fi
if [ -n "$POD7FILES" ]; then
for file in $POD7FILES; do
LOCAL=`basename $file`
echo "Processing untranslated files for $file (7) . . ."
# shorten names that already contain the 7.
SHORT=`echo $LOCAL|cut -d'7' -f1|tr -d .`
if [ -n "$SHORT" ]; then
pod2man -s 7 $file $BASEDIR/$POD/man/man7/${SHORT}.7
else
pod2man -s 7 $file $BASEDIR/$POD/man/man7/${LOCAL}.7
fi
done
fi
fi
done
if [ -n "$HTMLDIR" ]; then
@ -200,10 +273,12 @@ for d in $BINARIES; do
for l in $LANGS; do
for P in $XMLPACKAGES; do
if [ $d = "$P" ]; then
echo "Processing $l translations for $d . . ."
for X in $XMLFILE; do
XML_CATALOG_FILES="/etc/xml/catalog" \
xsltproc -o $BASEDIR/$P/man/ --nonet $XSLFILE $XMLDIR/$l/$X
if [ -f $XMLDIR/$l/$X ]; then
echo "Processing $l translations for $d . . ."
XML_CATALOG_FILES="/etc/xml/catalog" \
xsltproc -o $BASEDIR/$P/man/ --nonet $XSLFILE $XMLDIR/$l/$X
fi
done
if [ "$d" = "$HASMAN3" ]; then
mv $BASEDIR/$P/man/*.3 $BASEDIR/$P/man/$l/man3/
@ -215,9 +290,38 @@ for d in $BINARIES; do
done
for POD in $PODPACKAGES; do
if [ $d = "$POD" ]; then
echo "Processing $l translations for $POD . . ."
echo "pod2man $BASEDIR/pod/$l/$PODFILE > $BASEDIR/$POD/man/$l/man1/$PODFILE.1"
pod2man $BASEDIR/pod/$l/$PODFILE > $BASEDIR/$POD/man/$l/man1/$PODFILE.1
for file in $PODFILE; do
LOCAL=`basename $file`
if [ -f $BASEDIR/pod/1/$l/$LOCAL ]; then
echo "Processing $l translations for $file (1). . ."
pod2man $BASEDIR/pod/1/$l/$LOCAL $BASEDIR/$POD/man/$l/man1/$LOCAL.1
fi
done
fi
if [ -n "$PODMODULES" ]; then
for file in $PODMODULES; do
# a bit of sed magic to convert a path to a module name.
name=`echo $file| sed -e 's/^lib\///'|sed -e 's/\//::/g'|sed -e 's/\.pm$//'`
if [ -f $BASEDIR/pod/3/$l/$file ]; then
echo "Processing $l translations for $name (3). . ."
pod2man $BASEDIR/pod/3/$l/$file $BASEDIR/$POD/man/$l/man3/$name.3
fi
done
fi
if [ -n "$POD7FILES" ]; then
for file in $POD7FILES; do
LOCAL=`basename $file`
if [ -f $BASEDIR/pod/7/$l/$LOCAL ]; then
echo "Processing $l translations for $file (7). . ."
# shorten names that already contain the 7.
SHORT=`echo $LOCAL|cut -d'7' -f1|tr -d .`
if [ -n "$SHORT" ]; then
pod2man -s 7 $BASEDIR/pod/7/$l/$LOCAL $BASEDIR/$POD/man/$l/man7/${SHORT}.7
else
pod2man -s 7 $BASEDIR/pod/7/$l/$LOCAL $BASEDIR/$POD/man/$l/man7/$LOCAL.7
fi
fi
done
fi
done
if [ -n "$HTMLDIR" ]; then

View file

@ -22,13 +22,19 @@ XMLDIR="doc/xml/"
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)
# the POD files for man1
PODFILE="em_multistrap"
# the POD files for man3/ - module names regenerated from the path.
PODMODULES=""
# POD files for section 7
POD7FILES=""
# the binary packages using POD
PODPACKAGES="multistrap"
# html output (subdirectory of BASEDIR)
HTMLDIR=""
# html DocBook file
HTMLFILE=""
# Minimal threshold for translation percentage to keep
KEEP=
# the XSL file to use for Docbook XSL
HTMLXSL="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"