Commit f60ac86c authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 344612: $silent does not work properly in checksetup.pl anymore

Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=justdave
parent b9c7dd46
...@@ -106,11 +106,11 @@ use constant WIN32_MODULE_NAMES => { ...@@ -106,11 +106,11 @@ use constant WIN32_MODULE_NAMES => {
# This was originally clipped from the libnet Makefile.PL, adapted here to # This was originally clipped from the libnet Makefile.PL, adapted here to
# use the above vers_cmp routine for accurate version checking. # use the above vers_cmp routine for accurate version checking.
sub have_vers { sub have_vers {
my ($pkg, $wanted) = @_; my ($pkg, $wanted, $silent) = @_;
my ($msg, $vnum, $vstr); my ($msg, $vnum, $vstr);
no strict 'refs'; no strict 'refs';
printf("Checking for %15s %-9s ", $pkg, !$wanted?'(any)':"(v$wanted)") printf("Checking for %15s %-9s ", $pkg, !$wanted?'(any)':"(v$wanted)")
unless $::silent; unless $silent;
# Modules may change $SIG{__DIE__} and $SIG{__WARN__}, so localise them here # Modules may change $SIG{__DIE__} and $SIG{__WARN__}, so localise them here
# so that later errors display 'normally' # so that later errors display 'normally'
...@@ -142,7 +142,7 @@ sub have_vers { ...@@ -142,7 +142,7 @@ sub have_vers {
} }
my $vok = (vers_cmp($vnum,$wanted) > -1); my $vok = (vers_cmp($vnum,$wanted) > -1);
print ((($vok) ? "ok: " : " "), "$vstr\n") unless $::silent; print ((($vok) ? "ok: " : " "), "$vstr\n") unless $silent;
return $vok ? 1 : 0; return $vok ? 1 : 0;
} }
...@@ -245,7 +245,7 @@ represent the name of the module and the version that we require. ...@@ -245,7 +245,7 @@ represent the name of the module and the version that we require.
Returns: -1 if $a is less than $b, 0 if they are equal, and Returns: -1 if $a is less than $b, 0 if they are equal, and
1 if $a is greater than $b. 1 if $a is greater than $b.
=item C<have_vers($pkg, $wanted)> =item C<have_vers($pkg, $wanted, $silent)>
Description: Tells you whether or not you have the appropriate Description: Tells you whether or not you have the appropriate
version of the module requested. It also prints version of the module requested. It also prints
...@@ -256,13 +256,12 @@ represent the name of the module and the version that we require. ...@@ -256,13 +256,12 @@ represent the name of the module and the version that we require.
C<$wanted> - The version of the package you require. C<$wanted> - The version of the package you require.
Set this to 0 if you don't require any Set this to 0 if you don't require any
particular version. particular version.
C<$silent> - Set to true if you don't want this function
to print out anything.
Returns: C<1> if you have the module installed and you have the Returns: C<1> if you have the module installed and you have the
appropriate version. C<0> otherwise. appropriate version. C<0> otherwise.
Notes: If you set C<$main::silent> to a true value, this function
won't print out anything.
=item C<install_command($module)> =item C<install_command($module)>
Description: Prints out the appropriate command to install the Description: Prints out the appropriate command to install the
......
...@@ -223,7 +223,7 @@ $::root = ($^O =~ /MSWin32/i ? 'Administrator' : 'root'); ...@@ -223,7 +223,7 @@ $::root = ($^O =~ /MSWin32/i ? 'Administrator' : 'root');
my %missing = (); my %missing = ();
foreach my $module (@{$modules}) { foreach my $module (@{$modules}) {
unless (have_vers($module->{name}, $module->{version})) { unless (have_vers($module->{name}, $module->{version}, $silent)) {
$missing{$module->{name}} = $module->{version}; $missing{$module->{name}} = $module->{version};
} }
} }
...@@ -234,20 +234,22 @@ print "\nYou need one of the following DBD modules installed, depending on\n" ...@@ -234,20 +234,22 @@ print "\nYou need one of the following DBD modules installed, depending on\n"
my $have_one_dbd = 0; my $have_one_dbd = 0;
my $db_modules = DB_MODULE; my $db_modules = DB_MODULE;
foreach my $db (keys %$db_modules) { foreach my $db (keys %$db_modules) {
if (have_vers($db_modules->{$db}->{dbd}, $db_modules->{$db}->{dbd_version})) { if (have_vers($db_modules->{$db}->{dbd},
$db_modules->{$db}->{dbd_version}, $silent))
{
$have_one_dbd = 1; $have_one_dbd = 1;
} }
} }
print "\nThe following Perl modules are optional:\n" unless $silent; print "\nThe following Perl modules are optional:\n" unless $silent;
my $gd = have_vers("GD","1.20"); my $gd = have_vers("GD","1.20", $silent);
my $chartbase = have_vers("Chart::Base","1.0"); my $chartbase = have_vers("Chart::Base","1.0", $silent);
my $xmlparser = have_vers("XML::Twig",0); my $xmlparser = have_vers("XML::Twig",0, $silent);
my $lwp_ua = have_vers("LWP::UserAgent",0); my $lwp_ua = have_vers("LWP::UserAgent",0, $silent);
my $gdgraph = have_vers("GD::Graph",0); my $gdgraph = have_vers("GD::Graph",0, $silent);
my $gdtextalign = have_vers("GD::Text::Align",0); my $gdtextalign = have_vers("GD::Text::Align",0, $silent);
my $patchreader = have_vers("PatchReader","0.9.4"); my $patchreader = have_vers("PatchReader","0.9.4", $silent);
my $imagemagick = have_vers("Image::Magick",0); my $imagemagick = have_vers("Image::Magick",0, $silent);
print "\n" unless $silent; print "\n" unless $silent;
...@@ -760,7 +762,7 @@ if ($my_db_check) { ...@@ -760,7 +762,7 @@ if ($my_db_check) {
my $actual_dbd_ver = DB_MODULE->{lc($my_db_driver)}->{dbd_version}; my $actual_dbd_ver = DB_MODULE->{lc($my_db_driver)}->{dbd_version};
my $sql_server = DB_MODULE->{lc($my_db_driver)}->{name}; my $sql_server = DB_MODULE->{lc($my_db_driver)}->{name};
my $sql_want = DB_MODULE->{lc($my_db_driver)}->{db_version}; my $sql_want = DB_MODULE->{lc($my_db_driver)}->{db_version};
unless (have_vers($actual_dbd, $actual_dbd_ver)) { unless (have_vers($actual_dbd, $actual_dbd_ver, $silent)) {
print "For $sql_server, Bugzilla requires that perl's" print "For $sql_server, Bugzilla requires that perl's"
. " $actual_dbd be installed.\nTo install this module," . " $actual_dbd be installed.\nTo install this module,"
. " you can do:\n " . install_command($actual_dbd) . "\n"; . " you can do:\n " . install_command($actual_dbd) . "\n";
...@@ -1517,7 +1519,7 @@ import Bugzilla::Bug qw(is_open_state); ...@@ -1517,7 +1519,7 @@ import Bugzilla::Bug qw(is_open_state);
for my $verifymethod (split /,\s*/, Bugzilla->params->{'user_verify_class'}) { for my $verifymethod (split /,\s*/, Bugzilla->params->{'user_verify_class'}) {
if ($verifymethod eq 'LDAP') { if ($verifymethod eq 'LDAP') {
my $netLDAP = have_vers("Net::LDAP", 0); my $netLDAP = have_vers("Net::LDAP", 0, $silent);
if (!$netLDAP && !$silent) { if (!$netLDAP && !$silent) {
print "If you wish to use LDAP authentication, then you must install Net::LDAP\n\n"; print "If you wish to use LDAP authentication, then you must install Net::LDAP\n\n";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment