[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#196582: tetex-bin: please make update-texmf check for fingerprint in texmf.cnf



tags 196582 + patch
quit

* Marcelo E. Magallon

 > update-texmf writes this line to texmf.cnf:
 >
 >    %%% This file is automatically generated by update-texmf
 >
 > please grep for it before deciding to overwrite the file.

  An even better solution would be to use ucf to handle this file.  This
 way, the file will by default be "managed by Debconf", but without the
 need to ask a question to make a the loophole needed to get away with
 violating Policy 11.7.3.

  I've attached a patch which updates update-texmf to use ucf.  It should
 apply to tetex-bin 2.0.2-4.1.  I do not use TeX, so there might be a few
 snags, even though I've done some sparse testing.  Also, it only deals
 with texmf.cnf -- I see there's also a few other files who are treated
 similarily.  It's trivial to extend it to cover those too, though.

  Atsuhito, please consider implementing this patch.  I believe it
 satisfies both your and Marcelo (and mine) desires for the handling of
 texmf.cnf:

  1)  If the user do not edit the /etc/texmf/texmf.cnf file, it will
     always be handled fully by update-texmf, thus the installation
     of additional TeX components which drop snippets into
     /etc/texmf/texmf.d/ and invokes update-texmf in their postinst
     will be a breeze, texmf.cnf will always be updated without any
     questions;  it will Simply Work.

  2)  If the user modifies /etc/texmf/texmf.cnf, and the update-texmf-
     generated version doesn't change, the user's modifications will
     remain unchanged, without any notification at all.  Just like a
     file handled by dpkg.

  3)  If the user modifies /etc/texmf/texmf.cnf, and the update-texmf-
     generated version is changes (because there's a new file in
     /etc/texmf/texmf.d/, or update-texmf's internal logic changes),
     update-texmf will pop up a question, closely resembling the one
     dpkg asks when a conffile has changed both on the system and in
     the package.  The user has now the possibility to accept the
     new upate-texmf-generated texmf.cnf, continue using his own,
     or see a diff/do a three-way merge/background dpkg.

  You could for example make update-texmf add a note to the top of
 the generated texmf.cnf file stating that the reccomended Debian
 way of making local additions to the file is to create a local.cnf-
 file in /etc/texmf/texmf.d/ -- then you'd support a way of making
 local changes while still have automatic updating of the file
 when new TeX components is installed.  And at the same time, people
 can replace the file entirely, and still be certain that their
 changes shall not be overwritten, unless they explicitly answer
 yes when asked.

  The one downside that I can see, is the added dependency.  But
 that's nothing, when compared to all the advantages you get.  Agree?

-- 
Tore Anderson
diff -ruN tetex-bin-2.0.2/debian/changelog tetex-bin-2.0.2-ucf/debian/changelog
--- tetex-bin-2.0.2/debian/changelog	2003-06-13 22:58:38.000000000 +0200
+++ tetex-bin-2.0.2-ucf/debian/changelog	2003-06-13 22:07:39.000000000 +0200
@@ -1,3 +1,9 @@
+tetex-bin (2.0.2-4.2) unstable; urgency=low
+
+  * Use ucf to handle /etc/texmf/texmf.cnf.
+
+ -- Tore Anderson <tore@linpro.no>  Fri, 13 Jun 2003 22:07:35 +0200
+
 tetex-bin (2.0.2-4.1) unstable; urgency=low
 
   * Fixed debian/config  [kohda]  (Closes: #195604, #195621)
diff -ruN tetex-bin-2.0.2/debian/config tetex-bin-2.0.2-ucf/debian/config
--- tetex-bin-2.0.2/debian/config	2003-06-13 22:58:38.000000000 +0200
+++ tetex-bin-2.0.2-ucf/debian/config	2003-06-13 23:00:41.000000000 +0200
@@ -4,9 +4,6 @@
 . /usr/share/debconf/confmodule || exit
 db_version 2.0
 
-# texmf.cnf handling
-db_input high tetex-bin/texmf || true
-db_go || true
 # fmtutil.cnf handling
 db_input high tetex-bin/fmtutil || true
 db_go || true
diff -ruN tetex-bin-2.0.2/debian/control tetex-bin-2.0.2-ucf/debian/control
--- tetex-bin-2.0.2/debian/control	2003-06-13 22:58:38.000000000 +0200
+++ tetex-bin-2.0.2-ucf/debian/control	2003-06-13 23:05:53.000000000 +0200
@@ -13,7 +13,7 @@
 Conflicts: texbin, xdvik, mflib, kpathsea, makeindex, ps2pk, latex, nextawg (<= 0.5.1-34), nextaw (<< 0.8-2), dvipdfm, alml (<< 2002.08.29-4), jbibtex-bin (<< 3.0.5+0.04-2), jtex-bin (<= 1.8-5.1), passivetex (<< 1.21-5), ptex-bin (<< 3.0.5+0.04-2), xmltex (<< 1.9-4), cweb
 Provides: tex, latex, dvips, dvipsk, xdvi, metafont, dvipdfm, cweb
 Pre-Depends: dpkg (>= 1.6.8)
-Depends: ${shlibs:Depends}, ${perl:Depends}, tetex-base (>> 2.0.2-3), ed, debianutils (>= 1.13.1), debconf (>= 0.2.26)
+Depends: ${shlibs:Depends}, ${perl:Depends}, tetex-base (>> 2.0.2-3), ed, debianutils (>= 1.13.1), debconf (>= 0.2.26), ucf (>= 0.14)
 Suggests: lpr, gs | gs-aladdin, postscript-viewer, pdf-viewer, tetex-extra, texinfo
 Recommends: dialog, psutils, texi2html
 Description: teTeX binary files
diff -ruN tetex-bin-2.0.2/debian/postinst tetex-bin-2.0.2-ucf/debian/postinst
--- tetex-bin-2.0.2/debian/postinst	2003-06-13 22:58:38.000000000 +0200
+++ tetex-bin-2.0.2-ucf/debian/postinst	2003-06-13 23:01:27.000000000 +0200
@@ -65,26 +65,11 @@
 
 # should remove at purge; ${ETXMFC}.dpkg-old ${EFMTUC}.dpkg-old ${EUMAPC}.dpkg-old
 
-db_get tetex-bin/texmf || true
-if [ X"$RET" = X"true" ]; then
-    if dpkg --compare-versions "$2" lt 1.0.7+20011202-5.1; then
-  # Handle new conffile -> configuration file setup
-	if [ -f ${ETXMFC} ]; then
-	    echo " ${ETXMFC} is no longer used and a file generated by ${UPDTXMF}"
-	    echo "will be used from now on.  Old ${ETXMFC} will be reserved for your reference."
-#	    mv ${ETXMFC} ${ETXMFC}.dpkg-old
-#	    cp -f ${TXMFCTPL} ${ETXMFC}
-	fi
-    fi
-    if [ -L ${VTXMFC} ] ; then rm -f ${VTXMFC}; fi
-    if [ -x ${UPDTXMF} ] ; then ${UPDTXMF} -v; fi
-else
-    if [ ! -f ${ETXMFC} ] ; then cp -f ${TXMFCTPL} ${ETXMFC}; fi
-    if [ ! -L ${VTXMFC} ] ; then
-	rm -f ${VTXMFC}
-	(cd /var/lib/texmf/web2c; ln -s ${ETXMFC} . )
-    fi
-fi
+# since update-texmf uses ucf, we can be sure that the configuration file
+# will be handled according to Policy.  Therefore we invoke it
+# unconditionally at every postinst.
+
+if [ -x ${UPDTXMF} ] ; then ${UPDTXMF} -v; fi
 
 db_get tetex-bin/fmtutil || true
 if [ X"$RET" = X"true" ]; then
diff -ruN tetex-bin-2.0.2/debian/postrm tetex-bin-2.0.2-ucf/debian/postrm
--- tetex-bin-2.0.2/debian/postrm	2003-06-13 22:58:38.000000000 +0200
+++ tetex-bin-2.0.2-ucf/debian/postrm	2003-06-13 22:48:42.000000000 +0200
@@ -16,8 +16,21 @@
 
 rm -f /usr/lib/texmf/web2c /usr/share/texmf/web2c || true
 
+# this is borrowed from my LRRD packages
+purge_ucf_file () {
+	local conffile="$1"
+	# this list is from dpkg-1.10.9/include/dpkg.h.in
+	for ext in '~' '%' .bak .dpkg-tmp .dpkg-new .dpkg-old .dpkg-dist; do
+		rm -f "${conffile}${ext}"
+	done
+	rm -f "${conffile}"
+	ucf --purge "${conffile}"
+}
+
 if [ x"$1" = xpurge ] ; then
-  rm -f ${TEXMFC}* ${FMTCNF}*
+  purge_ucf_file ${TEXMFC}
+  rm -f /var/lib/texmf/web2c/texmf.cnf
+  rm -f ${FMTCNF}*
   rm -rf ${TEXMFD}
   rm -rf ${FMTD}
   VARFONTSFILE=/etc/texmf/varfontdirs.debian
diff -ruN tetex-bin-2.0.2/debian/templates tetex-bin-2.0.2-ucf/debian/templates
--- tetex-bin-2.0.2/debian/templates	2003-06-13 22:58:38.000000000 +0200
+++ tetex-bin-2.0.2-ucf/debian/templates	2003-06-13 23:00:48.000000000 +0200
@@ -1,20 +1,3 @@
-Template: tetex-bin/texmf
-Type: boolean
-Default: false
-_Description: Use automatic generation of texmf.cnf with update-texmf?
- Now we can generate texmf.cnf, the central configuration file for TeX system,
- automatically with update-texmf script.  This is necessary for other TeX
- related packages to update the contents of texmf.cnf
- .
- But this overwrites the existing texmf.cnf so if you don't want it, don't
- accept this.  Then you should modify /etc/texmf/texmf.cnf manually.
- But REMARK that you could fail to install some TeX components afterwards.
- .
- For many users, it is recommended to accept this, despite the default was
- set contrary, because this is necessary to install many other TeX related
- packages and, if you want, you can custmize texmf.cnf freely only with
- modifying files in /etc/texmf/texmf.d/ and adding necessary file(s) there.
-
 Template: tetex-bin/fmtutil
 Type: boolean
 Default: false
diff -ruN tetex-bin-2.0.2/debian/update-texmf tetex-bin-2.0.2-ucf/debian/update-texmf
--- tetex-bin-2.0.2/debian/update-texmf	2003-06-13 22:58:38.000000000 +0200
+++ tetex-bin-2.0.2-ucf/debian/update-texmf	2003-06-13 23:01:05.000000000 +0200
@@ -12,10 +12,13 @@
     VERBOSE=false
 fi
 
-if [ -L "${VARD}/texmf.cnf" ]; then
-    echo "Did't run update-texmf as you requested!"
-    exit 0
-fi
+# because we now handle texmf.cnf with ucf, the real file will -always-
+# be located in /etc/, regardless of the user has modified it or no.  I
+# don't know if this is neccessary, but in case some program references
+# ${VARD}/texmf.cnf directly, ensure that it points to the correct file
+
+rm -f ${VARD}/texmf.cnf
+ln -s ${TXMF}/texmf.cnf ${VARD}/texmf.cnf
 
 if [ -f ${CNFDIR}/05TeXMF.cnf ] ; then
 CNFFILES=`/bin/ls -1 ${CNFDIR}/*.cnf`
@@ -25,28 +28,23 @@
 fi
 
 if [ "${VERBOSE}" = "true" ]; then
-  if [ -f "${VARD}/texmf.cnf" ]; then
-    echo -n "Regenerating ${VARD}/texmf.cnf ... " >&2
+  if [ -f "${TXMF}/texmf.cnf" ]; then
+    echo -n "Regenerating ${TXMF}/texmf.cnf ... " >&2
   else
-    echo -n "Generating ${VARD}/texmf.cnf ... " >&2
+    echo -n "Generating ${TXMF}/texmf.cnf ... " >&2
   fi
 fi
 
-(echo "%%% This file is automatically generated by update-texmf"; \
-echo "%"; \
-echo "% Please do not edit this file directly. If you want to change or add"; \
-echo "% anything please take a look at the files in ${CNFDIR}, and"; \
-echo "% invoke update-texmf."; \
-echo "%"; \
-echo "%%%" ) > ${VARD}/texmf.cnf_$$
-
 for i in ${CNFFILES}; do
     echo "%%% From file: $i" >> ${VARD}/texmf.cnf_$$
     cat $i >> ${VARD}/texmf.cnf_$$
     echo "%%% End of file: $i" >> ${VARD}/texmf.cnf_$$
 done
 #cat ${CNFFILES} >> ${VARD}/texmf.cnf_$$
-mv ${VARD}/texmf.cnf_$$ ${VARD}/texmf.cnf
+
+# now, invoke ucf, and then remove the suggested texmf.cnf.
+ucf --three-way ${VARD}/texmf.cnf_$$ ${TXMF}/texmf.cnf < /dev/tty
+rm ${VARD}/texmf.cnf_$$
 
 if [ "${VERBOSE}" = "true" ]; then
   echo "done"

Reply to: