On 10/18/06, Theppitak Karoonboonyanan <[EMAIL PROTECTED]> wrote:

I have been working on it. I can reproduce it with a debootstrapped
sarge chroot. And I've asked debian-mentors for the solution:
  http://lists.debian.org/debian-mentors/2006/10/msg00243.html
It seems Steve Langasek's solution can solve it.

Let me summarize the problem:

The diversion couldn't be removed because the babel.sty file
still exists, not because of the old tetex-base's ownership
(because the file is being diverted, the tetex-base's version
should be diverted to babel.sty.real) but because of thailatex's
own version.

Steve's solution is to remove the diversion at postinst, by
tricking dpkg-divert by moving away the newly installed
babel.sty before removing the diversion, and then moving
it back afterward. He has been careful in making the script
work even if it's called many times.

I haven't adopted the part that he suggested to Conflicts:
and Replaces: tetex-base (<<3.0), anyway. Blame me if
my decision is wrong.

Summarized change (with debdiff) is attached.

--
Theppitak Karoonboonyanan
http://linux.thai.net/~thep/
diff -Nru /tmp/c7n5FEG7kl/thailatex-0.3.7/debian/changelog /tmp/3gIQOsJr0N/thailatex-0.3.7/debian/changelog
--- /tmp/c7n5FEG7kl/thailatex-0.3.7/debian/changelog	2006-10-18 12:09:27.000000000 +0700
+++ /tmp/3gIQOsJr0N/thailatex-0.3.7/debian/changelog	2006-10-18 12:09:28.000000000 +0700
@@ -1,3 +1,15 @@
+thailatex (0.3.7-2) unstable; urgency=high
+
+  * Urgency high due to RC bug fix.
+  * Remove diversion at postinst instead of preinst.  Also move away the
+    babel.sty before removing, and back afterward, to make dpkg-divert work.
+    This fixes upgrading from sarge.  Thanks to Bill Allombert for discovering
+    the bug and to Steve Langasek for the solution.  (Closes: #393519)
+  * Bumped standard version to 3.7.2.2, no changes needed.
+  * debian/watch: Added.
+
+ -- Theppitak Karoonboonyanan <[EMAIL PROTECTED]>  Wed, 18 Oct 2006 08:00:30 +0700
+
 thailatex (0.3.7-1) unstable; urgency=low
 
   * New maintainer (Closes:357871)
diff -Nru /tmp/c7n5FEG7kl/thailatex-0.3.7/debian/control /tmp/3gIQOsJr0N/thailatex-0.3.7/debian/control
--- /tmp/c7n5FEG7kl/thailatex-0.3.7/debian/control	2006-10-18 12:09:27.000000000 +0700
+++ /tmp/3gIQOsJr0N/thailatex-0.3.7/debian/control	2006-10-18 12:09:28.000000000 +0700
@@ -4,7 +4,7 @@
 Maintainer: Theppitak Karoonboonyanan <[EMAIL PROTECTED]>
 Build-Depends: debhelper (>=4.0.0)
 Build-Depends-Indep: tetex-bin (>=3.0), tex-common (>=0.19), gs, gs-common
-Standards-Version: 3.6.2.2
+Standards-Version: 3.7.2.2
 
 Package: thailatex
 Architecture: all 
diff -Nru /tmp/c7n5FEG7kl/thailatex-0.3.7/debian/postinst /tmp/3gIQOsJr0N/thailatex-0.3.7/debian/postinst
--- /tmp/c7n5FEG7kl/thailatex-0.3.7/debian/postinst	1970-01-01 07:00:00.000000000 +0700
+++ /tmp/3gIQOsJr0N/thailatex-0.3.7/debian/postinst	2006-10-18 12:09:28.000000000 +0700
@@ -0,0 +1,51 @@
+#!/bin/sh
+# postinst script for thailatex
+#
+# 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 http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+#
+
+case "$1" in
+    configure)
+        TEXDIR=/usr/share/texmf/tex/generic/babel
+        if [ -e $TEXDIR/babel.sty ]; then
+            mv -f $TEXDIR/babel.sty $TEXDIR/babel.sty.undivert
+        fi
+        dpkg-divert --package thailatex  --remove --rename \
+            --divert $TEXDIR/babel.sty.real $TEXDIR/babel.sty
+        if [ -e $TEXDIR/babel.sty.undivert ]; then
+            mv $TEXDIR/babel.sty.undivert $TEXDIR/babel.sty
+        fi
+
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
diff -Nru /tmp/c7n5FEG7kl/thailatex-0.3.7/debian/preinst /tmp/3gIQOsJr0N/thailatex-0.3.7/debian/preinst
--- /tmp/c7n5FEG7kl/thailatex-0.3.7/debian/preinst	2006-10-18 12:09:27.000000000 +0700
+++ /tmp/3gIQOsJr0N/thailatex-0.3.7/debian/preinst	2006-10-18 12:09:28.000000000 +0700
@@ -15,14 +15,6 @@
 
 case "$1" in
     install|upgrade)
-#         dpkg-divert --package thailatex --add --rename \
-#              --divert /usr/share/texmf/tex/generic/babel/babel.sty.real \
-# 	     /usr/share/texmf/tex/generic/babel/babel.sty
-        # remove old diversion
-        dpkg-divert --package thailatex  --remove --rename \
-            --divert /usr/share/texmf/tex/generic/babel/babel.sty.real \
-	    /usr/share/texmf/tex/generic/babel/babel.sty
-
         # remove old thai.map in TEXMFSYSCONFIG
         old_md5sum=78e5add055dd03616e5bbfbe54db6947
         current_md5sum=`grep thai.map /var/lib/dpkg/status | cut -f 3 -d ' ' 2>/dev/null || true`
diff -Nru /tmp/c7n5FEG7kl/thailatex-0.3.7/debian/watch /tmp/3gIQOsJr0N/thailatex-0.3.7/debian/watch
--- /tmp/c7n5FEG7kl/thailatex-0.3.7/debian/watch	1970-01-01 07:00:00.000000000 +0700
+++ /tmp/3gIQOsJr0N/thailatex-0.3.7/debian/watch	2006-10-18 12:09:28.000000000 +0700
@@ -0,0 +1,2 @@
+version=3
+opts=pasv ftp://linux.thai.net/pub/thailinux/software/thailatex/thailatex-([\d+\.]+|\d+)\.tar.* debian uupdate

Reply via email to