# This module contains all code for checking API versions for the # VSS to Perforce converter. # # $Id: //public/perforce/utils/vsstop4/main/convert.pm#16 $ # require 5.0; package utils; # This package use Exporter; use vars qw(@ISA @EXPORT); use convert; @ISA = qw(Exporter); @EXPORT = qw(p4api p4exec p4errors_get p4errors_print log_ss_version); # Checks sub p4api { my $p4perl_version_reqd = "P4PERL/NTX86/2007.3"; my $usage = "\nP4Perl module (P4) is required for the converter to run. Install P4Perl from the Perforce FTP site. Please use version $p4perl_version_reqd. Just double-click on Windows installer and run it (no real need to download and save). E.g.: ftp://ftp.perforce.com/perforce/r07.3/bin.ntx86/p4perl58.exe \n"; # Check that P4 Module is installed eval{require P4; import P4;}; if ($@) { print $usage; exit(1); } my $ver = P4::Identify(); convert::sum_log("P4Perl version: $ver\n"); if ($ver !~ /\s*$p4perl_version_reqd/) { print $usage; print "****** Wrong P4Perl version installed - $ver is what you have - please uninstall and install $p4perl_version_reqd instead!"; exit(1); } my $p4 = new P4; $p4->SetApiLevel( 57 ); # Lock to 2005.1 format $p4->SetProg("vsstop4"); return $p4; } sub p4exec { my ($p4, $cmd, $errorexit) = @_; $errorexit = 0 if (!defined($errorexit)); my $result = $p4->Run(split(' ', $cmd)); p4errors_print($p4, $cmd, $errorexit); return $result; } sub p4errors_print { my ($p4, $msg, $errorexit) = @_; $errorexit = 0 if (!defined($errorexit)); if ($p4->ErrorCount()) { my $output = "**p4errors - $msg:\n"; print $output; convert::log($output); foreach my $e ($p4->Errors()){ print "$e\n" if $errorexit;; convert::log("$e\n"); } exit(4) if $errorexit; } } sub p4errors_get { my @result; if ($p4->ErrorCount()) { foreach my $e ($p4->Errors()){ push @result, "$e\n"; } } return join("\n", @result); } sub log_ss_version { my $output = convert::run("ss about $convert::ss_options"); convert::log($output); convert::sum_log($output); } 1;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 6391 | Robert Cowham | Got convert running through. | ||
#1 | 6388 | Robert Cowham | Populate branch | ||
//guest/perforce_software/utils/vsstop4/main/utils.pm | |||||
#6 | 6039 | Robert Cowham | - Upgraded to use P4Perl 3.6001 | ||
#5 | 5860 | Robert Cowham | - Improved logging slightly - new summary log file sumlogfile.log created | ||
#4 | 5802 | Robert Cowham | - Set P4Perl API level to 57 (2005.1) to avoid future incompatibilities. | ||
#3 | 5776 | Robert Cowham | Upgrade to P4Perl 3.5708 | ||
#2 | 5681 | Robert Cowham |
- Fix compatibility problem with 2005.1 server - Added tests for all servers back to 2003.2 - Log more info about options used - Clarify the vss_user/password rather than put in ss_options |
||
#1 | 5652 | Robert Cowham |
- Add more troubleshooting help to readme.html. - Update to use P4Perl 3.5313 - Added new module utils.pm to detect and fail if wrong P4Perl version used. |