diff options
Diffstat (limited to 'Bugzilla/Install/Requirements.pm')
-rw-r--r-- | Bugzilla/Install/Requirements.pm | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm index 420ce2085..d52b576df 100644 --- a/Bugzilla/Install/Requirements.pm +++ b/Bugzilla/Install/Requirements.pm @@ -24,6 +24,7 @@ package Bugzilla::Install::Requirements; # MUST NOT "use." use strict; +use version; use Bugzilla::Constants; use Bugzilla::Install::Util qw(vers_cmp install_string bin_loc @@ -206,7 +207,9 @@ sub OPTIONAL_MODULES { package => 'Chart', module => 'Chart::Lines', # Versions below 2.1 cannot be detected accurately. - version => '2.1', + # There is no 2.1.0 release (it was 2.1), but .0 is required to fix + # https://rt.cpan.org/Public/Bug/Display.html?id=28218. + version => '2.1.0', feature => [qw(new_charts old_charts)], }, { @@ -641,8 +644,8 @@ sub check_graphviz { return $return; } -# This was originally clipped from the libnet Makefile.PL, adapted here to -# use the below vers_cmp routine for accurate version checking. +# This was originally clipped from the libnet Makefile.PL, adapted here for +# accurate version checking. sub have_vers { my ($params, $output) = @_; my $module = $params->{module}; @@ -667,21 +670,17 @@ sub have_vers { if ($@) { no strict 'refs'; $vnum = ${"${module}::VERSION"}; - } - $vnum ||= -1; - # CGI's versioning scheme went 2.75, 2.751, 2.752, 2.753, 2.76 - # That breaks the standard version tests, so we need to manually correct - # the version - if ($module eq 'CGI' && $vnum =~ /(2\.7\d)(\d+)/) { - $vnum = $1 . "." . $2; - } - # CPAN did a similar thing, where it has versions like 1.9304. - if ($module eq 'CPAN' and $vnum =~ /^(\d\.\d{2})\d{2}$/) { - $vnum = $1; + # If we come here, then the version is not a valid one. + # We try to sanitize it. + if ($vnum =~ /^((\d+)(\.\d+)*)/) { + $vnum = $1; + } } + $vnum ||= -1; - my $vok = (vers_cmp($vnum,$wanted) > -1); + # Must do a string comparison as $vnum may be of the form 5.10.1. + my $vok = ($vnum ne '-1' && version->new($vnum) >= version->new($wanted)) ? 1 : 0; my $blacklisted; if ($vok && $params->{blacklist}) { $blacklisted = grep($vnum =~ /$_/, @{$params->{blacklist}}); |