[Pkg-bugzilla-commits] r61 - in trunk/bugzilla-2.18: . debian debian/helper debian/patches

Alexis Sukrieh sukria-guest@costa.debian.org
Thu, 21 Apr 2005 19:59:59 +0000


Author: sukria-guest
Date: 2005-04-21 19:59:58 +0000 (Thu, 21 Apr 2005)
New Revision: 61

Added:
   trunk/bugzilla-2.18/debian/patches/101_Config_params.diff
Removed:
   trunk/bugzilla-2.18/debian/patches/101_Config.diff
Modified:
   trunk/bugzilla-2.18/ant.jpg
   trunk/bugzilla-2.18/debian/bugzilla.postinst
   trunk/bugzilla-2.18/debian/helper/postinst-db.pl
   trunk/bugzilla-2.18/debian/rules
Log:
A first try to use ucf in our new postinst.
Note that ATM, the params file is not under /etc/bugzilla because I experienced
problem with the cgi that has to writ it.



Modified: trunk/bugzilla-2.18/ant.jpg
===================================================================
(Binary files differ)

Modified: trunk/bugzilla-2.18/debian/bugzilla.postinst
===================================================================
--- trunk/bugzilla-2.18/debian/bugzilla.postinst	2005-04-21 10:55:57 UTC (rev 60)
+++ trunk/bugzilla-2.18/debian/bugzilla.postinst	2005-04-21 19:59:58 UTC (rev 61)
@@ -18,18 +18,22 @@
 
 set -e
 
+# Use the same order as for mv
 replace_file()
 {
 	file_source="$1"
 	file_dest="$2"
 
+	echo "replace_file $file_source $file_dest" >&2
+
 	if [ ! -f $file_dest ]; then
 		mv $file_source $file_dest || exit 10
 	else
-		ucf $file_source $file_dest || exit 11
+		cp $file_dest ${file_dest}.old
+		ucf --debconf-ok $file_source $file_dest || exit 11
 	fi
 	chown www-data:www-data $file_dest
-	rm -f $file_source
+#	rm -f $file_source
 }
 
 if [ "$1" = "configure" ]; then
@@ -40,16 +44,24 @@
 		exit 1
 	fi
 	chmod a+x $postinst_db
+
+	# Debconf is needed here
+	. /usr/share/debconf/confmodule
 	$postinst_db || exit 2
 
 	# Update of the "params" file
 	params_216="/var/lib/bugzilla/data/params"
-	params_218="/etc/bugzilla/params"
+	params_218_src="/usr/share/bugzilla/debian/params"
+	params_218_dest="/usr/share/bugzilla/web/data/params"
 	params_218_new="/usr/share/bugzilla/web/data/params.new"
 	if [ -f $params_216 ]; then 
-		replace_file $params_216 $params_218 || exit 3
+		echo "2.16 params file found, asking for a merge..." >&2
+		replace_file $params_216 $params_218_dest || exit 3
 	fi
 
+	# We move safely the params we ship with 2.18
+	replace_file $params_218_src $params_218_dest
+
 	# The answer file has been generated by $postinst_db before
 	answerfile=/usr/share/bugzilla/debian/checksetup-answer.conf.pl
 	if [ ! -f $answerfile ]; then
@@ -67,8 +79,14 @@
 	rm -f /tmp/bugzilla.checksetup.log
 	
 	# Now, our patched checksetup.pl had made a $params_218.new file, let's 
-	# our fellow user if he likes to use it
-	replace_file ${params_218_new} ${params_218}
+	# ask our fellow user if he likes to use it
+	replace_file ${params_218_new} ${params_218_dest}
+
+	# Now, we have to unpatch Config.pm, else every changes made
+	# by editparams.cgi will be saved in ... params.new!
+	patch -R -p1 -d /usr/share/perl5 < /usr/share/bugzilla/debian/101_Config_params.diff
+	
+	db_stop
 fi 
 
 #DEBHELPER#

Modified: trunk/bugzilla-2.18/debian/helper/postinst-db.pl
===================================================================
--- trunk/bugzilla-2.18/debian/helper/postinst-db.pl	2005-04-21 10:55:57 UTC (rev 60)
+++ trunk/bugzilla-2.18/debian/helper/postinst-db.pl	2005-04-21 19:59:58 UTC (rev 61)
@@ -241,12 +241,13 @@
 system ($temp) / 256 == 0
 	or error "Problem with debhelper scripts: $!";
 
-#debug "Stopping Debconf";
-#stop();
 
 debug "Generating the answer file";
 create_answer_file();
 
+#debug "Stopping Debconf";
+#stop();
+
 exit 0;
 
 sub alter_localconfig {

Deleted: trunk/bugzilla-2.18/debian/patches/101_Config.diff
===================================================================
--- trunk/bugzilla-2.18/debian/patches/101_Config.diff	2005-04-21 10:55:57 UTC (rev 60)
+++ trunk/bugzilla-2.18/debian/patches/101_Config.diff	2005-04-21 19:59:58 UTC (rev 61)
@@ -1,17 +0,0 @@
---- bugzilla-2.18.orig/Bugzilla/Config.pm 
-+++ bugzilla-2.18/Bugzilla/Config.pm
-@@ -263,10 +263,11 @@
- 
-     close $fh;
- 
--    rename $tmpname, "$datadir/params"
--      || die "Can't rename $tmpname to $datadir/params: $!";
-+    # rename $tmpname, "$datadir/params.new" and use ucf after...
-+    rename $tmpname, "$datadir/params.new"
-+      || die "Can't rename $tmpname to $datadir/params.new: $!";
- 
--    ChmodDataFile("$datadir/params", 0666);
-+    ChmodDataFile("$datadir/params.new", 0666);
- }
- 
- # Some files in the data directory must be world readable iff we don't have

Added: trunk/bugzilla-2.18/debian/patches/101_Config_params.diff
===================================================================
--- trunk/bugzilla-2.18/debian/patches/101_Config_params.diff	2005-04-21 10:55:57 UTC (rev 60)
+++ trunk/bugzilla-2.18/debian/patches/101_Config_params.diff	2005-04-21 19:59:58 UTC (rev 61)
@@ -0,0 +1,22 @@
+--- bugzilla-2.18.orig/Bugzilla/Config.pm.orig	2005-04-21 16:15:06.924562544 +0200
++++ bugzilla-2.18/Bugzilla/Config.pm	2005-04-21 16:18:16.621724192 +0200
+@@ -263,10 +263,16 @@
+ 
+     close $fh;
+ 
+-    rename $tmpname, "$datadir/params"
+-      || die "Can't rename $tmpname to $datadir/params: $!";
++    # In our Debian package, the params file is a conffile 
++    # which has to been handled with care.
++    # It's located in /etc/bugzilla/params and a symlink
++    # is given in $datadir/params
++    # So here, we don't want to overwrite the symlink:
++    rename $tmpname, "$datadir/params.new"
++      || die "Can't rename $tmpname to $datadir/params.new: $!";
+ 
+-    ChmodDataFile("$datadir/params", 0666);
++    # We don't need to make this file writable by others.
++    ChmodDataFile("/etc/bugzilla/params.new", 0666);
+ }
+ 
+ # Some files in the data directory must be world readable iff we don't have

Modified: trunk/bugzilla-2.18/debian/rules
===================================================================
--- trunk/bugzilla-2.18/debian/rules	2005-04-21 10:55:57 UTC (rev 60)
+++ trunk/bugzilla-2.18/debian/rules	2005-04-21 19:59:58 UTC (rev 61)
@@ -72,6 +72,7 @@
 	# We install our debian helpers
 	install -d -m 0755 -o root -g root $(CURDIR)/debian/bugzilla/usr/share/bugzilla/debian 
 	install    -m 0755 -o root -g root debian/helper/postinst-db.pl $(CURDIR)/debian/bugzilla/usr/share/bugzilla/debian/postinst-db.pl
+	install    -m 0644 -o root -g root debian/patches/101_Config_params.diff $(CURDIR)/debian/bugzilla/usr/share/bugzilla/debian
 	
 	# remove all the CVS entries in the build dir
 	find ./debian -name CVS -type d -exec rm -rf {} \;