# 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/2014.1"; my $p4perl_version_reqd = "P4PERL/NTX64/2018.2"; my $usage = "\nP4Perl module (P4) is required for the converter to run. Please use version $p4perl_version_reqd. Download strawberry-perl-5.28.2.1-64bit.msi from http://strawberryperl.com/releases.html \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 - see http://answers.perforce.com/articles/KB/3197 $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 | 26173 | Norman Morse | VSStoP4 update 11/22/19 | ||
#1 | 16012 | Robert Cowham | Rename/move project to conform to new Workshop naming structure. | ||
//guest/perforce_software/utils/vsstop4/main/utils.pm | |||||
#10 | 12422 | Robert Cowham | - Handle workspace with option revertunchanged. | ||
#9 | 11999 | Robert Cowham |
Clarify version of P4Perl required and instructions as to how to build. E.g. 5.20 Perl and 14.1 API. |
||
#8 | 6445 | Robert Cowham | - Updated to require P4Perl 2008.1 | ||
#7 | 6404 | Robert Cowham |
- Convert to official P4Perl - Avoid appending to logfile.log - Tidy up label markers - Remove name clash on p4exec function |
||
#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. |