~ubuntu-branches/debian/sid/bugzilla/sid

« back to all changes in this revision

Viewing changes to debian/patches/04_Config.pm.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Patrick Davies
  • Date: 2008-05-29 17:20:32 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080529172032-tddh964ztksxayjm
Tags: 3.0.4-0ubuntu1
* New upstream release (LP: #138886, #235701).
* Removed "CVS" directories and ".cvsignore" files from upstream tarball.
* Added patches/ubuntu_01_bugzilla_libpath.dpatch - newly updated as necessary
  version of old 01_libpath.dpatch patch.
* Added patches/01_debian_package_version.dpatch - replaces old patch
  01_VERSION.dpatch, simply changes the version of Bugzilla to show the
  Debian packaging's versioning.
* Added patches/ubuntu_05_makefile_install.dpatch - Use a Makefile to
  install Bugzilla to the correct locations. Based on Makefile in old
  package but in patch form.
* Removed 02_checksetup.dpatch - fixed upstream.
* Removed 101_Config.diff - upstream has changed codebase.
* Renamed 06_contrib.dpatch to ubuntu_02_contrib_shebang_fixes.dpatch -
  corrects 'shebangs' which point to /usr/local/bin/ to /usr/bin/.
* Renamed 08_showdependencygraph.dpatch to
  ubuntu_03_showdependencygraph_url_fixes.dpatch and updated code as
  necessary - fixes graph URL to make the webdot generation possible.
* Removed CVE-2007-0791.dpatch - applied to upstream code.
* Removed CVE-2007-4543.dpatch - applied to upstream code.
* Renamed 09_homelink.dpatch to ubuntu_04_fixed_homepage_linked.dpatch -
  upstream now has links in
  'template/en/default/global/common-links.html.tmpl' instead of
  'useful-links.html.tmpl'.
* Removed 03_webpath.dpatch - upstream has changed stylesheet layout.
* Updated 10_perl_scripts_shebang.dpatch and removed part on "globals.pl" -
  no longer in source.
* Removed Debian vhost support patches (see docs/html/multiple-bz-dbs.html
  for how to run multiple Bugzilla instances):
  - Removed 04_Config.pm.dpatch - duplicate patch and unable to adapt it to
    new upstream code.
  - Removed 07_virtualhosting.dpatch - duplicate patch of
    04_Config.pm.dpatch.
  - Removed 'debian/examples' - contained Apache VHost example setup files
    for Bugzilla.
  - Removed section about vhosts from README.Debian.
* debian/rules:
  - Removed rules for "vhost conf dir", "examples" and "101_Config.diff"
    installation rules.
  - Removed part about bugzilla-fr package.
  - Remved part about "whine.pl" - now in Makefile.
  - Added rules to check the setup with upstream's "checksetup.pl" script.
* debian/control:
  - Updated Standards-Version to 3.7.3.
  - Updated compatibity level and debhelper build dependency version to 6.
  - Added Homepage field to source package stanza.
  - Added part about seeing 'bugzilla' package for more info to
    'bugzilla-docs'.
  - Added libapache2-mod-perl2, libtemplate-perl, libmime-perl,
    libappconfig-perl, libdbd-mysql-perl, libtimedate-perl, libgd-gd2-perl,
    libgd-text-perl, libxml-twig-perl, perlmagick, libemail-send-perl,
    libemail-mime-modifier-perl, libchart-perl, libgd-graph-perl,
    libhtml-scrubber-perl, libdbi-perl, libfile-spec-perl, libgd-graph-perl,
    libgd-text-perl, libnet-ldap-perl, libxml-parser-perl: to build
    dependencies with the necessary versions as stated by upstream in
    docs/html/installation.html - in order to check packaging correctly with
    'checksetup.pl' in rules. Also updated the 'bugzilla' dependencies with
    the above (LP: #235461).
  - Removed dependencies on old "apache" packages as they are no longer in
    the archives.
  - Moved mail transport agents on 'bugzilla' from Depends to
    Suggests (LP: #156405).
* debian/copyright: Updated the downloaded from link.
* debian/bugzilla.docs: Added "QUICKSTART", "rel_notes.txt" and "UPGRADING"
  documentation from source tarball for inclusion in package.
* debian/bugzilla-doc.doc-base: Corrected some spelling mistakes.
* debian/bugzilla.postinst: Removed sections about 101_Config.diff.
* Changed 'X_BUGZILLA_SITE' in bugzilla.cron.daily and bugzilla.postinst to
  'PROJECT'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh /usr/share/dpatch/dpatch-run
2
 
## 05_webpath.dpatch by Alexis Sukrieh <sukria@sukria.net>
3
 
##
4
 
## All lines beginning with `## DP:' are a description of the patch.
5
 
## DP: Update Config.pm to point to the right locations and support vhosts
6
 
 
7
 
@DPATCH@
8
 
diff -urNad trunk~/Bugzilla/Config.pm trunk/Bugzilla/Config.pm
9
 
--- trunk~/Bugzilla/Config.pm   2006-11-04 15:56:30.000000000 +0100
10
 
+++ trunk/Bugzilla/Config.pm    2006-11-15 07:56:22.000000000 +0100
11
 
@@ -51,9 +51,24 @@
12
 
 # graphs (since the path will be wrong in the HTML). This will be fixed at
13
 
 # some point.
14
 
 
15
 
-# constant paths
16
 
-our $libpath = '.';
17
 
-our $templatedir = "$libpath/template";
18
 
+# support for multi-site installation through X_BUGZILLA_SITE variable to
19
 
+# be passed by Apache.
20
 
+our $xsite = '';
21
 
+if (defined $ENV{X_BUGZILLA_SITE}) {
22
 
+    $xsite = "$ENV{X_BUGZILLA_SITE}";
23
 
+    # untaint (make sure it has no '/' and is overall something sane)
24
 
+    if ($xsite =~ m/^(\w[\w\-.]*)$/) {
25
 
+        $xsite ="$1";
26
 
+    } else {
27
 
+        die "invalid X_BUGZILLA_SITE: $xsite";
28
 
+    }
29
 
+}
30
 
+
31
 
+# constant default paths
32
 
+our $libpath = '/usr/share/bugzilla';
33
 
+our $pmpath = '/usr/share/perl5';
34
 
+our $templatedir = "/var/lib/bugzilla/template";
35
 
+our $params_file = "/etc/bugzilla/params";
36
 
 
37
 
 # variable paths
38
 
 our $project;
39
 
@@ -61,15 +76,28 @@
40
 
 our $datadir;
41
 
 if ($ENV{'PROJECT'} && $ENV{'PROJECT'} =~ /^(\w+)$/) {
42
 
     $project = $1;
43
 
-    $localconfig = "$libpath/localconfig.$project";
44
 
-    $datadir = "$libpath/data/$project";
45
 
-} else {
46
 
-    $localconfig = "$libpath/localconfig";
47
 
-    $datadir = "$libpath/data";
48
 
+    $localconfig = "/etc/bugzilla/localconfig.$project";
49
 
+    $datadir = "/var/lib/bugzilla/data/$project";
50
 
 }
51
 
+
52
 
+# If we have a $xsite (the Debian way), let's manage the conf paths correctly
53
 
+elsif ($xsite) {
54
 
+       $localconfig = "/etc/bugzilla/sites/${xsite}/localconfig";
55
 
+       $params_file = "/etc/bugzilla/sites/${xsite}/params";
56
 
+       $datadir     = "/var/lib/bugzilla/data-${xsite}";
57
 
+    $templatedir = (-d "/var/lib/bugzilla/template-${xsite}") ?  
58
 
+                    "/var/lib/bugzilla/template-${xsite}" : 
59
 
+                    "/var/lib/bugzilla/template";
60
 
+}
61
 
+
62
 
+# Default case
63
 
+else {
64
 
+    $localconfig = "/etc/bugzilla/localconfig";
65
 
+    $datadir = "/var/lib/bugzilla/data";
66
 
+}
67
 
+
68
 
 our $attachdir = "$datadir/attachments";
69
 
 our $webdotdir = "$datadir/webdot";
70
 
-
71
 
 our @parampanels = ();
72
 
 
73
 
 # Module stuff
74
 
@@ -93,12 +121,20 @@
75
 
 Exporter::export_ok_tags('admin', 'db', 'locations', 'params');
76
 
 
77
 
 # Bugzilla version
78
 
-$Bugzilla::Config::VERSION = "2.22.1";
79
 
+$Bugzilla::Config::VERSION = "2.22.1-debian2";
80
 
 
81
 
 use Safe;
82
 
 
83
 
 use vars qw(@param_list);
84
 
 
85
 
+# Debian -
86
 
+# For providing a simple way to install several virtual hosts of the same
87
 
+# package, we use also here an Apache environment variable for specifing
88
 
+# the webpath. This will give a nice way to customize several VirtualHosts.
89
 
+our $WEBPATH;
90
 
+$WEBPATH = $ENV{'X_BUGZILLA_WEBPATH'} if defined $ENV{'X_BUGZILLA_WEBPATH'};
91
 
+$WEBPATH = "/bugzilla/" if (not defined $WEBPATH);
92
 
+
93
 
 # Data::Dumper is required as needed, below. The problem is that then when
94
 
 # the code locally sets $Data::Dumper::Foo, this triggers 'used only once'
95
 
 # warnings.
96
 
@@ -115,25 +151,32 @@
97
 
 
98
 
 # XXX - mod_perl - need to register Apache init handler for params
99
 
 sub _load_datafiles {
100
 
+
101
 
+    # make sure localconfig exists
102
 
+    unless (-f $localconfig ) {
103
 
+           die "$localconfig is not here";
104
 
+    }
105
 
+
106
 
     # read in localconfig variables
107
 
-    do $localconfig;
108
 
+    do $localconfig or 
109
 
+        die "Could not execute `$localconfig'! ; make sure permissions are ok.";
110
 
 
111
 
-    if (-e "$datadir/params") {
112
 
+    if (-e "$params_file") {
113
 
         # Handle reading old param files by munging the symbol table
114
 
         # Don't have to do this if we use safe mode, since its evaled
115
 
         # in a sandbox where $foo is in the same module as $::foo
116
 
         #local *::param = \%param;
117
 
 
118
 
-        # Note that checksetup.pl sets file permissions on '$datadir/params'
119
 
+        # Note that checksetup.pl sets file permissions on '$params_file'
120
 
 
121
 
         # Using Safe mode is _not_ a guarantee of safety if someone does
122
 
         # manage to write to the file. However, it won't hurt...
123
 
         # See bug 165144 for not needing to eval this at all
124
 
         my $s = new Safe;
125
 
 
126
 
-        $s->rdo("$datadir/params");
127
 
-        die "Error reading $datadir/params: $!" if $!;
128
 
-        die "Error evaluating $datadir/params: $@" if $@;
129
 
+        $s->rdo("$params_file");
130
 
+        die "Error reading $params_file: $!" if $!;
131
 
+        die "Error evaluating $params_file: $@" if $@;
132
 
 
133
 
         # Now read the param back out from the sandbox
134
 
         %param = %{$s->varglob('param')};
135
 
@@ -147,7 +190,7 @@
136
 
 my %params;
137
 
 
138
 
 # Load in the param definitions
139
 
-foreach my $item ((glob "$libpath/Bugzilla/Config/*.pm")) {
140
 
+foreach my $item ((glob "$pmpath/Bugzilla/Config/*.pm")) {
141
 
     $item =~ m#/([^/]+)\.pm$#;
142
 
     my $module = $1;
143
 
     next if ($module eq 'Common');
144
 
@@ -309,10 +352,21 @@
145
 
 
146
 
     close $fh;
147
 
 
148
 
-    rename $tmpname, "$datadir/params"
149
 
-      || die "Can't rename $tmpname to $datadir/params: $!";
150
 
+    # Debian - 
151
 
+    # We write it by hand
152
 
+    # this works really better than the original rename() call
153
 
+    # and will prevent overwriting of symlinks.
154
 
+    open TMPFILE, "<$tmpname" or die "$!";
155
 
+    open PARAMSFILE, ">$params_file" or die $!;
156
 
+    while (<TMPFILE>) {
157
 
+           print PARAMSFILE $_;
158
 
+    }
159
 
+    close TMPFILE;
160
 
+    close PARAMSFILE;
161
 
+    unlink $tmpname;
162
 
163
 
 
164
 
-    ChmodDataFile("$datadir/params", 0666);
165
 
+    ChmodDataFile("$params_file", 0666);
166
 
 }
167
 
 
168
 
 # Some files in the data directory must be world readable if and only if
169
 
diff -urNad trunk~/Bugzilla/Template.pm trunk/Bugzilla/Template.pm
170
 
--- trunk~/Bugzilla/Template.pm 2006-11-04 15:56:30.000000000 +0100
171
 
+++ trunk/Bugzilla/Template.pm  2006-11-15 07:55:51.000000000 +0100
172
 
@@ -567,6 +567,9 @@
173
 
                 require Bugzilla::BugMail;
174
 
                 Bugzilla::BugMail::Send($id, $mailrecipients);
175
 
             },
176
 
+            
177
 
+            # The webpath
178
 
+            'webpath' => $Bugzilla::Config::WEBPATH,
179
 
 
180
 
             # Bugzilla version
181
 
             # This could be made a ref, or even a CONSTANT with TT2.08