#!/usr/bin/perl #============================================================================== # Copyright and license info is available in the LICENSE file included with # the Server Deployment Package (SDP), and also available online: # https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE #------------------------------------------------------------------------------ # # Verifies a depot path one directory at a time. # # The required arguments are: # 1. Depot path to start searching in. Must end with a trailing '/...'. # 2. Perforce command string # # subs sub verifydirs($); # parse command line: # - depot path to search if($#ARGV ne 0) { die "\n\nUsage: p4verify.pl \n\nThe depot path to search must end in '/...'\n\n"; } my $depot_dir = $ARGV[0]; if($depot_dir !~ /\/\.\.\.$/) { die "\n\n\nUsage Error: Depot path for search must end with '/...'.\n\n"; } die "\nError: SDP shell environment not set. Source /p4/common/bin/p4_vars first.\n\n" unless ($ENV{'P4BIN'}); # run 'p4 verify' on each directory in the tree verifydirs(substr($depot_dir, 0, -4)); exit(0); # # verifydirs: Runs p4 verify on a dir and all sub-dirs # sub verifydirs($) { my ($dir) = @_; $dir = $dir . '/*'; print ("CALL verifydirs ($dir)\n") if ($ENV{'P4VERIFY_DEBUG'}); my $verify_cmd = $ENV{'P4BIN'} . ' -s verify -qz '; # On a replica, add the '-t' flag to the 'p4 verify' command. if ($ENV{'P4REPLICA'} eq 'TRUE') { $verify_cmd = $verify_cmd . ' -t'; } $verify_cmd = $verify_cmd . '"' . $dir . '"'; print (" VCMD: $verify_cmd\n") if ($ENV{'P4VERIFY_DEBUG'}); my $verify_list = `$verify_cmd 2>&1`; if($verify_list !~ /no such file/) { print $verify_list; } my $dirlist_cmd = $ENV{'P4BIN'} . ' dirs "' . $dir . '"'; my $dirlist = `$dirlist_cmd 2>&1`; if($dirlist !~ /no such file/) { foreach my $adir (split(/\n/, $dirlist)) { next unless $adir =~ /\/\//; verifydirs($adir); } } } # end verifydirs