diff options
author | mkanat%bugzilla.org <> | 2009-11-25 07:19:13 +0100 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-11-25 07:19:13 +0100 |
commit | ab577dc1b2fbc1412e5d78e1eecb675e3973eaf6 (patch) | |
tree | 0280a8376ba7218fb82a3d2084b72092e4487d2f /Bugzilla/Install | |
parent | c62ddd06ff62e627ffd411b8ccb0fa881e1591d0 (diff) | |
download | bugzilla-ab577dc1b2fbc1412e5d78e1eecb675e3973eaf6.tar.gz bugzilla-ab577dc1b2fbc1412e5d78e1eecb675e3973eaf6.tar.xz |
Bug 530767: Allow for CPAN distribution of extensions
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=mkanat
Diffstat (limited to 'Bugzilla/Install')
-rw-r--r-- | Bugzilla/Install/Filesystem.pm | 6 | ||||
-rw-r--r-- | Bugzilla/Install/Util.pm | 29 |
2 files changed, 31 insertions, 4 deletions
diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index 819da24dd..12c0bc222 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -198,6 +198,7 @@ sub FILESYSTEM { my %create_dirs = ( $datadir => $ws_dir_full_control, "$datadir/mining" => $ws_dir_readable, + "$datadir/extensions" => $ws_dir_readable, $attachdir => $ws_dir_writeable, $extensionsdir => $ws_dir_readable, graphs => $ws_dir_writeable, @@ -208,7 +209,10 @@ sub FILESYSTEM { # The name of each file, pointing at its default permissions and # default contents. - my %create_files = (); + my %create_files = ( + "$datadir/extensions/additional" => { perms => $ws_readable, + contents => '' }, + ); # Each standard stylesheet has an associated custom stylesheet that # we create. Also, we create placeholders for standard stylesheets diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm index 107f91a9b..c60e32afe 100644 --- a/Bugzilla/Install/Util.pm +++ b/Bugzilla/Install/Util.pm @@ -130,7 +130,16 @@ sub extension_code_files { trick_taint($_) foreach @load_files; push(@files, \@load_files); } - return \@files; + + my @additional; + my $datadir = bz_locations()->{'datadir'}; + my $addl_file = "$datadir/extensions/additional"; + if (-e $addl_file) { + open(my $fh, '<', $addl_file) || die "$addl_file: $!"; + @additional = map { trim($_) } <$fh>; + close($fh); + } + return (\@files, \@additional); } # Used by _get_extension_requirements in Bugzilla::Install::Requirements. @@ -150,8 +159,8 @@ sub extension_requirement_packages { $packages = []; my %package_map; - my $extension_files = extension_code_files('requirements only'); - foreach my $file_set (@$extension_files) { + my ($file_sets, $extra_packages) = extension_code_files('requirements only'); + foreach my $file_set (@$file_sets) { my $file = shift @$file_set; my $name = require $file; if ($name =~ /^\d+$/) { @@ -162,6 +171,11 @@ sub extension_requirement_packages { $package_map{$file} = $package; push(@$packages, $package); } + foreach my $package (@$extra_packages) { + eval("require $package") || die $@; + push(@$packages, $package); + } + _cache()->{extension_requirement_packages} = $packages; # Used by Bugzilla::Extension->load if it's called after this method # (which only happens during checksetup.pl, currently). @@ -495,6 +509,15 @@ sub trick_taint { return (defined($_[0])); } +sub trim { + my ($str) = @_; + if ($str) { + $str =~ s/^\s+//g; + $str =~ s/\s+$//g; + } + return $str; +} + __END__ =head1 NAME |