From: Kevin Koch Date: Thu, 26 Apr 2007 13:02:32 +0000 (+0000) Subject: Look for unix find command in multiple places X-Git-Tag: krb5-1.7-alpha1~1121 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ded1d245bbb7b419f5d583802e4967e82a008801;p=krb5.git Look for unix find command in multiple places Not tagged yet in case it should not go in 3.2. Look for the unix find command in a list of directories instead of in only one place. This way Jeff can install cygwin in c:\tools\cygwin and Ken can have it in C:\cygwin. The two places in the list are for those two possibilities. c:\cygwin\bin and c:\tools\cygwin\bin. Move some prints below where logging starts, so the messages will be in the log. Ticket: new Target_Version: 1.6.1 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19534 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/windows/build/bkw.pl b/src/windows/build/bkw.pl index 439e68053..9321bf69b 100644 --- a/src/windows/build/bkw.pl +++ b/src/windows/build/bkw.pl @@ -237,22 +237,34 @@ sub main { if ($vverbose) {print "Debug -- Config: ".Dumper($config);} # Test the unix find command: - if (! exists $odr->{unixfind}->{value}) { - $odr->{unixfind}->{value} = "C:\\tools\\cygwin\\bin"; - } - local $unixfind = $odr->{unixfind}->{value}; - - local $savedPATH = $ENV{PATH}; - $ENV{PATH} = $unixfind.";".$savedPATH; - print "Info -- chdir to ".`cd`."\n" if ($verbose); - if (-e "a.tmp") {!system("rm a.tmp") or die "Fatal -- Couldn't clean temporary file a.tmp.";} - !system("find . -maxdepth 0 -name a.tmp > b.tmp 2>&1") or die "Fatal -- find test failed."; - local $filesize = -s "b.tmp"; - $ENV{PATH} = $savedPATH; - if ($filesize > 0) { - die "Fatal -- $unixfind does not appear to be a path to a UNIX find command."; + # List of directories where it might be: + my @find_dirs = ('c:\\cygwin\\bin', 'c:\\tools\\cygwin\\bin'); + if (exists $odr->{unixfind}->{value}) { ## Was an additional place to look specified? + push (@find_dirs, $odr->{unixfind}->{value}); } - + my $bFindFound = 0; + foreach my $dir (@find_dirs) { + if (-d $dir) { + local $savedPATH = $ENV{PATH}; + $ENV{PATH} = $dir.";".$savedPATH; + if (-e "a.tmp") {!system("rm a.tmp") or die "Fatal -- Couldn't clean temporary file a.tmp.";} + !system("find . -maxdepth 0 -name a.tmp > b.tmp 2>&1") or die "Fatal -- find test failed."; + local $filesize = -s "b.tmp"; + $ENV{PATH} = $savedPATH; + if ($filesize <= 0) { + $bFindFound = 1; + $odr->{unixfind}->{value} = $dir; + last; + } + } + } + if (! $bFindFound) { + print "Fatal -- unix find command not found in \n"; + map {print " $_ "} @find_dirs; + print "\n"; + die; + } + # Don't allow /svntag and /svnbranch simultaneously: if ( (length $odr->{svntag}->{value} > 0) && (length $odr->{svnbranch}->{value} > 0) ) { @@ -282,14 +294,6 @@ sub main { } } - print "Executing $cmdline\n"; - local $argvsize = @ARGV; - if ($argvsize > 0) { - print "\nArguments for NMAKE: "; - map {print " $_ "} @ARGV; - print "\n"; - } - # (------------------------------------------------) if ( (-d $wd) && ( ($rverb =~ /export/) || ($rverb =~ /checkout/) ) ) { print "\n\nHEADS UP!!\n\n"; @@ -311,6 +315,16 @@ sub main { $l->no_die_handler; ## Needed so XML::Simple won't throw exceptions. } + print "Executing $cmdline\n"; + local $argvsize = @ARGV; + if ($argvsize > 0) { + print "\nArguments for NMAKE: "; + map {print " $_ "} @ARGV; + print "\n"; + } + + print "Info -- Using unix find in $odr->{unixfind}->{value}\n" if ($verbose); + ##++ Begin repository action: if ($rverb =~ /skip/) {print "Info -- *** Skipping repository access.\n" if ($verbose);} else {