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

Alexis Sukrieh sukria-guest@costa.debian.org
Wed, 20 Apr 2005 11:07:34 +0000


Author: sukria-guest
Date: 2005-04-20 11:07:33 +0000 (Wed, 20 Apr 2005)
New Revision: 51

Added:
   trunk/bugzilla-2.18/debian/patches/
   trunk/bugzilla-2.18/debian/patches/001_require.diff
   trunk/bugzilla-2.18/debian/patches/002_checksetup.diff
Modified:
   trunk/bugzilla-2.18/debian/rules
Log:
Adding a patching system

Added: trunk/bugzilla-2.18/debian/patches/001_require.diff
===================================================================
--- trunk/bugzilla-2.18/debian/patches/001_require.diff	2005-04-20 10:14:37 UTC (rev 50)
+++ trunk/bugzilla-2.18/debian/patches/001_require.diff	2005-04-20 11:07:33 UTC (rev 51)
@@ -0,0 +1,307 @@
+--- bugzilla-2.18.orig/userprefs.cgi
++++ bugzilla-2.18/userprefs.cgi
+@@ -23,7 +23,7 @@
+ 
+ use strict;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla;
+ use Bugzilla::Constants;
+--- bugzilla-2.18.orig/editversions.cgi
++++ bugzilla-2.18/editversions.cgi
+@@ -27,7 +27,7 @@
+ # Holger Schurig <holgerschurig@nikocity.de>
+ 
+ use strict;
+-use lib ".";
++use lib '/usr/share/bugzilla';
+ 
+ require "CGI.pl";
+ require "globals.pl";
+--- bugzilla-2.18.orig/attachment.cgi
++++ bugzilla-2.18/attachment.cgi
+@@ -31,7 +31,7 @@
+ # Make it harder for us to do dangerous things in Perl.
+ use strict;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use vars qw(
+   $template
+--- bugzilla-2.18.orig/post_bug.cgi
++++ bugzilla-2.18/post_bug.cgi
+@@ -24,7 +24,7 @@
+ #                 Gervase Markham <gerv@gerv.net>
+ 
+ use strict;
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla;
+ use Bugzilla::Constants;
+--- bugzilla-2.18.orig/xml.cgi
++++ bugzilla-2.18/xml.cgi
+@@ -24,7 +24,7 @@
+ 
+ use strict;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ require "CGI.pl";
+ 
+--- bugzilla-2.18.orig/showattachment.cgi
++++ bugzilla-2.18/showattachment.cgi
+@@ -23,7 +23,7 @@
+ 
+ use strict;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla;
+ use Bugzilla::Util;
+--- bugzilla-2.18.orig/editparams.cgi
++++ bugzilla-2.18/editparams.cgi
+@@ -23,7 +23,7 @@
+ 
+ 
+ use strict;
+-use lib ".";
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla::Constants;
+ use Bugzilla::Config qw(:DEFAULT :admin);
+--- bugzilla-2.18.orig/show_activity.cgi
++++ bugzilla-2.18/show_activity.cgi
+@@ -24,7 +24,7 @@
+ 
+ use strict;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ use vars qw ($template $vars);
+ 
+ require "CGI.pl";
+--- bugzilla-2.18.orig/duplicates.cgi
++++ bugzilla-2.18/duplicates.cgi
+@@ -27,7 +27,7 @@
+ 
+ use AnyDBM_File;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ require "globals.pl";
+ require "CGI.pl";
+--- bugzilla-2.18.orig/reports.cgi
++++ bugzilla-2.18/reports.cgi
+@@ -35,7 +35,7 @@
+ 
+ use strict;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla::Config qw(:DEFAULT $datadir);
+ 
+--- bugzilla-2.18.orig/quips.cgi
++++ bugzilla-2.18/quips.cgi
+@@ -31,7 +31,7 @@
+   $vars
+ );
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ require "CGI.pl";
+ 
+--- bugzilla-2.18.orig/editflagtypes.cgi
++++ bugzilla-2.18/editflagtypes.cgi
+@@ -26,7 +26,7 @@
+ 
+ # Make it harder for us to do dangerous things in Perl.
+ use strict;
+-use lib ".";
++use lib '/usr/share/bugzilla';
+ 
+ # Include the Bugzilla CGI and general utility library.
+ require "CGI.pl";
+--- bugzilla-2.18.orig/enter_bug.cgi
++++ bugzilla-2.18/enter_bug.cgi
+@@ -34,7 +34,7 @@
+ 
+ use strict;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla;
+ use Bugzilla::Constants;
+--- bugzilla-2.18.orig/report.cgi
++++ bugzilla-2.18/report.cgi
+@@ -22,7 +22,7 @@
+ #                 <rdean@cambianetworks.com>
+ 
+ use strict;
+-use lib ".";
++use lib '/usr/share/bugzilla';
+ 
+ require "CGI.pl";
+ 
+--- bugzilla-2.18.orig/process_bug.cgi
++++ bugzilla-2.18/process_bug.cgi
+@@ -29,7 +29,7 @@
+ my $UserInEditGroupSet = -1;
+ my $UserInCanConfirmGroupSet = -1;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla;
+ use Bugzilla::Constants;
+--- bugzilla-2.18.orig/CGI.pl
++++ bugzilla-2.18/CGI.pl
+@@ -28,7 +28,7 @@
+ # Contains some global routines used throughout the CGI scripts of Bugzilla.
+ 
+ use strict;
+-use lib ".";
++use lib "/usr/share/bugzilla";
+ 
+ # use Carp;                       # for confess
+ 
+--- bugzilla-2.18.orig/doeditparams.cgi
++++ bugzilla-2.18/doeditparams.cgi
+@@ -23,7 +23,7 @@
+ 
+ use strict;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla;
+ use Bugzilla::Constants;
+--- bugzilla-2.18.orig/colchange.cgi
++++ bugzilla-2.18/colchange.cgi
+@@ -23,7 +23,7 @@
+ 
+ use strict;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use vars qw(
+   @legal_keywords
+--- bugzilla-2.18.orig/editmilestones.cgi
++++ bugzilla-2.18/editmilestones.cgi
+@@ -14,7 +14,7 @@
+ 
+ 
+ use strict;
+-use lib ".";
++use lib '/usr/share/bugzilla';
+ 
+ require "CGI.pl";
+ require "globals.pl";
+--- bugzilla-2.18.orig/long_list.cgi
++++ bugzilla-2.18/long_list.cgi
+@@ -22,7 +22,7 @@
+ #                 Gervase Markham <gerv@gerv.net>
+ 
+ use strict;
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla;
+ 
+--- bugzilla-2.18.orig/editcomponents.cgi
++++ bugzilla-2.18/editcomponents.cgi
+@@ -26,7 +26,7 @@
+ # Holger Schurig <holgerschurig@nikocity.de>
+ 
+ use strict;
+-use lib ".";
++use lib '/usr/share/bugzilla';
+ 
+ require "CGI.pl";
+ require "globals.pl";
+--- bugzilla-2.18.orig/votes.cgi
++++ bugzilla-2.18/votes.cgi
+@@ -24,7 +24,7 @@
+ #                 Gervase Markham <gerv@gerv.net>
+ 
+ use strict;
+-use lib ".";
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla;
+ use Bugzilla::Constants;
+--- bugzilla-2.18.orig/move.pl
++++ bugzilla-2.18/move.pl
+@@ -24,7 +24,7 @@
+ 
+ use strict;
+ 
+-use lib qw(.);
++use lib "/usr/share/bugzilla";
+ 
+ require "CGI.pl";
+ 
+--- bugzilla-2.18.orig/showdependencygraph.cgi
++++ bugzilla-2.18/showdependencygraph.cgi
+@@ -23,7 +23,7 @@
+ 
+ use strict;
+ 
+-use lib qw(.);
++use lib '/usr/share/bugzilla';
+ 
+ use File::Temp;
+ use Bugzilla;
+--- bugzilla-2.18.orig/index.cgi
++++ bugzilla-2.18/index.cgi
+@@ -29,7 +29,7 @@
+ use strict;
+ 
+ # Include the Bugzilla CGI and general utility library.
+-use lib ".";
++use lib '/usr/share/bugzilla';
+ require "CGI.pl";
+ 
+ use vars qw(
+--- bugzilla-2.18.orig/collectstats.pl
++++ bugzilla-2.18/collectstats.pl
+@@ -34,7 +34,7 @@
+ use IO::Handle;
+ use vars @::legal_product;
+ 
+-use lib ".";
++use lib "/usr/share/bugzilla";
+ require "globals.pl";
+ use Bugzilla::Search;
+ use Bugzilla::User;
+@@ -96,7 +96,7 @@
+     trick_taint($perl);
+ 
+     # Generate a static RDF file containing the default view of the duplicates data.
+-    open(CGI, "$perl -T duplicates.cgi |")
++    open(CGI, "$perl -T /usr/lib/cgi-bin/bugzilla/duplicates.cgi |")
+         || die "can't fork duplicates.cgi: $!";
+     open(RDF, ">$datadir/duplicates.tmp")
+         || die "can't write to $datadir/duplicates.tmp: $!";
+--- bugzilla-2.18.orig/editgroups.cgi
++++ bugzilla-2.18/editgroups.cgi
+@@ -26,7 +26,7 @@
+ # Code derived from editowners.cgi and editusers.cgi
+ 
+ use strict;
+-use lib ".";
++use lib '/usr/share/bugzilla';
+ 
+ use Bugzilla;
+ use Bugzilla::Constants;
+

Added: trunk/bugzilla-2.18/debian/patches/002_checksetup.diff
===================================================================
--- trunk/bugzilla-2.18/debian/patches/002_checksetup.diff	2005-04-20 10:14:37 UTC (rev 50)
+++ trunk/bugzilla-2.18/debian/patches/002_checksetup.diff	2005-04-20 11:07:33 UTC (rev 51)
@@ -0,0 +1,361 @@
+--- bugzilla-2.18.orig/checksetup.pl
++++ bugzilla-2.18/checksetup.pl
+@@ -1,4 +1,5 @@
+ #!/usr/bin/perl -w
++$|=1;
+ # -*- Mode: perl; indent-tabs-mode: nil -*-
+ #
+ # The contents of this file are subject to the Mozilla Public
+@@ -114,10 +115,11 @@
+ #
+ 
+ use strict;
+-use lib ".";
++use lib "/usr/share/bugzilla";
+ 
+ use vars qw( $db_name %answer );
+ use Bugzilla::Constants;
++use constant MAX_PROMPT_CYCLE => 10;
+ 
+ my $silent;
+ 
+@@ -155,6 +157,26 @@
+     exit 1;
+ }
+ 
++# the Debian way of fixing permissions
++# Comes from bugzilla.postinst.
++sub fix_www_data_perm {
++	my $path = shift;
++	my $chown_cmd = "chown -R www-data.www-data $path";
++	my $chmod_file_cmd = "find $path -type f -exec chmod 644 {} \\;";
++	my $chmod_dir_cmd = "find $path -type d -exec chmod 755 {} \\; ";
++		
++	foreach my $cmd ($chown_cmd, $chmod_file_cmd, $chmod_dir_cmd) {	
++		system($cmd) == 0
++			or die "Command `$cmd` failed ($!)";
++	}
++}
++sub fix_pl_scripts_perm
++{
++	my $path = shift;
++	system(qq{find $path -type f -name '*.pl' -print0 | xargs -0 chmod 755}) == 0
++		or die "Can't fix $path/* .pl perm : $!";
++}
++
+ ###########################################################################
+ # Non-interactive override. Pass a filename on the command line which is
+ # a Perl script. This script defines a %answer hash whose names are tags
+@@ -891,7 +913,8 @@
+ unless (-d 'graphs') {
+     print "Creating graphs directory...\n";
+     # permissions for non-webservergroup are fixed later on
+-    mkdir 'graphs', 0770;
++    mkdir 'graphs', 0775;
++    `chmod a+r graphs`;
+     # Upgrade data format
+     foreach my $in_file (glob("$datadir/mining/*"))
+     {
+@@ -1017,17 +1040,21 @@
+     }
+ 
+   }
+-  if (!-e "Bugzilla/.htaccess") {
+-    print "Creating Bugzilla/.htaccess...\n";
+-    open HTACCESS, '>', 'Bugzilla/.htaccess';
+-    print HTACCESS <<'END';
+-# nothing in this directory is retrievable unless overriden by an .htaccess
+-# in a subdirectory
+-deny from all
+-END
+-    close HTACCESS;
+-    chmod $fileperm, "Bugzilla/.htaccess";
+-  }
++  
++  # This has nothing to do with Debian in fact, as Bugzilla Perl modules are 
++  # in /usr/share/perl5/Bugzilla.
++  # I then comment out that block.
++#  if (!-e "Bugzilla/.htaccess") {
++#    print "Creating Bugzilla/.htaccess...\n";
++#    open HTACCESS, '>', 'Bugzilla/.htaccess';
++#    print HTACCESS <<'END';
++## nothing in this directory is retrievable unless overriden by an .htaccess
++## in a subdirectory
++#deny from all
++#END
++#    close HTACCESS;
++#    chmod $fileperm, "Bugzilla/.htaccess";
++#  }
+   # Even though $datadir may not (and should not) be in the webtree,
+   # we can't know for sure, so create the .htaccess anyeay. Its harmless
+   # if its not accessible...
+@@ -1308,6 +1335,11 @@
+ 
+ # fix file (or files - wildcards ok) permissions 
+ sub fixPerms {
++	
++    # In Debian, we already have good permissions thanks to postinst
++    # and we use a simpliest method for that, see fix_www_data_perm()
++    return;
++    
+     my ($file_pattern, $owner, $group, $umask, $do_dirs) = @_;
+     my @files = glob($file_pattern);
+     my $execperm = 0777 & ~ $umask;
+@@ -1317,6 +1349,7 @@
+         # do not change permissions on directories here unless $do_dirs is set
+         if (!(-d $file)) {
+             chown $owner, $group, $file;
++	    print "chown $owner, $group, $file;\n";
+             # check if the file is executable.
+             if (isExecutableFile($file)) {
+                 #printf ("Changing $file to %o\n", $execperm);
+@@ -1328,6 +1361,7 @@
+         }
+         elsif ($do_dirs) {
+             chown $owner, $group, $file;
++	    print "chown $owner, $group, $file;\n";
+             if ($file =~ /CVS$/) {
+                 chmod 0700, $file;
+             }
+@@ -1362,14 +1396,14 @@
+         fixPerms($templatedir, $<, $webservergid, 027, 1);
+         fixPerms('css', $<, $webservergid, 027, 1);
+         fixPerms('js', $<, $webservergid, 027, 1);
+-        chmod 0644, 'globals.pl';
++#        chmod 0644, 'globals.pl';
+         
+         # Don't use fixPerms here, because it won't change perms on the directory
+         # unless its using recursion
+-        chown $<, $webservergid, $datadir;
+-        chmod 0771, $datadir;
+-        chown $<, $webservergid, 'graphs';
+-        chmod 0770, 'graphs';
++#        chown $<, $webservergid, $datadir;
++#        chmod 0771, $datadir;
++#        chown $<, $webservergid, 'graphs';
++#        chmod 0770, 'graphs';
+     } else {
+         # get current gid from $( list
+         my $gid = (split " ", $()[0];
+@@ -1390,10 +1424,10 @@
+         
+         # Don't use fixPerms here, because it won't change perms on the directory
+         # unless its using recursion
+-        chown $<, $gid, $datadir;
+-        chmod 0777, $datadir;
+-        chown $<, $gid, 'graphs';
+-        chmod 01777, 'graphs';
++#        chown $<, $gid, $datadir;
++#        chmod 0777, $datadir;
++#        chown $<, $gid, 'graphs';
++#        chmod 01777, 'graphs';
+     }
+ }
+ 
+@@ -4195,7 +4229,9 @@
+                     " WHERE name = 'admin' AND id = group_id");
+ $sth->execute;
+ # when we have no admin users, prompt for admin email address and password ...
+-if ($sth->rows == 0) {
++# if we are in non-interactive mode, process anyway.
++if ($sth->rows == 0 or defined $answer{'ADMIN_EMAIL'}) {
++  my $update_only = 1 if $sth->rows > 0;
+   my $login = "";
+   my $realname = "";
+   my $pass1 = "";
+@@ -4220,16 +4256,24 @@
+       and at least one \'.\' after the @.';
+   }
+ 
+-  print "\nLooks like we don't have an administrator set up yet.  Either this is your\n";
+-  print "first time using Bugzilla, or your administrator's privileges might have accidently\n";
+-  print "been deleted.\n";
+-  while(! $admin_ok ) {
+-    while( $login eq "" ) {
+-      print "Enter the e-mail address of the administrator: ";
++  unless ($update_only) {
++      print "\nLooks like we don't have an administrator set up yet.  Either this is your\n";
++      print "first time using Bugzilla, or your administrator's privileges might have accidently\n";
++      print "been deleted.\n";
++  }
++
++  #this is useful when using this script in non-interactive mode.
++  my $cycle_count = 0;
++  
++  while(! $admin_ok  ) {
++    while( $login eq "") {
++      print "Enter the e-mail address of the administrator: " 
++      	unless defined $answer{'ADMIN_EMAIL'};
+       $login = $answer{'ADMIN_EMAIL'} 
+           || ($silent && die("cant preload ADMIN_EMAIL")) 
+           || <STDIN>;
+       chomp $login;
++
+       if(! $login ) {
+         print "\nYou DO want an administrator, don't you?\n";
+       }
+@@ -4241,18 +4285,24 @@
+         # Go round, and ask them again
+         $login = "";
+       }
++      
++      die "Failed to get a valid email address: $login\n" if
++	      ($cycle_count++ > MAX_PROMPT_CYCLE);
+     }
+     $login = $dbh->quote($login);
+     $sth = $dbh->prepare("SELECT login_name FROM profiles" .
+                         " WHERE login_name=$login");
+     $sth->execute;
+     if ($sth->rows > 0) {
+-      print "$login already has an account.\n";
+-      print "Make this user the administrator? [Y/n] ";
++      if (not $answer{'ADMIN_OK'}) {
++          print "$login already has an account.\n";
++          print "Make this user the administrator? [Y/n] ";
++      }
+       my $ok = $answer{'ADMIN_OK'} 
+           || ($silent && die("cant preload ADMIN_OK")) 
+           || <STDIN>;
+       chomp $ok;
++
+       if ($ok !~ /^n/i) {
+         $admin_ok = 1;
+         $admin_create = 0;
+@@ -4275,17 +4325,21 @@
+     }
+   }
+ 
+-  if ($admin_create) {
+ 
++    $cycle_count = 0;
+     while( $realname eq "" ) {
+-      print "Enter the real name of the administrator: ";
++      print "Enter the real name of the administrator: " 
++      	unless defined $answer{'ADMIN_REALNAME'};
+       $realname = $answer{'ADMIN_REALNAME'} 
+           || ($silent && die("cant preload ADMIN_REALNAME")) 
+           || <STDIN>;
+       chomp $realname;
++      
+       if(! $realname ) {
+         print "\nReally.  We need a full name.\n";
+       }
++      die "Failed to get a valid realname: $realname\n" if
++	      ($cycle_count++ > MAX_PROMPT_CYCLE);
+     }
+ 
+     # trap a few interrupts so we can fix the echo if we get aborted.
+@@ -4294,17 +4348,23 @@
+     $SIG{QUIT} = \&bailout;
+     $SIG{TERM} = \&bailout;
+ 
+-    if ($^O !~ /MSWin32/i) {
++    # only on interactive mode !
++    if ((not $answer{'ADMIN_PASSWORD'}) and $^O !~ /MSWin32/i) {
+         system("stty","-echo");  # disable input echoing
+     }
+-
++    my $interactive = 1;
++    $interactive = 0 if defined $answer{'ADMIN_PASSWORD'};
++    
+     while( $pass1 ne $pass2 ) {
++      $cycle_count = 0;
+       while( $pass1 eq "" || $pass1 !~ /^[[:print:]]{3,16}$/ ) {
+-        print "Enter a password for the administrator account: ";
++        print "Enter a password for the administrator account: "
++		unless defined $answer{'ADMIN_PASSWORD'};
+         $pass1 = $answer{'ADMIN_PASSWORD'} 
+             || ($silent && die("cant preload ADMIN_PASSWORD")) 
+             || <STDIN>;
+         chomp $pass1;
++	
+         if(! $pass1 ) {
+           print "\n\nAn empty password is a security risk. Try again!\n";
+         } elsif ( $pass1 !~ /^.{3,16}$/ ) {
+@@ -4312,8 +4372,13 @@
+         } elsif ( $pass1 !~ /^[[:print:]]{3,16}$/ ) {
+           print "\n\nThe password contains non-printable characters.\n";
+         }
++        
++	die "Failed to get a valid password: $pass1\n" if
++	      ($cycle_count++ > MAX_PROMPT_CYCLE);
+       }
+-      print "\nPlease retype the password to verify: ";
++      print "\nPlease retype the password to verify: " 
++      	if $interactive;
++	
+       $pass2 = $answer{'ADMIN_PASSWORD'} 
+           || ($silent && die("cant preload ADMIN_PASSWORD")) 
+           || <STDIN>;
+@@ -4328,7 +4393,8 @@
+     # Crypt the administrator's password
+     my $cryptedpassword = Crypt($pass1);
+ 
+-    if ($^O !~ /MSWin32/i) {
++    # Only on interactive mode
++    if ($interactive and $^O !~ /MSWin32/i) {
+         system("stty","echo"); # re-enable input echoing
+     }
+ 
+@@ -4343,9 +4409,26 @@
+     # Set default email flags for the Admin, same as for users
+     my $defaultflagstring = $dbh->quote(Bugzilla::Constants::DEFAULT_EMAIL_SETTINGS);
+ 
+-    $dbh->do("INSERT INTO profiles (login_name, realname, cryptpassword, emailflags) " .
+-             "VALUES ($login, $realname, $cryptedpassword, $defaultflagstring)");
++  if ($admin_create) {
++    warn "Creating the administrator $login...\n"
++    	if ($answer{'ADMIN_REALNAME'});
++
++    unless($dbh->do("INSERT INTO profiles (login_name, realname, cryptpassword, emailflags) " .
++             "VALUES ($login, $realname, $cryptedpassword, $defaultflagstring)")) {
++	die "Unable to create the $login profile.";
++    }
+   }
++
++  # The ADMIN_REALNAME exists already, but we have to update his profile.
++  else {
++	warn "Updating the $login account...\n";
++	unless ($dbh->do("UPDATE profiles SET realname=$realname, cryptpassword=$cryptedpassword ".
++		 "WHERE login_name=$login")) {
++		die "Unable to update the $login profile.";
++	}
++  }
++
++  unless ($update_only) {
+     # Put the admin in each group if not already    
+     my $query = "select userid from profiles where login_name = $login";    
+     $sth = $dbh->prepare($query); 
+@@ -4362,6 +4445,7 @@
+         (user_id, group_id, isbless, grant_type) 
+         VALUES ($userid, $admingroupid, 1, " . GRANT_DIRECT . ")");
+ 
++
+     # Admins get inherited membership and bless capability for all groups
+     foreach my $group ( @groups ) {
+         $dbh->do("INSERT INTO group_group_map
+@@ -4371,6 +4455,7 @@
+             (member_id, grantor_id, isbless)
+             VALUES ($admingroupid, $group, 1)");
+     }
++  }
+ 
+   print "\n$login is now set up as an administrator account.\n";
+ }
+@@ -4507,5 +4592,16 @@
+ # when test product was created, admin was unknown
+ $dbh->do("UPDATE components SET initialowner = $adminuid WHERE initialowner = 0");
+ 
++# That's deprecated...
++#
++# Now fixing the right permissions ala bugzilla.postinst.
++# Doing this here is better : it will allow user to run 
++# checksetup.pl by hand without breaking bugzilla.
++# (closes #200707)
++# print "Fixing permissions for www-data...\n";
++fix_www_data_perm('/usr/share/bugzilla');  
++fix_www_data_perm('/var/cache/bugzilla');
++fix_pl_scripts_perm('/usr/share/bugzilla/lib');
++
+ unlink "$datadir/versioncache";
+ 

Modified: trunk/bugzilla-2.18/debian/rules
===================================================================
--- trunk/bugzilla-2.18/debian/rules	2005-04-20 10:14:37 UTC (rev 50)
+++ trunk/bugzilla-2.18/debian/rules	2005-04-20 11:07:33 UTC (rev 51)
@@ -10,7 +10,7 @@
 #export DH_VERBOSE=1
 
 configure: configure-stamp
-configure-stamp:
+configure-stamp: patch-stamp
 	dh_testdir
 	# Add here commands to configure the package.
 	
@@ -22,19 +22,40 @@
 	dh_testdir
 	touch build-stamp
 
-clean:
+patch: patch-stamp
+patch-stamp:
+	@echo -e "\n\n*** Patching Debian fixes ***\n\n"
+	@for patch in debian/patches/*.diff; do \
+		echo "Applying: $$patch"; \
+		patch -d . -p1 < $$patch; \
+	done
+	touch patch-stamp
+	rm -f unpatch-stamp
+
+unpatch: unpatch-stamp
+unpatch-stamp:
+	@echo -e "\n\n*** Unpatching Debian fixes ***\n\n"
+	@for patch in debian/patches/*.diff; do \
+		echo "Removing: $$patch"; \
+		patch -R -d . -p1 < $$patch; \
+	done
+	rm -f patch-stamp
+	touch unpatch-stamp
+
+clean: unpatch-stamp
 	dh_testdir
 	dh_testroot
 	debconf-updatepo
 	rm -f build-stamp configure-stamp
-
 	# Add here commands to clean up after the build process.
 	#-$(MAKE) clean
-
 	dh_clean
+	# tempalte/tempalte is to be purged 
+	rm -rf data/template
+	
 
 install: DH_OPTIONS=
-install: build
+install: build 
 	dh_testdir
 	dh_testroot
 	dh_clean -k