From 0ce0e2a279f6f39b6ce5f3b17699f285feca9ba1 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Fri, 16 Mar 2007 21:04:35 +0000 Subject: Bug 374215: Move all generally-useful Installation subroutines to Bugzilla::Install::Util Patch By Max Kanat-Alexander (module owner) a=mkanat --- Bugzilla/Install/Requirements.pm | 74 +--------------------------------------- 1 file changed, 1 insertion(+), 73 deletions(-) (limited to 'Bugzilla/Install/Requirements.pm') diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm index 43cdaf7ec..c090fe1f4 100644 --- a/Bugzilla/Install/Requirements.pm +++ b/Bugzilla/Install/Requirements.pm @@ -25,8 +25,8 @@ package Bugzilla::Install::Requirements; use strict; +use Bugzilla::Install::Util qw(vers_cmp); use List::Util qw(max); -use POSIX (); use Safe; use base qw(Exporter); @@ -36,9 +36,7 @@ our @EXPORT = qw( check_requirements check_graphviz - display_version_and_os have_vers - vers_cmp install_command ); @@ -466,21 +464,6 @@ sub check_graphviz { return $return; } -sub display_version_and_os { - # Display version information - printf "\n* This is Bugzilla " . BUGZILLA_VERSION . " on perl %vd\n", - $^V; - my @os_details = POSIX::uname; - # 0 is the name of the OS, 2 is the major version, - my $os_name = $os_details[0] . ' ' . $os_details[2]; - if (ON_WINDOWS) { - require Win32; - $os_name = Win32::GetOSName(); - } - # 3 is the minor version. - print "* Running on $os_name $os_details[3]\n" -} - # This was originally clipped from the libnet Makefile.PL, adapted here to # use the below vers_cmp routine for accurate version checking. sub have_vers { @@ -533,49 +516,6 @@ sub have_vers { return $vok ? 1 : 0; } -# This is taken straight from Sort::Versions 1.5, which is not included -# with perl by default. -sub vers_cmp { - my ($a, $b) = @_; - - # Remove leading zeroes - Bug 344661 - $a =~ s/^0*(\d.+)/$1/; - $b =~ s/^0*(\d.+)/$1/; - - 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 eq '.' and $B eq '.') { - next; - } elsif ( $A eq '.' ) { - return -1; - } elsif ( $B eq '.' ) { - return 1; - } elsif ($A =~ /^\d+$/ and $B =~ /^\d+$/) { - if ($A =~ /^0/ || $B =~ /^0/) { - return $A cmp $B if $A cmp $B; - } else { - return $A <=> $B if $A <=> $B; - } - } else { - $A = uc $A; - $B = uc $B; - return $A cmp $B if $A cmp $B; - } - } - @A <=> @B; -} - sub install_command { my $module = shift; my ($command, $package); @@ -656,18 +596,6 @@ Params: C<$output> - C<$true> if you want the function to Returns: C<1> if the check was successful, C<0> otherwise. -=item C - - Description: This is a comparison function, like you would use in - C, except that it compares two version numbers. - It's actually identical to versioncmp from - L. - - Params: c<$a> and C<$b> are versions you want to compare. - - Returns: -1 if $a is less than $b, 0 if they are equal, and - 1 if $a is greater than $b. - =item C Description: Tells you whether or not you have the appropriate -- cgit v1.2.3-24-g4f1b