summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2006-07-14 06:50:08 +0200
committermkanat%bugzilla.org <>2006-07-14 06:50:08 +0200
commit9f7ba4e2a5a3b7a4a22e160343b7571058736199 (patch)
tree23dbe66e04083efe863264a603ef5007f53cd7d5 /checksetup.pl
parent0ff501d5a5a0ca36aeb2d7af30dffbb3802428e5 (diff)
downloadbugzilla-9f7ba4e2a5a3b7a4a22e160343b7571058736199.tar.gz
bugzilla-9f7ba4e2a5a3b7a4a22e160343b7571058736199.tar.xz
Bug 281494: Create Bugzilla::Install::Requirements for requirements-checking subroutines in checksetup.pl
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=colin, r=wicked, a=myk
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl161
1 files changed, 3 insertions, 158 deletions
diff --git a/checksetup.pl b/checksetup.pl
index ba7e2e59a..9033666ee 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -208,170 +208,15 @@ printf "\n*** This is Bugzilla " . BUGZILLA_VERSION . " on perl %vd ***\n", $^V
# Check required module
###########################################################################
+use Bugzilla::Install::Requirements;
+
#
# Here we check for --MODULES--
#
print "\nChecking perl modules ...\n" unless $silent;
-# vers_cmp is adapted from Sort::Versions 1.3 1996/07/11 13:37:00 kjahds,
-# which is not included with Perl by default, hence the need to copy it here.
-# Seems silly to require it when this is the only place we need it...
-sub vers_cmp {
- if (@_ < 2) { die "not enough parameters for vers_cmp" }
- if (@_ > 2) { die "too many parameters for vers_cmp" }
- my ($a, $b) = @_;
- my (@A) = ($a =~ /(\.|\d+|[^\.\d]+)/g);
- my (@B) = ($b =~ /(\.|\d+|[^\.\d]+)/g);
- my ($A,$B);
- while (@A and @B) {
- $A = shift @A;
- $B = shift @B;
- if ($A eq "." and $B eq ".") {
- next;
- } elsif ( $A eq "." ) {
- return -1;
- } elsif ( $B eq "." ) {
- return 1;
- } elsif ($A =~ /^\d+$/ and $B =~ /^\d+$/) {
- return $A <=> $B if $A <=> $B;
- } else {
- $A = uc $A;
- $B = uc $B;
- return $A cmp $B if $A cmp $B;
- }
- }
- @A <=> @B;
-}
-
-# This was originally clipped from the libnet Makefile.PL, adapted here to
-# use the above vers_cmp routine for accurate version checking.
-sub have_vers {
- my ($pkg, $wanted) = @_;
- my ($msg, $vnum, $vstr);
- no strict 'refs';
- printf("Checking for %15s %-9s ", $pkg, !$wanted?'(any)':"(v$wanted)") unless $silent;
-
- # Modules may change $SIG{__DIE__} and $SIG{__WARN__}, so localise them here
- # so that later errors display 'normally'
- local $::SIG{__DIE__};
- local $::SIG{__WARN__};
-
- eval "require $pkg;";
-
- # do this twice to avoid a "used only once" error for these vars
- $vnum = ${"${pkg}::VERSION"} || ${"${pkg}::Version"} || 0;
- $vnum = ${"${pkg}::VERSION"} || ${"${pkg}::Version"} || 0;
- $vnum = -1 if $@;
-
- # 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 ($pkg eq 'CGI' && $vnum =~ /(2\.7\d)(\d+)/) {
- $vnum = $1 . "." . $2;
- }
-
- if ($vnum eq "-1") { # string compare just in case it's non-numeric
- $vstr = "not found";
- }
- elsif (vers_cmp($vnum,"0") > -1) {
- $vstr = "found v$vnum";
- }
- else {
- $vstr = "found unknown version";
- }
-
- my $vok = (vers_cmp($vnum,$wanted) > -1);
- print ((($vok) ? "ok: " : " "), "$vstr\n") unless $silent;
- return $vok;
-}
-
-# Check versions of dependencies. 0 for version = any version acceptable
-my $modules = [
- {
- name => 'AppConfig',
- version => '1.52'
- },
- {
- name => 'CGI',
- version => '2.93'
- },
- {
- name => 'Data::Dumper',
- version => '0'
- },
- {
- name => 'Date::Format',
- version => '2.21'
- },
- {
- name => 'DBI',
- version => '1.38'
- },
- {
- name => 'File::Spec',
- version => '0.84'
- },
- {
- name => 'File::Temp',
- version => '0'
- },
- {
- name => 'Template',
- version => '2.08'
- },
- {
- name => 'Text::Wrap',
- version => '2001.0131'
- },
- {
- name => 'Mail::Mailer',
- version => '1.67'
- },
- {
- name => 'MIME::Base64',
- version => '3.01'
- },
- {
- # MIME::Parser is packaged as MIME::Tools on ActiveState Perl
- name => $^O =~ /MSWin32/i ? 'MIME::Tools' : 'MIME::Parser',
- version => '5.406'
- },
- {
- name => 'Storable',
- version => '0'
- },
-];
-
-my %ppm_modules = (
- 'AppConfig' => 'AppConfig',
- 'Chart::Base' => 'Chart',
- 'CGI' => 'CGI',
- 'Data::Dumper' => 'Data-Dumper',
- 'Date::Format' => 'TimeDate',
- 'DBI' => 'DBI',
- 'DBD::mysql' => 'DBD-mysql',
- 'Template' => 'Template-Toolkit',
- 'PatchReader' => 'PatchReader',
- 'GD' => 'GD',
- 'GD::Graph' => 'GDGraph',
- 'GD::Text::Align' => 'GDTextUtil',
- 'Mail::Mailer' => 'MailTools',
- 'Mail::Base64' => 'MIME-Base64',
- 'MIME::Tools' => 'MIME-Tools',
- 'XML::Twig' => 'XML-Twig',
- 'LWP::UserAgent' => 'LWP-UserAgent'
-);
-
-sub install_command {
- my $module = shift;
- if ($^O =~ /MSWin32/i) {
- return "ppm install " . $ppm_modules{$module} if exists $ppm_modules{$module};
- return "ppm install " . $module;
- } else {
- return "$^X -MCPAN -e 'install \"$module\"'";
- }
-}
+my $modules = REQUIRED_MODULES;
$::root = ($^O =~ /MSWin32/i ? 'Administrator' : 'root');