[Pkg-mailman-hackers] Pkg-mailman commit - rev 33 - trunk/debian

Bernd S. Brentrup bsb@haydn.debian.org
Wed, 24 Mar 2004 23:04:40 -0700


Author: bsb
Date: 2004-03-24 23:04:30 -0700 (Wed, 24 Mar 2004)
New Revision: 33

Added:
   trunk/debian/templates
Removed:
   trunk/debian/templates.master
Modified:
   trunk/debian/changelog
   trunk/debian/config
   trunk/debian/control
   trunk/debian/postinst
   trunk/debian/rules
Log:
- Backed out XX_po-debconf_patch, doesn't interact cleanly
  with svn-buildpackage.
- Revamped mailman/site_languages stuff to be less chatty
  and remember selections across invocations.
- Default directory permissions on message catalogs.


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-03-24 22:26:19 UTC (rev 32)
+++ trunk/debian/changelog	2004-03-25 06:04:30 UTC (rev 33)
@@ -31,14 +31,11 @@
     /usr/lib/mailman/bin/postfix-to-mailman.py (bsb).
   * Cleaned up README.Debian removing obsolete mailman-owner alias and
     adding a section on using postfix-to-mailman.py (bsb).
-  * Applied patch supplied by Marc Haber <mh+debian-bugs@zugschlus.de> to
-    simplify backporting to woody (cf. XX_po-debconf_hack.dpatch)
-    (bsb, closes: #223348).
   * Fix path problems, found by Nathan Stratton Treadway <nathanst@ontko.com>
     (by GCS, closes: #235835, #236473)
   * Added missing manpages withlist.8 and list_admins.8 (bsb).
 
- -- Siggy Brentrup <bsb@debian.org>  Wed, 24 Mar 2004 23:24:23 +0100
+ -- Siggy Brentrup <bsb@debian.org>  Wed, 24 Mar 2004 23:48:15 +0100
 
 mailman (2.1.4-1) unstable; urgency=medium
 

Modified: trunk/debian/config
===================================================================
--- trunk/debian/config	2004-03-24 22:26:19 UTC (rev 32)
+++ trunk/debian/config	2004-03-25 06:04:30 UTC (rev 33)
@@ -19,12 +19,24 @@
 }
 
 if [ -x "/usr/sbin/list_lists" ]; then
-    echo -n "Looking for enabled languages (this may take some time) ..."
-    used_languages="$(get_used_languages)"
-    echo " done."
-    db_set mailman/site_languages "$(echo ${used_languages} | sed -e 's/  */, /g')"
+  echo -n "Looking for enabled languages (this may take some time) ..."
+  used_languages="$(get_used_languages)"
+  echo " done."
+  # Install only languages selected by the administrator
+  # forcing english to be always available.
+  db_get mailman/site_languages
+  site_languages="$(echo $RET | sed -e 's/, */ /g')"
+  need_languages="${site_languages}"
+  for lang in ${used_languages} ; do
+    if echo " ${site_languages} " | grep -v -q " ${lang} " ; then
+      need_languages="${lang} ${need_languages}"
+    fi
+    if [ "${need_languages}" != "${site_languages}" ]; then
+      db_set mailman/site_languages "$(echo ${need_languages} | sed -e 's/  */, /g')"
+    fi
+  done
 else
-    db_set mailman/site_languages "en"
+  db_set mailman/site_languages "en"
 fi
 
 db_input high mailman/site_languages || true
@@ -46,4 +58,3 @@
 fi
 
 db_go || true
-

Modified: trunk/debian/control
===================================================================
--- trunk/debian/control	2004-03-24 22:26:19 UTC (rev 32)
+++ trunk/debian/control	2004-03-25 06:04:30 UTC (rev 33)
@@ -8,7 +8,7 @@
 
 Package: mailman
 Architecture: any
-Depends: ${shlibs:Depends}, ${debconf-depends}, python (>= 2.2.2.91-1), logrotate, cron (>= 3.0pl1-42), exim4 | mail-transport-agent, apache | httpd, ucf (>= 0.28), pwgen
+Depends: ${shlibs:Depends}, python (>= 2.2.2.91-1), logrotate, cron (>= 3.0pl1-42), exim4 | mail-transport-agent, apache | httpd, debconf, ucf (>= 0.28), pwgen
 Conflicts: suidmanager (<< 0.50), sendmail (<< 8.12.6)
 Recommends: base-passwd (>= 1.3.0)
 Suggests: spamassassin, python2.2-korean-codecs | python2.3-korean-codecs, python-japanese-codecs

Modified: trunk/debian/postinst
===================================================================
--- trunk/debian/postinst	2004-03-24 22:26:19 UTC (rev 32)
+++ trunk/debian/postinst	2004-03-25 06:04:30 UTC (rev 33)
@@ -16,10 +16,10 @@
     mm_dist=/usr/share/mailman
 
     # Install only languages selected by the administrator
-    # forcing english to be always available.
+    # forcing used languages to be always available.
     db_get mailman/site_languages
     site_languages="$(echo $RET | sed -e 's/, */ /g')"
-    need_languages=${site_languages}
+    need_languages="${site_languages}"
     for lang in ${used_languages} ; do
       if echo " ${site_languages} " | grep -v -q " ${lang} " ; then
         need_languages="${lang} ${need_languages}"
@@ -38,37 +38,80 @@
     done
 
     # Remove languages no longer used, but purging modified files
-    # is a bad thing.  Since ucf doesn't support conditional removal
-    # we must compare with the /usr/share/mailman copy.
+    # is a bad thing[TM].
+    leftover=/etc/mailman/leftover
+    : >${leftover}
     for lang in ${old_languages}; do
       if  echo " ${site_languages} " | grep -v -q " ${lang} " ; then
-        echo -n "Removing unmodified files from ${mm_etc}/${lang} "
-        for file in $(cd /etc && find mailman/${lang} -type f -a ! -name \*.dpkg-\* ); do
-          if cmp -s /etc/${file} /usr/share/${file}; then
-            ucf --debconf-ok --purge /etc/${file}
-            rm -f /etc/${file} /etc/${file}.dpkg-dist
-            echo -n .
-          fi
-        done
-        echo " done."
+        echo -n "Removing unmodified files from ${mm_etc}/${lang} " >&2
+        # UGLY HACK: Since ucf doesn't support conditional removal
+        #            we access its hashfile directly
+        md5sums=$(tempfile --prefix=mm_${lang})
+        grep ${mm_etc}/$lang/ /var/lib/ucf/hashfile >${md5sums} || true
+        if [ -s ${md5sums} ]; then
+          # Language files are under ucf control, check md5sums
+          for file in $(md5sum -c -v ${md5sums} 2>&1 | egrep "OK$" | sed -e 's/ *OK//'); do 
+            ucf --debconf-ok --purge ${file}
+            rm -f ${file} ${file}.dpkg-dist
+            echo -n . >&2
+          done
+          # For modified files remove corresponding .dpkg-dist
+          for file in $(grep ${mm_etc}/$lang/ /var/lib/ucf/hashfile | cut -d' ' -f3); do
+            rm -f ${file}.dpkg-dist
+            echo -n . >&2
+          done
+        else
+          # We are upgrading from a version that didn't use ucf for this
+          # language, remove files that are unchanged in the NEW version.
+          # At this point there is no way to differentiate between
+          # 'changed by admin' and 'changed in package'.
+          for file in $(cd /etc && find mailman/${lang} -type f -a ! -name \*.dpkg-\* ); do
+            if cmp -s /etc/${file} /usr/share/${file}; then
+              rm -f /etc/${file} /etc/${file}.dpkg-dist
+            else
+              echo /etc/${file} >>${leftover}
+            fi
+            echo -n . >&2
+          done
+        fi
+        echo " done." >&2
         rmdir ${mm_etc}/${lang} 2>/dev/null \
-          || echo "Directory ${mm_etc}/${lang} not empty, not removed."
+          || echo "Directory ${mm_etc}/${lang} not empty, not removed." >&2
+        rm -f ${md5sums}
       fi
     done
 
+    if [ -s ${leftover} ]; then
+      cat >&2 <<EOF
+Some templates from unused langugages could not be automatically
+removed since there was no way to find out if they were modified by
+you or the prototype in the package differs from the previous release.
+${leftover} lists these files; please move them out of the way
+at your discretion.
+
+EOF
+      echo -n "Press return to continue." >&2
+      read junk </dev/tty
+      echo >&2
+    else
+      rm ${leftover}
+    fi
+
     for lang in ${site_languages}; do
-      echo -n "Installing site language ${lang} "
+      echo -n "Installing site language ${lang} " >&2
       mkdir -p ${mm_etc}/${lang}
       for file in $(ls ${mm_dist}/${lang}); do
-        echo -n .
+        echo -n . >&2
         langfile=${lang}/${file}
-        ucf --debconf-ok --three-way ${mm_dist}/${langfile} ${mm_etc}/${langfile} \
-          </dev/tty >/dev/tty
+        # Note that there is no easy way to suppress ucf's chatty output when
+        # creating a config file while keeping --debconf-ok functionality.
+        # cf. Bug#239678
+        ucf --debconf-ok --three-way ${mm_dist}/${langfile} ${mm_etc}/${langfile} 2>/dev/null
         # Upon install ucf leaves a duplicate in .dpkg-dist (Bug #238730), remove it
         cmp -s ${mm_etc}/${langfile} ${mm_etc}/${langfile}.dpkg-dist \
           && rm ${mm_etc}/${langfile}.dpkg-dist
       done
-      echo " done."
+      echo " done." >&2
     done
     # Done with site language stuff
 

Modified: trunk/debian/rules
===================================================================
--- trunk/debian/rules	2004-03-24 22:26:19 UTC (rev 32)
+++ trunk/debian/rules	2004-03-25 06:04:30 UTC (rev 33)
@@ -17,14 +17,6 @@
 
 SHELL=/bin/bash
 
-ifeq (,$(wildcard /usr/bin/po2debconf))
-PO2DEBCONF := no
-MINDEBCONFVER := 0.5
-else
-PO2DEBCONF := yes
-MINDEBCONFVER := 1.2.0
-endif
-
 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
 CFLAGS += -g
 endif
@@ -36,11 +28,8 @@
 	$(MAKE) 
 	touch build
 
-debian/po/templates.pot: debian/templates.master
-ifeq ($(PO2DEBCONF),yes)
-	po2debconf -e utf8 debian/templates.master > debian/templates
-	@debconf-updatepo || true
-endif
+debian/po/templates.pot: debian/templates
+	@debconf-updatepo
 
 Makefile:
 	autoconf
@@ -60,18 +49,6 @@
 	find .. -name $(package)*dsc.asc -size 0 -maxdepth 1 -exec rm {} ";"
 	chmod +x debian/{prerm,postinst}
 
-ifeq ($(PO2DEBCONF),yes)
-	# Hack for woody compatibility. This makes sure that the
-	# debian/templates file shipped in the source package doesn't
-	# specify encodings, which woody's debconf can't handle. If building
-	# on a system with po-debconf installed (conveniently debhelper (>=
-	# 4.1.16) depends on it), the binary-arch target will generate a
-	# better version for sarge.
-	echo 1 > debian/po/output
-	po2debconf debian/templates.master > debian/templates
-	rm -f debian/po/output
-endif
-
 binary-indep:	checkroot build
 	$(checkdir)
 # There are no architecture-independent files to be uploaded
@@ -163,6 +140,7 @@
 	chown list.list debian/mailman/var/{lock/mailman,lib/mailman/qfiles,run/mailman}
 	chown root.list debian/mailman/var/log/mailman
 	find debian/mailman/var/lib/$(package) -type d | xargs chmod 2775
+	find debian/mailman/var/lib/$(package)/messages -type d | xargs chmod 755
 
 	# make lintian happy
 #	install -m 0644 debian/lintian-overrides debian/mailman/usr/share/lintian/overrides/mailman
@@ -188,7 +166,7 @@
 
 # Fix permissions
 	chmod +x debian/mailman/usr/lib/$(package)/Mailman/Cgi/*
-	chmod +x debian/mailman/usr/lib/$(package)/scripts/*
+#	chmod +x debian/mailman/usr/lib/$(package)/scripts/*
 	chmod +x debian/mailman/usr/lib/$(package)/Mailman/Archiver/pipermail.py
 
 	chmod g+s debian/mailman/usr/lib/cgi-bin/mailman/* \
@@ -228,7 +206,7 @@
 #	perl -pi -e '/#UCF#/ and do { open F, "debian/mailman.postrm.ucf"; local $$/ ; $$_ = <F> };' debian/mailman/DEBIAN/postrm
 
 	dh_shlibdeps
-	dh_gencontrol -- -V'debconf-depends=debconf (>= $(MINDEBCONFVER))'
+	dh_gencontrol
 	dh_md5sums
 	dpkg --build debian/mailman ..
 

Copied: trunk/debian/templates (from rev 30, trunk/debian/templates.master)

Deleted: trunk/debian/templates.master
===================================================================
--- trunk/debian/templates.master	2004-03-24 22:26:19 UTC (rev 32)
+++ trunk/debian/templates.master	2004-03-25 06:04:30 UTC (rev 33)
@@ -1,35 +0,0 @@
-Template: mailman/site_languages
-Type: multiselect
-__Choices: big5, ca, cs, da, de, en, es, et, eu, fi, fr, gb, hr, hu, it, ja, ko, lt, nl, no, pl, pt, pt_BR, ro, ru, sl, sr, sv, uk
-Default: en
-_Description: Which languages to support?  
- For each supported language Debian Mailman stores default language
- specific texts in /etc/mailman/LANG/ giving them conffile like
- treatment with the help of ucf.  This means approximately 150kB for
- each supported language on the root FS.
- .
- If you need a different set of languages at a later time, just run
- dpkg-reconfigure mailman.
- .
- NOTE: Languages enabled on existing mailing lists are forcibly re-
- enabled when deselected.
-
-Template: mailman/gate_news
-Type: boolean
-Default: false
-_Description: Gate news to mail?
- Do you want to gate news to mail, that is, send all the messages which
- appear in a newsgroup to a mailing list.
- .
- Most people won't need this.
-
-Template: mailman/create_site_list
-Type: note
-_Description: Missing site list
- Mailman needs a so-called "site list", which is the list from which
- password reminders and such are sent out from.  This list needs to be
- created before mailman will start.
- .
- To create the list, run "newlist mailman" and follow the instructions
- on-screen.  Note that you also need to start mailman after that,
- using /etc/init.d/mailman start.