From ded1d245bbb7b419f5d583802e4967e82a008801 Mon Sep 17 00:00:00 2001 From: Kevin Koch Date: Thu, 26 Apr 2007 13:02:32 +0000 Subject: 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 --- src/windows/build/bkw.pl | 60 +++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 23 deletions(-) (limited to 'src/windows/build/bkw.pl') diff --git a/src/windows/build/bkw.pl b/src/windows/build/bkw.pl index 439e68053b..9321bf69bd 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 { -- cgit