From bc19f61c0c33e71a00dcc8e4ca3e791a9e3b661d Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 18 Nov 2009 07:01:40 +0000 Subject: Fix for Bug 527505: Make t/001compile.t work even after Bugzilla::Install::CPAN messes with @INC, and make Bugzilla->feature work during mod_perl.pl. Patch by Max Kanat-Alexander r=LpSolit, a=mkanat --- Bugzilla/Install/Requirements.pm | 70 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 67 insertions(+), 3 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm index 40ddf9cfe..1fa53de9b 100644 --- a/Bugzilla/Install/Requirements.pm +++ b/Bugzilla/Install/Requirements.pm @@ -35,11 +35,13 @@ use base qw(Exporter); our @EXPORT = qw( REQUIRED_MODULES OPTIONAL_MODULES + FEATURE_FILES check_requirements check_graphviz have_vers install_command + map_files_to_features ); # This is how many *'s are in the top of each "box" message printed @@ -294,6 +296,22 @@ sub OPTIONAL_MODULES { return $all_modules; }; +# This maps features to the files that require that feature in order +# to compile. It is used by t/001compile.t and mod_perl.pl. +use constant FEATURE_FILES => ( + jsonrpc => ['Bugzilla/WebService/Server/JSONRPC.pm', 'jsonrpc.cgi'], + xmlrpc => ['Bugzilla/WebService/Server/XMLRPC.pm', 'xmlrpc.cgi', + 'Bugzilla/WebService.pm', 'Bugzilla/WebService/*.pm'], + moving => ['importxml.pl'], + auth_ldap => ['Bugzilla/Auth/Verify/LDAP.pm'], + auth_radius => ['Bugzilla/Auth/Verify/RADIUS.pm'], + inbound_email => ['email_in.pl'], + jobqueue => ['Bugzilla/Job/*', 'Bugzilla/JobQueue.pm', + 'Bugzilla/JobQueue/*', 'jobqueue.pl'], + patch_viewer => ['Bugzilla/Attachment/PatchReader.pm'], + updates => ['Bugzilla/Update.pm'], +); + # This implements the install-requirements hook described in Bugzilla::Hook. sub _get_extension_requirements { my ($function, $base_modules) = @_; @@ -590,6 +608,21 @@ sub install_command { return sprintf $command, $package; } +# This does a reverse mapping for FEATURE_FILES. +sub map_files_to_features { + my %features = FEATURE_FILES; + my %files; + foreach my $feature (keys %features) { + my @my_files = @{ $features{$feature} }; + foreach my $pattern (@my_files) { + foreach my $file (glob $pattern) { + $files{$file} = $feature; + } + } + } + return \%files; +} + 1; __END__ @@ -607,16 +640,42 @@ perl modules it requires.) =head1 CONSTANTS -=over 4 +=over =item C An arrayref of hashrefs that describes the perl modules required by -Bugzilla. The hashes have two keys, C and C, which -represent the name of the module and the version that we require. +Bugzilla. The hashes have three keys: + +=over + +=item C - The name of the Perl package that you'd find on +CPAN for this requirement. + +=item C - The name of a module that can be passed to the +C command in C to install this module. + +=item C - The version of this module that we require, or C<0> +if any version is acceptable. =back +=item C + +An arrayref of hashrefs that describes the perl modules that add +additional features to Bugzilla if installed. Its hashes have all +the fields of L, plus a C item--an arrayref +of strings that describe what features require this module. + +=item C + +A hashref that describes what files should only be compiled if a certain +feature is enabled. The feature is the key, and the values are arrayrefs +of file names (which are passed to C, so shell patterns work). + +=back + + =head1 SUBROUTINES =over 4 @@ -699,4 +758,9 @@ Returns: C<1> if the check was successful, C<0> otherwise. Returns: nothing +=item C + +Returns a hashref where file names are the keys and the value is the feature +that must be enabled in order to compile that file. + =back -- cgit v1.2.3-24-g4f1b