[subversion-commit] SVN tex-common commit + diffs: r902 - in tex-common/trunk: doc scripts

Florent Rougon frn at costa.debian.org
Sat Feb 18 20:32:39 UTC 2006


Author: frn
Date: 2006-02-18 20:32:38 +0000 (Sat, 18 Feb 2006)
New Revision: 902

Modified:
   tex-common/trunk/doc/Debian-TeX-Policy.sgml
   tex-common/trunk/scripts/postinst-tex
   tex-common/trunk/scripts/postrm-tex
Log:
* Update to the Debian TeX policy:
    - suggest the 'if kpsewhich --version >/dev/null 2>&1; then' check after
      explaining the problem;
    - this problem also needed to be mentioned elsewhere;
    - untabify the post{inst,rm} snippets for correct indentation;
    - udpate-updmap also needs a working kpsewhich;
    - add the kpsewhich check to the sample postrm snippet.

* Update to post{inst,rm}-tex:
    - untabification;
    - add a dhit_libkpathsea_configured function which performs the kpsewhich
      check (mainly for readability);
    - 'cat $file | grep $pattern' is too complex; use 'grep $pattern $file'!
    - udpate-updmap also needs a working kpsewhich;
    - add the kpsewhich check to postrm-tex;
    - cosmetic fixes.


Modified: tex-common/trunk/doc/Debian-TeX-Policy.sgml
===================================================================
--- tex-common/trunk/doc/Debian-TeX-Policy.sgml	2006-02-18 18:20:44 UTC (rev 901)
+++ tex-common/trunk/doc/Debian-TeX-Policy.sgml	2006-02-18 20:32:38 UTC (rev 902)
@@ -599,13 +599,22 @@
                 <p>
                 Note that even when <package>tex-common</package> is
                 configured, it cannot be assumed that
-                <prgn>mktexlsr</prgn> and <prgn>updmap-sys</prgn> can
-                be safely run whenever available, because they
-                internally use <prgn>kpsewhich</prgn> which only works
-                after the <file>libkpathsea</file> library in a
-                separate package has been configured
-                properly
+                <prgn>update-updmap</prgn>, <prgn>mktexlsr</prgn> and
+                <prgn>updmap-sys</prgn> can be safely run whenever available,
+                because they internally use <prgn>kpsewhich</prgn> which only
+                works after the <file>libkpathsea</file> library in a separate
+                package has been configured properly. The following check can
+                be used to determine whether <file>libkpathsea</file> is
+                configured:
 
+<example>
+if kpsewhich --version >/dev/null 2>&1; then
+    echo "kpsewhich is installed and libkpathsea is configured."
+else
+    echo "Either kpsewhich is not installed, or libkpathsea is not configured."
+fi
+</example>
+
                 </p>
               </item>
             </enumlist>
@@ -627,7 +636,8 @@
                 <prgn>update-updmap</prgn> can be run and
                 <file>texmf.cnf</file> is in a sane state, so that
                 <prgn>mktexlsr</prgn> and <prgn>updmap-sys</prgn> can be run
-                safely if present.
+                safely (if present and if <file>libkpathsea</file> is
+                configured).
               </item>
           
               <item>
@@ -924,27 +934,28 @@
 #
 # postinst-texfonts
 #
-# postinst snippets for installing fonts for TeX
+# postinst snippet for installing Type 1 fonts for TeX
 #
 # Author: Florent Rougon &lt;f.rougon at free.fr&gt;
 #
 update_fontmaps()
 {
-    update-updmap --quiet
-    # all of the following needs an installed and configured
-    # base TeX system, so check this
-    if kpsewhich --version > /dev/null 2>&1 ; then
+    # All of the following needs an installed and configured
+    # basic TeX system, so check this.
+    if kpsewhich --version >/dev/null 2>&1; then
+        update-updmap --quiet
         # mktexlsr is recommended now because updmap-sys relies 
-	# heavily on Kpathsea to locate updmap.cfg and the map files. 
-	# Also, it is slightly better not to specify a particular 
-	# directory to refresh because updmap.cfg is typically found 
-	# in $TEXMFSYSVAR while the map files are in # $TEXMFMAIN.
+        # heavily on Kpathsea to locate updmap.cfg and the map files. 
+        # Also, it is slightly better not to specify a particular 
+        # directory to refresh because updmap.cfg is typically found 
+        # in TEXMFSYSVAR while the map files are in TEXMFMAIN or
+        # TEXMFDIST.
         if which mktexlsr >/dev/null; then mktexlsr; fi
         if which updmap-sys >/dev/null; then
             printf "Running updmap-sys... "
             updmap-sys --quiet
             echo "done."
-	fi
+        fi
     fi
 
     return 0
@@ -956,7 +967,7 @@
     ;;
 
     *)
-        echo "postinst called with unknown argument \`$1'" >&2
+        echo "postinst called with unknown argument '$1'" >&2
         exit 1
     ;;
 esac
@@ -968,7 +979,7 @@
 #
 # postrm-texfonts
 #
-# postrm snippets for installing fonts for TeX
+# postrm snippet for installing Type 1 fonts for TeX
 #
 # Author: Florent Rougon &lt;f.rougon at free.fr&gt;
 #
@@ -983,10 +994,6 @@
         endwith='\n'
     fi
 
-    # According to the Debian TeX policy, running mktexlsr and updmap-sys
-    # should work as long as tex-common is configured and these files are
-    # available (general Debian policy wouldn't assure that without this
-    # override from the Debian TeX policy).
     printf "\
 Trying to run '$prog' (error messages can be ignored if tex-common
 is not configured)...$endwith"
@@ -1008,6 +1015,12 @@
 # calls.
 try_to_update_fontmaps()
 {
+    # All of the following needs an installed and configured basic TeX system.
+    # If there is one, register the fonts. Otherwise, that will be done later
+    # when the basic TeX system is configured, so we can exit without
+    # worrying.
+    kpsewhich --version >/dev/null 2>&1 || return 0
+
     # Don't print alarming error messages if the programs aren't even
     # available.
     if which update-updmap >/dev/null; then
@@ -1018,8 +1031,8 @@
     # mktexlsr is recommended now because updmap-sys relies heavily on
     # Kpathsea to locate updmap.cfg and the map files. Also, it is slightly
     # better not to specify a particular directory to refresh because
-    # updmap.cfg is typically found in $TEXMFSYSVAR while the map files are in
-    # $TEXMFMAIN.
+    # updmap.cfg is typically found in TEXMFSYSVAR while the map files are in
+    # TEXMFMAIN.
     if which mktexlsr >/dev/null; then
         tell_that_errors_are_ok mktexlsr
         mktexlsr || true
@@ -1052,7 +1065,7 @@
     ;;
 
     *)
-        echo "postrm called with unknown argument \`$1'" >&2
+        echo "postrm called with unknown argument '$1'" >&2
         exit 1
     ;;
 esac

Modified: tex-common/trunk/scripts/postinst-tex
===================================================================
--- tex-common/trunk/scripts/postinst-tex	2006-02-18 18:20:44 UTC (rev 901)
+++ tex-common/trunk/scripts/postinst-tex	2006-02-18 20:32:38 UTC (rev 902)
@@ -4,61 +4,72 @@
 # postinst snippets for installing stuff for TeX
 #
 # Authors:
-#	Florent Rougon <f.rougon at free.fr>
-#	Norbert Preining <preining at logic.at>
+#       Florent Rougon <f.rougon at free.fr>
+#       Norbert Preining <preining at logic.at>
 #
 # Please note that comments in this file are stripped before installation
 # by calling a grep -v '^[ \t]*#'
 # So please be careful if you add stuff here!
 
+
+# Tell if kpsewhich works. If this is the case:
+#
+#   1. kpsewhich is installed and;
+#
+#   2. libkpathsea is configured.
+dhit_libkpathsea_configured ()
+{
+    return kpsewhich --version >/dev/null 2>&1
+}
+
 dhit_update_lsr_files ()
 {
-    tempfile=`mktemp -p /tmp mktexlsr.XXXXXXXX`
-    printf "Running mktexlsr. This may take some time..."
+    tempfile=$(mktemp -p /tmp mktexlsr.XXXXXXXX)
+    printf "Running mktexlsr. This may take some time... "
     if mktexlsr > $tempfile 2>&1 ; then
         rm -f $tempfile
-        echo " done."
+        echo "done."
     else
         echo
-	echo "mktexlsr failed. Output has been stored in"
-	echo "$tempfile"
-	echo "Please include this file if you report a bug."
-	echo
-	exit 1
+        echo "mktexlsr failed. Output has been stored in"
+        echo "$tempfile"
+        echo "Please include this file if you report a bug."
+        echo
+        exit 1
     fi
 }
 
 dhit_create_fontmaps ()
 {
-    tempfile=`mktemp -p /tmp updmap.XXXXXXXX`
-    printf "Running updmap-sys. This may take some time..."
+    tempfile=$(mktemp -p /tmp updmap.XXXXXXXX)
+    printf "Running updmap-sys. This may take some time... "
     if updmap-sys > $tempfile 2>&1 ; then
-    	rm -f $tempfile
-	echo " done."
+        rm -f $tempfile
+        echo "done."
     else
-    	echo
-	echo "updmap-sys failed. Output has been stored in"
-	echo "$tempfile"
-	echo "Please include this file if you report a bug."
-	echo
-	exit 1
+        echo
+        echo "updmap-sys failed. Output has been stored in"
+        echo "$tempfile"
+        echo "Please include this file if you report a bug."
+        echo
+        exit 1
     fi
 }
 
 
 dhit_build_hyphen_format_if_format_exists ()
 {
-    v=`kpsewhich -var-value TEXMFSYSVAR`
-    c=`kpsewhich -var-value TEXMFSYSCONFIG`
+    v=$(kpsewhich -var-value TEXMFSYSVAR)
+    c=$(kpsewhich -var-value TEXMFSYSCONFIG)
     TEXMFVAR="$v"
     TEXMFCONFIG="$c"
     export TEXMFVAR TEXMFCONFIG
-    fmtcnffile=`kpsewhich --format='web2c files' fmtutil.cnf`
+    fmtcnffile=$(kpsewhich --format='web2c files' fmtutil.cnf)
     # this is slow, and since we hope/assure that all ini files
     # are installed if the format is active, we don't need the
     # extra check fmtutil does when called with catcfg
-    # X=`fmtutil-sys --catcfg | grep "^$1[[:space:]]" || true`
-    X=`grep "^[[:space:]]*$1[[:space:]]" $fmtcnffile || true`
+    # X=$(fmtutil-sys --catcfg | grep "^$1[[:space:]]" || true)
+    X=$(grep "^[[:space:]]*$1[[:space:]]" $fmtcnffile || true)
     if [ -n "$X" ] ; then
         build_format --byhyphen "$2"
     fi
@@ -67,11 +78,11 @@
 dhit_build_format ()
 {
 
-    tempfile=`mktemp -p /tmp fmtutil.XXXXXXXX`
-    printf "Building format(s) $1 `basename "$2"`. This may take some time..."
+    tempfile=$(mktemp -p /tmp fmtutil.XXXXXXXX)
+    printf "Building format(s) $1 $(basename "$2"). This may take some time... "
     if fmtutil-sys "$1" "$2" > $tempfile 2>&1 ; then
         rm -f $tempfile
-        echo " done."
+        echo "done."
     else
         echo
         echo "fmtutil-sys failed. Output has been stored in"
@@ -85,33 +96,33 @@
 
 case "$1" in
     configure|abort-upgrade|abort-remove|abort-deconfigure)
-    	# it doesn't hurt to call all of them
-	# these commands are all in tex-common and can be run immediately
-        update-updmap --quiet
-	update-language
-	update-fmtutil
-	# mktexlsr may not be present
-	if which mktexlsr >/dev/null; then
-	    dhit_update_lsr_files
-	fi
-	# all of the following needs an installed and configured
-	# base TeX system, so check this
-	if kpsewhich --version > /dev/null 2>&1 ; then
-	    for i in #WHATTODO# ; do
-		if [ "$i" = map ] ; then
-		    dhit_create_fontmaps
-		fi
-		if [ "$i" = format ] ; then
-		    for fmt in #FORMATS# ; do
-			dhit_build_format --byfmt $fmt
-		    done
-		fi
-		if [ "$i" = language ] ; then
-		    dhit_build_hyphen_format_if_format_exists \
-                        latex `kpsewhich language.dat`
-		fi
-	    done
-	fi
+        # All of the following needs an installed and configured
+        # basic TeX system, so check this.
+        if dhit_libkpathsea_configured; then
+            # It doesn't hurt to call all of them.
+            # These programs are all in tex-common and can be run immediately.
+            update-updmap --quiet
+            update-language
+            update-fmtutil
+            # mktexlsr may not be present
+            if which mktexlsr >/dev/null; then
+                dhit_update_lsr_files
+            fi
+            for i in #WHATTODO# ; do
+                if [ "$i" = map ] ; then
+                    dhit_create_fontmaps
+                fi
+                if [ "$i" = format ] ; then
+                    for fmt in #FORMATS# ; do
+                        dhit_build_format --byfmt $fmt
+                    done
+                fi
+                if [ "$i" = language ] ; then
+                    dhit_build_hyphen_format_if_format_exists \
+                        latex $(kpsewhich language.dat)
+                fi
+            done
+        fi
     ;;
 
     *)
@@ -119,4 +130,3 @@
         exit 1
     ;;
 esac
-

Modified: tex-common/trunk/scripts/postrm-tex
===================================================================
--- tex-common/trunk/scripts/postrm-tex	2006-02-18 18:20:44 UTC (rev 901)
+++ tex-common/trunk/scripts/postrm-tex	2006-02-18 20:32:38 UTC (rev 902)
@@ -4,31 +4,42 @@
 # postinst snippets for installing stuff for TeX
 #
 # Authors:
-#	Florent Rougon <f.rougon at free.fr>
-#	Norbert Preining <preining at logic.at>
+#       Florent Rougon <f.rougon at free.fr>
+#       Norbert Preining <preining at logic.at>
 #
 # Please note that comments in this file are stripped before installation
 # by calling a grep -v '^[ \t]*#'
 # So please be careful if you add stuff here!
 
+
+# Tell if kpsewhich works. If this is the case:
+#
+#   1. kpsewhich is installed and;
+#
+#   2. libkpathsea is configured.
+dhit_libkpathsea_configured ()
+{
+    return kpsewhich --version >/dev/null 2>&1
+}
+
 dhit_check_run_without_errors ()
 {
-    tempfile=`mktemp -p /tmp checkrun.XXXXXXXX`
-    if which "$1"  >/dev/null; then
+    tempfile=$(mktemp -p /tmp checkrun.XXXXXXXX)
+    if which "$1" >/dev/null; then
         printf "Running $*. This may take some time..."
-	set +e
-	if "$@" > $tempfile 2>&1 ; then
-	    rm -f $tempfile
-	    echo " done."
-	else
-	    echo
-	    echo "$* failed. Output has been stored in"
-	    echo "$tempfile"
-	    echo "If tex-common is not configured you can ignore this error message!"
-	    echo "Otherwise, please include this file if you report a bug."
-	    echo
-	fi
-	set -e
+        set +e
+        if "$@" > $tempfile 2>&1 ; then
+            rm -f $tempfile
+            echo " done."
+        else
+            echo
+            echo "$* failed. Output has been stored in"
+            echo "$tempfile"
+            echo "If tex-common is not configured you can ignore this error message!"
+            echo "Otherwise, please include this file if you report a bug."
+            echo
+        fi
+        set -e
     else
         rm -f $tempfile
     fi
@@ -38,8 +49,8 @@
 dhit_build_format ()
 {
 
-    tempfile=`mktemp -p /tmp fmtutil.XXXXXXXX`
-    printf "Building format(s) $1 `basename "$2"`. This may take some time..."
+    tempfile=$(mktemp -p /tmp fmtutil.XXXXXXXX)
+    printf "Building format(s) $1 $(basename "$2"). This may take some time..."
     if fmtutil-sys "$1" "$2" > $tempfile 2>&1 ; then
         rm -f $tempfile
         echo " done."
@@ -55,13 +66,13 @@
 
 dhit_build_hyphen_format_if_format_exists ()
 {
-    v=`kpsewhich -var-value TEXMFSYSVAR`
-    c=`kpsewhich -var-value TEXMFSYSCONFIG`
+    v=$(kpsewhich -var-value TEXMFSYSVAR)
+    c=$(kpsewhich -var-value TEXMFSYSCONFIG)
     TEXMFVAR="$v"
     TEXMFCONFIG="$c"
     export TEXMFVAR TEXMFCONFIG
-    fmtcnffile=`kpsewhich --format='web2c files' fmtutil.cnf`
-    X=`cat $fmtcnffile | grep "^[[:space:]]*$1[[:space:]]" || true`
+    fmtcnffile=$(kpsewhich --format='web2c files' fmtutil.cnf)
+    X=$(grep "^[[:space:]]*$1[[:space:]]" "$fmtcnffile" || true)
     if [ -n "$X" ] ; then
         dhit_build_format --byhyphen "$2"
     fi
@@ -70,27 +81,33 @@
 
 case "$1" in
     remove|disappear)
-	# it doesn't hurt to cal all of them
-	dhit_check_run_without_errors update-updmap --quiet
-	dhit_check_run_without_errors update-language
-	dhit_check_run_without_errors update-fmtutil
-	dhit_check_run_without_errors mktexlsr
-	for i in #WHATTODO# ; do
-	    if [ "$i" = map ] ; then
-		dhit_check_run_without_errors updmap-sys
-	    fi
-	    if [ "$i" = format ] ; then
-		for fmt in #FORMATS# ; do
-		    rm -f /var/lib/texmf/web2c/$fmt.*
-		done
-	    fi
-	    if [ "$i" = language ] ; then
-		if which fmtutil-sys >/dev/null ; then
-		    dhit_build_hyphen_format_if_format_exists \
-                        latex `kpsewhich language.dat`
-		fi
-	    fi
-	done
+        # The following needs an installed and configured basic TeX system, so
+        # check this.
+        if dhit_libkpathsea_configured; then
+            # It doesn't hurt to call all of them.
+            dhit_check_run_without_errors update-updmap --quiet
+            dhit_check_run_without_errors update-language
+            dhit_check_run_without_errors update-fmtutil
+            dhit_check_run_without_errors mktexlsr
+        fi
+        for i in #WHATTODO# ; do
+            if [ "$i" = map ] ; then
+                dhit_libkpathsea_configured && \
+                    dhit_check_run_without_errors updmap-sys
+            fi
+            if [ "$i" = format ] ; then
+                for fmt in #FORMATS# ; do
+                    rm -f /var/lib/texmf/web2c/$fmt.*
+                done
+            fi
+            if [ "$i" = language ] ; then
+                if dhit_libkpathsea_configured && \
+                    which fmtutil-sys >/dev/null; then
+                    dhit_build_hyphen_format_if_format_exists \
+                        latex $(kpsewhich language.dat)
+                fi
+            fi
+        done
     ;;
 
     purge|upgrade|failed-upgrade|abort-upgrade|abort-install)
@@ -101,5 +118,3 @@
         exit 1
     ;;
 esac
-
-




More information about the Pkg-tetex-commits mailing list