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

Alexis Sukrieh sukria-guest@costa.debian.org
Sat, 23 Apr 2005 14:38:46 +0000


Author: sukria-guest
Date: 2005-04-23 14:38:46 +0000 (Sat, 23 Apr 2005)
New Revision: 71

Added:
   trunk/bugzilla-2.18/debian/patches/003_Config.diff
   trunk/bugzilla-2.18/debian/patches/101_Config.diff
Removed:
   trunk/bugzilla-2.18/debian/patches/101_Config_params.diff
Modified:
   trunk/bugzilla-2.18/debian/bugzilla.postinst
   trunk/bugzilla-2.18/debian/rules
Log:
Now, we have to put the params file under /etc/bugzilla, and that means, 
again, patching Config.pm ...




Modified: trunk/bugzilla-2.18/debian/bugzilla.postinst
===================================================================
--- trunk/bugzilla-2.18/debian/bugzilla.postinst	2005-04-22 13:14:31 UTC (rev 70)
+++ trunk/bugzilla-2.18/debian/bugzilla.postinst	2005-04-23 14:38:46 UTC (rev 71)
@@ -20,7 +20,7 @@
 
 debug()
 {
-	if [ $DEBIAN_BUGZILLA_DEBUG = 1 ]; then
+	if [ -n "$DEBIAN_BUGZILLA_DEBUG" ]; then
 		echo "$1" >&2
 	fi
 }
@@ -49,9 +49,9 @@
 
 if [ "$1" = "configure" ]; then
 	
-	params_218_dest="/usr/share/bugzilla/web/data/params"
 	params_218_src="/usr/share/bugzilla/debian/params"
-	params_218_new="/usr/share/bugzilla/web/data/params.new"
+	params_218_dest="/etc/bugzilla/params"
+	params_218_new="/etc/bugzilla/params.new"
 	
 	# manage the upgrade before 2.18
 	# We aim here to upgrade the params file from oldest version.
@@ -91,6 +91,10 @@
 		exit 3
 	fi
 	
+	# We want checksetup.pl to write the new params file in params.new
+	# Then Config.pm has to be patched
+	patch -p1 -d /usr/share/perl5 < /usr/share/bugzilla/debian/101_Config.diff
+	
 	# Call checksetup now that everything is ready
 	# The params file will then be updated if needed, the resulting file
 	# will be saved in $params_218_new
@@ -100,6 +104,9 @@
 		exit 13
 	fi
 	
+	# We restore the good Config.pm file
+	patch -R -p1 -d /usr/share/perl5 < /usr/share/bugzilla/debian/101_Config.diff
+	
 	# the answerfile should be removed now
 	rm -f $answerfile
 	
@@ -110,9 +117,6 @@
 	# 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 

Added: trunk/bugzilla-2.18/debian/patches/003_Config.diff
===================================================================
--- trunk/bugzilla-2.18/debian/patches/003_Config.diff	2005-04-22 13:14:31 UTC (rev 70)
+++ trunk/bugzilla-2.18/debian/patches/003_Config.diff	2005-04-23 14:38:46 UTC (rev 71)
@@ -0,0 +1,52 @@
+--- bugzilla-21.8.orig/Bugzilla/Config.pm	2005-04-23 16:14:44.260415040 +0200
++++ bugzilla-2.18/Bugzilla/Config.pm	2005-04-23 16:14:09.703668464 +0200
+@@ -56,6 +56,7 @@
+ our $datadir = "$libpath/web/data";
+ our $templatedir = "$libpath/template";
+ our $webdotdir = "$datadir/webdot";
++our $params_file = "/etc/bugzilla/params";
+ 
+ # Module stuff
+ @Bugzilla::Config::EXPORT = qw(Param);
+@@ -105,22 +106,22 @@
+     # read in localconfig variables
+     do $localconfig;
+ 
+-    if (-e "$datadir/params") {
++    if (-e $params_file) {
+         # Handle reading old param files by munging the symbol table
+         # Don't have to do this if we use safe mode, since its evaled
+         # in a sandbox where $foo is in the same module as $::foo
+         #local *::param = \%param;
+ 
+-        # Note that checksetup.pl sets file permissions on '$datadir/params'
++        # Note that checksetup.pl sets file permissions on $params_file
+ 
+         # Using Safe mode is _not_ a guarantee of safety if someone does
+         # manage to write to the file. However, it won't hurt...
+         # See bug 165144 for not needing to eval this at all
+         my $s = new Safe;
+ 
+-        $s->rdo("$datadir/params");
+-        die "Error reading $datadir/params: $!" if $!;
+-        die "Error evaluating $datadir/params: $@" if $@;
++        $s->rdo($params_file);
++        die "Error reading $params_file: $!" if $!;
++        die "Error evaluating $params_file: $@" if $@;
+ 
+         # Now read the param back out from the sandbox
+         %param = %{$s->varglob('param')};
+@@ -263,10 +264,10 @@
+ 
+     close $fh;
+ 
+-    rename $tmpname, "$datadir/params"
+-      || die "Can't rename $tmpname to $datadir/params: $!";
++    rename $tmpname, $params_file
++      || die "Can't rename $tmpname to $params_file: $!";
+ 
+-    ChmodDataFile("$datadir/params", 0666);
++    ChmodDataFile($params_file, 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.diff
===================================================================
--- trunk/bugzilla-2.18/debian/patches/101_Config.diff	2005-04-22 13:14:31 UTC (rev 70)
+++ trunk/bugzilla-2.18/debian/patches/101_Config.diff	2005-04-23 14:38:46 UTC (rev 71)
@@ -0,0 +1,11 @@
+--- bugzilla-2.18.orig/Bugzilla/Config.pm	2005-04-23 16:17:08.108546800 +0200
++++ bugzilla-2.18/Bugzilla/Config.pm	2005-04-23 16:32:19.635973568 +0200
+@@ -56,7 +56,7 @@
+ our $datadir = "$libpath/web/data";
+ our $templatedir = "$libpath/template";
+ our $webdotdir = "$datadir/webdot";
+-our $params_file = "/etc/bugzilla/params";
++our $params_file = "/etc/bugzilla/params.new";
+ 
+ # Module stuff
+ @Bugzilla::Config::EXPORT = qw(Param);

Deleted: trunk/bugzilla-2.18/debian/patches/101_Config_params.diff
===================================================================
--- trunk/bugzilla-2.18/debian/patches/101_Config_params.diff	2005-04-22 13:14:31 UTC (rev 70)
+++ trunk/bugzilla-2.18/debian/patches/101_Config_params.diff	2005-04-23 14:38:46 UTC (rev 71)
@@ -1,22 +0,0 @@
---- 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-22 13:14:31 UTC (rev 70)
+++ trunk/bugzilla-2.18/debian/rules	2005-04-23 14:38:46 UTC (rev 71)
@@ -24,8 +24,10 @@
 
 patch: patch-stamp
 patch-stamp:
+	# We patch only 0*.diff, 1*.diff is for manual patches
+	# used in postinst
 	@echo -e "\n\n*** Patching Debian fixes ***\n\n"
-	@for patch in debian/patches/*.diff; do \
+	@for patch in debian/patches/0*.diff; do \
 		echo "Applying: $$patch"; \
 		patch -d . -p1 < $$patch; \
 	done
@@ -35,7 +37,7 @@
 unpatch: unpatch-stamp
 unpatch-stamp:
 	@echo -e "\n\n*** Unpatching Debian fixes ***\n\n"
-	@for patch in debian/patches/*.diff; do \
+	@for patch in debian/patches/0*.diff; do \
 		echo "Removing: $$patch"; \
 		patch -R -d . -p1 < $$patch; \
 	done
@@ -73,7 +75,7 @@
 	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 data/params $(CURDIR)/debian/bugzilla/usr/share/bugzilla/debian
-	install    -m 0644 -o root -g root debian/patches/101_Config_params.diff $(CURDIR)/debian/bugzilla/usr/share/bugzilla/debian
+	install    -m 0644 -o root -g root debian/patches/101_Config.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 {} \;