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

Bug#694400: unblock: latex209/25.mar.1992-13



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Dear release managers,

as a follow up to the many emails that went around the RC bug #669382
I have now uploaded a fix for it that is radical, but it is the way
to go, IMNHO.

The problem with the mentioned bug was that mktexlsr was called in
some unprotected ways. Normally packages use dh_installtex (from 
tex-common) to auto-generate necessary maintainer script snippets.
These packages are all fine.

latex209 packages (-base, -bin) were in a state since long with hand
written maintainer scripts, probably long before dh_installtex was
conceived, but properly handling these case is tiresome.
Furthermore, also the format handling (latex format based on the
shipped files) was hand written and did not conform to the standards
set forth in tex-common.

After email contact with the current maintainer TSUCHIYA Masatoshi
he agreed to hand over the package to the Debian TeX Group, and I have
prepared a package that fixes this bug by the following actions:
latex209 (25.mar.1992-13) unstable; urgency=low

  * Take over maintenance into the Debian TeX Group
  * fix RC bug (Closes: #669382) (create files that are not removed) by:
    - remove all maintainer scripts
    - create the necessary code with dh_installtex
    - add necessary build-dep on tex-common
  * add latex209-bin.preinst to fix up old conffile so that debconf does
    not ask unnecessary questions

 -- Norbert Preining <preining@debian.org>  Tue, 13 Nov 2012 14:50:17 +0900


Let us look at the actual code (dropping trivialities like the
control changes to maintainers etc). We have to deal with two
things:
1* auto-generation of mktexlsr and format generation calls
2* take over old postinst-generated configuration files without
   necessarily bothering the admin


First of all we dropped
	postinst, postrm
for both packages and changed the rules files to include the necessary
calls to dh_installtex:
diff -Nru latex209-25.mar.1992/debian/rules latex209-25.mar.1992/debian/rules
--- latex209-25.mar.1992/debian/rules	2012-05-18 14:45:45.000000000 +0900
+++ latex209-25.mar.1992/debian/rules	2012-11-13 14:52:53.000000000 +0900
@@ -22,7 +22,9 @@
 	rm -f build-stamp
 	dh_clean
 
-build: build-stamp
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep: build-stamp
 build-stamp:
 	touch $@
 
@@ -46,6 +48,7 @@
 	mv $(BASE)/splain.tex $(INI)
 	mv $(BASE)/latex.ins $(DOC)
 	cp -p readme.* $(DOC)
+	dh_installtex
 
 install-bin: prefix=$(CURDIR)/debian/latex209-bin/usr
 install-bin: DH_OPTIONS=-platex209-bin
@@ -55,6 +58,8 @@
 	dh_testroot
 	mkdir -p $(BIN)
 	cd $(BIN) && ln -s tex latex209
+	dh_installtex --priority=25 formatfile=debian/latex209.cnf \
+		--flavor=format:no_links
 
 install-src: prefix=$(CURDIR)/debian/latex209-src/usr
 install-src: DH_OPTIONS=-platex209-src


The second call links to the new file debian/latex209.cnf. THis file
was previously generated in the postinst and removed/renamed in the
prerm scripts of the latex209-bin packages.
diff -Nru latex209-25.mar.1992/debian/latex209.cnf latex209-25.mar.1992/debian/latex209.cnf
--- latex209-25.mar.1992/debian/latex209.cnf	1970-01-01 09:00:00.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209.cnf	2012-11-13 14:52:53.000000000 +0900
@@ -0,0 +1,6 @@
+#
+# LaTeX 2.09
+#
+# format	engine		pattern-file	arguments
+latex209	tex		-		latex209.ini
+


Finally, we added one preinst script that tries to carry over information
from the old package to the new package without asking unnecessary
questions to the user:

+#!/bin/sh -e
+#
+# latex209-bin preinst script
+#
+#
+
+# if the config file from previous versions is present and matches the
+# md5sum, add the new dh_installtex header to make sure that no debconf
+# questions are asked, otherwise just let the user decide.
+#
+
+cnffile=/etc/texmf/fmt.d/25latex209.cnf
+bakfile=/etc/texmf/fmt.d/25latex209.bak
+correctmd=7c958ab4f8bf7a0080bc46c48d137bd1
+
+fix_it_up=0
+
+case "$1" in
+  upgrade|install)
+    old_version=$2
+    if [ -n "$old_version" ] && dpkg --compare-versions "$old_version" lt 25.mar.1992-12.6 ; then
+      if [ -r $cnffile ] ; then
+        # if an old conffile is found and matches the md5 sum, we fix it up
+        # otherwise we leave it alone
+	oldmd=`md5sum $cnffile | sed -e 's/ .*//'`
+        if [ "$oldmd" = $correctmd ] ; then
+          fix_it_up=1
+        fi
+      elif [ -r $bakfile ] ; then
+        # if the backup file is found, and matches the md5 sum, we simply delete
+        # it, as it will be reinstatiated by dpkg
+	oldmd=`md5sum $bakfile | sed -e 's/ .*//'`
+        if [ "$oldmd" = $correctmd ] ; then
+          rm $bakfile
+        else
+          mv $bakfile $cnffile
+        fi
+      fi
+      
+      if [ $fix_it_up = 1 ] ; then
+        echo '# 25latex209.cnf
+# You can change/add entries to this file and changes will be preserved
+# over upgrades, even if you have removed the main package prior
+# (not if you purged it). You should leave the following pseudo comment
+# present in the file!
+# -_- DebPkgProvidedMaps -_-
+# 
+#
+# LaTeX 2.09
+#
+# format	engine		pattern-file	arguments
+latex209	tex		-		latex209.ini
+' > $cnffile
+      fi
+    fi
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+
+



This way we make sure that only if the admin has changed something in
the configuration file he will get asked questions about upgrade.

-------------------

Although it is a rather bulky debdiff for a unblock, I still hope to
get these changes as fixes for the above mentioned rc bug into testing.

Thanks a lot for your understanding, and don't hesitate to ask me
if you have any further questions.

The full debdiff is attached.

Norbert



unblock latex209/25.mar.1992-13

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.7.0-rc6+ (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
diff -Nru latex209-25.mar.1992/debian/changelog latex209-25.mar.1992/debian/changelog
--- latex209-25.mar.1992/debian/changelog	2012-05-18 15:08:59.000000000 +0900
+++ latex209-25.mar.1992/debian/changelog	2012-11-13 14:52:53.000000000 +0900
@@ -1,3 +1,15 @@
+latex209 (25.mar.1992-13) unstable; urgency=low
+
+  * Take over maintenance into the Debian TeX Group
+  * fix RC bug (Closes: #669382) (create files that are not removed) by:
+    - remove all maintainer scripts
+    - create the necessary code with dh_installtex
+    - add necessary build-dep on tex-common
+  * add latex209-bin.preinst to fix up old conffile so that debconf does
+    not ask unnecessary questions
+
+ -- Norbert Preining <preining@debian.org>  Tue, 13 Nov 2012 14:50:17 +0900
+
 latex209 (25.mar.1992-12.5) unstable; urgency=low
 
   * Non-maintainer upload.
diff -Nru latex209-25.mar.1992/debian/control latex209-25.mar.1992/debian/control
--- latex209-25.mar.1992/debian/control	2012-05-15 15:25:27.000000000 +0900
+++ latex209-25.mar.1992/debian/control	2012-11-13 14:52:53.000000000 +0900
@@ -1,10 +1,10 @@
 Source: latex209
 Section: tex
 Priority: optional
-Maintainer: TSUCHIYA Masatoshi <tsuchiya@namazu.org>
-Build-Depends: debhelper (>> 5.0.0)
+Maintainer: Debian TeX maintainers <debian-tex-maint@lists.debian.org>
+Build-Depends: debhelper (>> 5.0.0), tex-common (>= 3)
 Standards-Version: 3.8.4
-Uploaders: Atsuhito Kohda <kohda@debian.org>
+Uploaders: Atsuhito Kohda <kohda@debian.org>, Norbert Preining <preining@debian.org>
 
 Package: latex209-base
 Architecture: all
diff -Nru latex209-25.mar.1992/debian/copyright latex209-25.mar.1992/debian/copyright
--- latex209-25.mar.1992/debian/copyright	2010-04-06 09:44:17.000000000 +0900
+++ latex209-25.mar.1992/debian/copyright	2012-11-13 14:52:53.000000000 +0900
@@ -1,8 +1,8 @@
 This package was debianized by Nakahara Hayao <nakahara@mis.hiroshima-u.ac.jp>
 for Debian JP Project on Sat, 29 Nov 1997 19:33:58 +0900.
 
-Currently maintained by TSUCHIYA Masatoshi <tsuchiya@namazu.org>, who
-is sponsored by Masayuki Hatta <mhatta@debian.org>.
+Currently maintained by the Debian TeX Maintainer,
+former maintainer was TSUCHIYA Masatoshi <tsuchiya@namazu.org>.
 
 It was downloaded from ftp.riken.go.jp (one of CTAN sites).
 URL is ftp://ftp.riken.go.jp/pub/tex-archive/obsolete/macros/latex209/distribs/latex209.tar
diff -Nru latex209-25.mar.1992/debian/latex209-base.postinst latex209-25.mar.1992/debian/latex209-base.postinst
--- latex209-25.mar.1992/debian/latex209-base.postinst	2012-05-15 15:17:15.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-base.postinst	1970-01-01 09:00:00.000000000 +0900
@@ -1,44 +0,0 @@
-#! /bin/sh
-# postinst script for latex209-base
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see /usr/doc/packaging-manual/
-#
-# quoting from the policy:
-#     Any necessary prompting should almost always be confined to the
-#     post-installation script, and should be protected with a conditional
-#     so that unnecessary prompting doesn't happen if a package's
-#     installation fails and the `postinst' is called with `abort-upgrade',
-#     `abort-remove' or `abort-deconfigure'.
-
-TEXMF=/usr/share/texmf
-
-case "$1" in
-    configure)
-	mktexlsr $TEXMF
-	;;
-    abort-upgrade|abort-remove|abort-deconfigure)
-	;;
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 0
-	;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru latex209-25.mar.1992/debian/latex209-base.postrm latex209-25.mar.1992/debian/latex209-base.postrm
--- latex209-25.mar.1992/debian/latex209-base.postrm	2012-05-15 15:16:28.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-base.postrm	1970-01-01 09:00:00.000000000 +0900
@@ -1,39 +0,0 @@
-#! /bin/sh
-# postrm script for latex209-base
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postrm> `remove'
-#        * <postrm> `purge'
-#        * <old-postrm> `upgrade' <new-version>
-#        * <new-postrm> `failed-upgrade' <old-version>
-#        * <new-postrm> `abort-install'
-#        * <new-postrm> `abort-install' <old-version>
-#        * <new-postrm> `abort-upgrade' <old-version>
-#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
-# for details, see /usr/doc/packaging-manual/
-
-TEXMF=/usr/share/texmf
-
-case "$1" in
-    remove|purge)
-	if [ -x /usr/bin/mktexlsr ]; then
-            mktexlsr $TEXMF
-        fi
-	;;
-    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-        ;;
-    *)
-        echo "postrm called with unknown argument \`$1'" >&2
-        exit 0
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru latex209-25.mar.1992/debian/latex209-bin.postinst latex209-25.mar.1992/debian/latex209-bin.postinst
--- latex209-25.mar.1992/debian/latex209-bin.postinst	2010-04-07 20:51:51.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-bin.postinst	1970-01-01 09:00:00.000000000 +0900
@@ -1,86 +0,0 @@
-#! /bin/sh 
-# postinst script for latex209-bin
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postinst> `configure' <most-recently-configured-version>
-#        * <old-postinst> `abort-upgrade' <new version>
-#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
-#          <new-version>
-#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
-#          <failed-install-package> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see /usr/doc/packaging-manual/
-#
-# quoting from the policy:
-#     Any necessary prompting should almost always be confined to the
-#     post-installation script, and should be protected with a conditional
-#     so that unnecessary prompting doesn't happen if a package's
-#     installation fails and the `postinst' is called with `abort-upgrade',
-#     `abort-remove' or `abort-deconfigure'.
-
-update_fmtutil()
-{
-    d=/etc/texmf/fmt.d
-    f=${d}/25latex209.cnf
-    b=${d}/25latex209.bak
-    if [ ! -f ${f} ] ; then
-	if [ -f ${b} ] ; then
-	    echo "Preserved \`25latex209.bak' is found."
-	    mv -f ${b} ${f}
-	else
-	    cat <<EOF >${f}
-#
-# LaTeX 2.09
-#
-# format	engine		pattern-file	arguments
-latex209	tex		-		latex209.ini
-
-EOF
-	fi
-    fi
-    update-fmtutil
-}
-
-make_format()
-{
-    if [ -x /usr/bin/fmtutil-sys ]; then
-	UTIL=fmtutil-sys
-    else
-	UTIL=fmtutil
-    fi
-    target=$1
-    formats=/var/lib/texmf/web2c/tex
-    echo "Make the format file of \`${target}'. This may take some time. ..."
-    if ( ${UTIL} --byfmt ${target} ) ; then
-	${MT_MKTEXUPD=`kpsewhich --format='web2c files' mktexupd`} \
-	    ${formats} ${target}.fmt
-	echo "The format file of \`${target}' is built successfully." 1>&2
-    else
-	echo "The format file of \`${target}' is NOT built successfully." 1>&2
-	exit 1
-    fi
-}
-
-case "$1" in
-    configure)
-	update_fmtutil
-	make_format latex209
-	;;
-    abort-upgrade|abort-remove|abort-deconfigure)
-	;;
-    *)
-        echo "postinst called with unknown argument \`$1'" >&2
-        exit 0
-	;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru latex209-25.mar.1992/debian/latex209-bin.postrm latex209-25.mar.1992/debian/latex209-bin.postrm
--- latex209-25.mar.1992/debian/latex209-bin.postrm	2010-04-06 10:50:14.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-bin.postrm	1970-01-01 09:00:00.000000000 +0900
@@ -1,48 +0,0 @@
-#!/bin/sh
-# postrm script for latex209-bin
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <postrm> `remove'
-#        * <postrm> `purge'
-#        * <old-postrm> `upgrade' <new-version>
-#        * <new-postrm> `failed-upgrade' <old-version>
-#        * <new-postrm> `abort-install'
-#        * <new-postrm> `abort-install' <old-version>
-#        * <new-postrm> `abort-upgrade' <old-version>
-#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
-# for details, see /usr/doc/packaging-manual/
-
-case "$1" in
-    purge)
-	rm -f /etc/texmf/fmt.d/25latex209.cnf
-	rm -f /etc/texmf/fmt.d/25latex209.bak
-	if [ -x /usr/sbin/update-fmtutil ]; then
-            update-fmtutil
-        fi
-	;;
-    remove)
-	if [ -f /etc/texmf/fmt.d/25latex209.cnf ] ; then
-	    mv -f /etc/texmf/fmt.d/25latex209.cnf /etc/texmf/fmt.d/25latex209.bak
-	fi
-	if [ -x /usr/sbin/update-fmtutil ]; then
-            update-fmtutil
-        fi
-	;;
-    upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
-        ;;
-    *)
-        echo "postrm called with unknown argument \`$1'" >&2
-        exit 0
-	;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru latex209-25.mar.1992/debian/latex209-bin.preinst latex209-25.mar.1992/debian/latex209-bin.preinst
--- latex209-25.mar.1992/debian/latex209-bin.preinst	1970-01-01 09:00:00.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-bin.preinst	2012-11-13 14:52:53.000000000 +0900
@@ -0,0 +1,63 @@
+#!/bin/sh -e
+#
+# latex209-bin preinst script
+#
+#
+
+# if the config file from previous versions is present and matches the
+# md5sum, add the new dh_installtex header to make sure that no debconf
+# questions are asked, otherwise just let the user decide.
+#
+
+cnffile=/etc/texmf/fmt.d/25latex209.cnf
+bakfile=/etc/texmf/fmt.d/25latex209.bak
+correctmd=7c958ab4f8bf7a0080bc46c48d137bd1
+
+fix_it_up=0
+
+case "$1" in
+  upgrade|install)
+    old_version=$2
+    if [ -n "$old_version" ] && dpkg --compare-versions "$old_version" lt 25.mar.1992-12.6 ; then
+      if [ -r $cnffile ] ; then
+        # if an old conffile is found and matches the md5 sum, we fix it up
+        # otherwise we leave it alone
+	oldmd=`md5sum $cnffile | sed -e 's/ .*//'`
+        if [ "$oldmd" = $correctmd ] ; then
+          fix_it_up=1
+        fi
+      elif [ -r $bakfile ] ; then
+        # if the backup file is found, and matches the md5 sum, we simply delete
+        # it, as it will be reinstatiated by dpkg
+	oldmd=`md5sum $bakfile | sed -e 's/ .*//'`
+        if [ "$oldmd" = $correctmd ] ; then
+          rm $bakfile
+        else
+          mv $bakfile $cnffile
+        fi
+      fi
+      
+      if [ $fix_it_up = 1 ] ; then
+        echo '# 25latex209.cnf
+# You can change/add entries to this file and changes will be preserved
+# over upgrades, even if you have removed the main package prior
+# (not if you purged it). You should leave the following pseudo comment
+# present in the file!
+# -_- DebPkgProvidedMaps -_-
+# 
+#
+# LaTeX 2.09
+#
+# format	engine		pattern-file	arguments
+latex209	tex		-		latex209.ini
+' > $cnffile
+      fi
+    fi
+    ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+
+
diff -Nru latex209-25.mar.1992/debian/latex209-bin.prerm latex209-25.mar.1992/debian/latex209-bin.prerm
--- latex209-25.mar.1992/debian/latex209-bin.prerm	2010-04-06 10:50:48.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209-bin.prerm	1970-01-01 09:00:00.000000000 +0900
@@ -1,39 +0,0 @@
-#!/bin/sh
-# prerm script for latex209-bin
-#
-# see: dh_installdeb(1)
-
-set -e
-
-# summary of how this script can be called:
-#        * <prerm> `remove'
-#        * <old-prerm> `upgrade' <new-version>
-#        * <new-prerm> `failed-upgrade' <old-version>
-#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
-#        * <deconfigured's-prerm> `deconfigure' `in-favour'
-#          <package-being-installed> <version> `removing'
-#          <conflicting-package> <version>
-# for details, see /usr/share/doc/packaging-manual/
-
-case "$1" in
-    remove|upgrade|deconfigure)
-	rm -f /var/lib/texmf/web2c/latex209.fmt
-	rm -f /var/lib/texmf/web2c/latex209.log
-	if [ -x /usr/bin/mktexlsr ]; then
-            mktexlsr
-        fi
-	;;
-    failed-upgrade)
-        ;;
-    *)
-        echo "prerm called with unknown argument \`$1'" >&2
-        exit 0
-	;;
-esac
-
-# dh_installdeb will replace this with shell code automatically
-# generated by other debhelper scripts.
-
-#DEBHELPER#
-
-exit 0
diff -Nru latex209-25.mar.1992/debian/latex209.cnf latex209-25.mar.1992/debian/latex209.cnf
--- latex209-25.mar.1992/debian/latex209.cnf	1970-01-01 09:00:00.000000000 +0900
+++ latex209-25.mar.1992/debian/latex209.cnf	2012-11-13 14:52:53.000000000 +0900
@@ -0,0 +1,6 @@
+#
+# LaTeX 2.09
+#
+# format	engine		pattern-file	arguments
+latex209	tex		-		latex209.ini
+
diff -Nru latex209-25.mar.1992/debian/rules latex209-25.mar.1992/debian/rules
--- latex209-25.mar.1992/debian/rules	2012-05-18 14:45:45.000000000 +0900
+++ latex209-25.mar.1992/debian/rules	2012-11-13 14:52:53.000000000 +0900
@@ -22,7 +22,9 @@
 	rm -f build-stamp
 	dh_clean
 
-build: build-stamp
+build: build-arch build-indep
+build-arch: build-stamp
+build-indep: build-stamp
 build-stamp:
 	touch $@
 
@@ -46,6 +48,7 @@
 	mv $(BASE)/splain.tex $(INI)
 	mv $(BASE)/latex.ins $(DOC)
 	cp -p readme.* $(DOC)
+	dh_installtex
 
 install-bin: prefix=$(CURDIR)/debian/latex209-bin/usr
 install-bin: DH_OPTIONS=-platex209-bin
@@ -55,6 +58,8 @@
 	dh_testroot
 	mkdir -p $(BIN)
 	cd $(BIN) && ln -s tex latex209
+	dh_installtex --priority=25 formatfile=debian/latex209.cnf \
+		--flavor=format:no_links
 
 install-src: prefix=$(CURDIR)/debian/latex209-src/usr
 install-src: DH_OPTIONS=-platex209-src

Reply to: