From a50aaa37ec837b5d753ad31250db36282953c0c7 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Thu, 14 Dec 2006 05:45:12 +0000 Subject: Bug 360710: checksetup.pl needs to blacklist some non-working external modules Patch By Max Kanat-Alexander r=LpSolit, a=justdave --- Bugzilla/Constants.pm | 15 +++++++++++++-- Bugzilla/DB.pm | 7 ++++--- Bugzilla/Install/Requirements.pm | 26 +++++++++++++++++--------- 3 files changed, 34 insertions(+), 14 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 1b774c64c..9e37f9f5c 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -359,10 +359,21 @@ use constant INSTALLATION_MODE_NON_INTERACTIVE => 1; # Data about what we require for different databases. use constant DB_MODULE => { 'mysql' => {db => 'Bugzilla::DB::Mysql', db_version => '4.1.2', - dbd => 'DBD::mysql', dbd_version => '2.9003', + dbd => { + package => 'DBD-mysql', + module => 'DBD::mysql', + version => '2.9003', + # Certain versions are broken, development versions are + # always disallowed. + blacklist => ['^3\.000[3-6]', '_'], + }, name => 'MySQL'}, 'pg' => {db => 'Bugzilla::DB::Pg', db_version => '8.00.0000', - dbd => 'DBD::Pg', dbd_version => '1.45', + dbd => { + package => 'DBD-Pg', + module => 'DBD::Pg', + version => '1.45', + }, name => 'PostgreSQL'}, }; diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index 33fdda0d8..1bc88c351 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -136,16 +136,17 @@ sub bz_check_requirements { # Check the existence and version of the DBD that we need. my $dbd = $db->{dbd}; - my $dbd_ver = $db->{dbd_version}; my $sql_server = $db->{name}; my $sql_want = $db->{db_version}; - unless (have_vers({ module => $dbd, version => $dbd_ver }, $output)) { + unless (have_vers($dbd, $output)) { my $command = install_command($dbd); my $root = ROOT_USER; + my $dbd_mod = $dbd->{module}; + my $dbd_ver = $dbd->{version}; my $version = $dbd_ver ? " $dbd_ver or higher" : ''; print < $db_modules->{$db}->{dbd}, - version => $db_modules->{$db}->{dbd_version}); - $have_one_dbd = 1 if have_vers(\%info, $output); + my $dbd = $db_modules->{$db}->{dbd}; + $have_one_dbd = 1 if have_vers($dbd, $output); } print "\nThe following Perl modules are optional:\n" if $output; @@ -379,13 +382,10 @@ EOT my %db_modules = %{DB_MODULE()}; foreach my $db (keys %db_modules) { - my $command = install_command( - { module => $db_modules{$db}->{dbd}, - package => $db_modules{$db}->{dbd} }); - + my $command = install_command($db_modules{$db}->{dbd}); printf "%10s: \%s\n", $db_modules{$db}->{name}, $command; print ' ' x 12 . "Minimum version required: " - . $db_modules{$db}->{dbd_version} . "\n"; + . $db_modules{$db}->{dbd}->{version} . "\n"; } print "\n"; } @@ -525,7 +525,15 @@ sub have_vers { } my $vok = (vers_cmp($vnum,$wanted) > -1); - print ((($vok) ? "ok: " : " "), "$vstr\n") if $output; + my $blacklisted; + if ($vok && $params->{blacklist}) { + $blacklisted = grep($vnum =~ /$_/, @{$params->{blacklist}}); + $vok = 0 if $blacklisted; + } + + my $ok = $vok ? "ok:" : ""; + my $black_string = $blacklisted ? "(blacklisted)" : ""; + print "$ok $vstr $black_string\n" if $output; return $vok ? 1 : 0; } -- cgit v1.2.3-24-g4f1b