From 2cc6bf514ccde007ac328907f1cf124295fb92f2 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Tue, 10 Jul 2012 13:45:45 -0400 Subject: [PATCH] dropped canonicalizers for specific unix kits for windows. --- scripts/archival/shared_snarfer.pl | 19 +++++++------------ scripts/core/variables.sh | 16 ++++++++++++++++ scripts/files/filename_helper.pl | 22 +++++----------------- scripts/generator/build_variables.sh | 10 +++++----- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/scripts/archival/shared_snarfer.pl b/scripts/archival/shared_snarfer.pl index 2d778b4a..6d157163 100644 --- a/scripts/archival/shared_snarfer.pl +++ b/scripts/archival/shared_snarfer.pl @@ -179,10 +179,9 @@ sub snarfer { push(@missing_log, $base); } -print "snarfer function assumes msys canonicalization is appropriate--not cygwin compat.\n"; local($outcome) = 0xff & system $tar_tool, - "-rf", &msys_canonicalize($target_file), @excludes, - "--files-from=" . &msys_canonicalize($temp_file); + "-rf", &canonicalize($target_file), @excludes, + "--files-from=" . &canonicalize($temp_file); if ($outcome) { unlink($temp_file); die("failure to archive"); @@ -219,10 +218,9 @@ sub snarf_file_list { if ($i =~ /^\.\//) { $i = substr $i, 2, length($i) - 2; } -print "snarf_file_list function assumes msys canonicalization is appropriate--not cygwin compat.\n"; local($outcome) = 0xff & system $tar_tool, #"--directory=" . "$root", - @extra_flags, "-rf", &msys_canonicalize($target_file), @excludes, $i; + @extra_flags, "-rf", &canonicalize($target_file), @excludes, $i; if ($outcome) { die("failure to archive"); } } chdir("$currdir"); @@ -258,8 +256,7 @@ sub remove_from_backup { #print "remove_from_backup: pref=$prefix, num=$number, patt=$pattern,\n"; local($target_file) = &snarf_name($prefix, $number); -print "remove_from_backup function assumes msys canonicalization is appropriate--not cygwin compat.\n"; - open(TARPROC, "$tar_tool --delete -f " . &msys_canonicalize($target_file) + open(TARPROC, "$tar_tool --delete -f " . &canonicalize($target_file) . " \"$pattern\" 2>$null_log |"); ; } @@ -371,9 +368,8 @@ sub backup_number { local($currdir) = cwd(); chdir($TMP); -print "backup_number function assumes msys canonicalization is appropriate--not cygwin compat.\n"; local($outcome) = 0xff & system $tar_tool, "-cf", - &msys_canonicalize($target_file), &msys_canonicalize($number_file); + &canonicalize($target_file), &canonicalize($number_file); if ($outcome) { die("failure to archive"); } local($prefix_file) = "prefix.bac"; @@ -382,7 +378,7 @@ print "backup_number function assumes msys canonicalization is appropriate--not close(NUM_PREFIX); $outcome = 0xff & system $tar_tool, "-rf", - &msys_canonicalize($target_file), &msys_canonicalize($prefix_file); + &canonicalize($target_file), &canonicalize($prefix_file); if ($outcome) { die("failure to archive"); } unlink($prefix_file); chdir($currdir); @@ -450,9 +446,8 @@ sub restore_archive { $filename = "../" . $filename; } -print "restore_archive function assumes msys canonicalization is appropriate--not cygwin compat.\n"; local($outcome) = 0xff & system $tar_tool, "-xzf", - &msys_canonicalize($filename); + &canonicalize($filename); if ($outcome) { die("failure to undo archive"); } local($outcome) = diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index f40dfc4f..f3c1972a 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -37,6 +37,22 @@ if [ -z "$NECHUNG" ]; then fi export IS_DARWIN=$(echo $OSTYPE | grep -i darwin) + ############## + + # guess the current platform. + IS_UNIX=$(uname | grep -i linux) + if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i unix); fi + if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i darwin); fi + IS_DOS=$(uname | grep -i ming) + if [ -z "$IS_DOS" ]; then IS_DOS=$(uname | grep -i cygwin); fi + + # now if we're stuck in DOS, try to determine the type of system. + if [ ! -z "$IS_DOS" ]; then + # IS_MSYS will be non-empty if this is the msys toolset. otherwise + # we assume that it's cygwin. + IS_MSYS=$(uname | grep -i ming) + fi + ############## # fallbacks to set crucial variables for feisty meow... diff --git a/scripts/files/filename_helper.pl b/scripts/files/filename_helper.pl index 84c72966..531dfa51 100644 --- a/scripts/files/filename_helper.pl +++ b/scripts/files/filename_helper.pl @@ -18,7 +18,7 @@ # version of the License. Please send any updates to "fred@gruntose.com". # ############################################################################### -use Env qw(OS); +use Env qw(OS IS_MSYS); ############################################################################ @@ -233,34 +233,22 @@ sub unix_canonicalize { return &canonicalizer(@_, "/"); } -# similar to the normal unix version, but supports msys's weird paths. -sub msys_canonicalize { - return &canonicalizer(@_, "/", 1); -} - -# similar to the msys version, but services cygwin. -sub cygwin_canonicalize { - return &canonicalizer(@_, "/", 2); -} - - # this more general routine gets a directory separator passed in. it then # replaces all the separators with that one. - sub canonicalizer { local($directory_name) = $_[0]; local($dirsep) = $_[1]; - local($do_funky) = $_[2]; -#print "do funky is set to \"$do_funky\"\n"; #print "old dir name is \"$directory_name\"\n"; if ($OS =~ /win/i) { #somewhat abbreviated check; only catches windoze systems, not dos or os2. - if ($do_funky eq "1") { + # IS_MSYS is calculated by feisty meow scripts startup; it will be + # non-empty if this is the msys tool kit. + if (length($IS_MSYS) > 0) { # msys utilities version (http://www.mingw.org) $directory_name =~ s/^(.):[\\\/](.*)$/\/\1\/\2/; - } elsif ($do_funky eq "2") { + } else { # cygwin utilities version (http://www.cygwin.com) $directory_name =~ s/^(.):[\\\/](.*)$/\/cygdrive\/\1\/\2/; } diff --git a/scripts/generator/build_variables.sh b/scripts/generator/build_variables.sh index a4843191..8723e454 100644 --- a/scripts/generator/build_variables.sh +++ b/scripts/generator/build_variables.sh @@ -72,11 +72,11 @@ export CLAM_DIR="$(cd $BUILD_SCRIPTS_DIR/../clam ; \pwd)" export BUILDER_DIR="$BUILDING_HIERARCHY" # guess the current platform. -IS_UNIX=$(uname | grep -i linux) -if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i unix); fi -if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i darwin); fi -IS_DOS=$(uname | grep -i ming) -if [ -z "$IS_DOS" ]; then IS_DOS=$(uname | grep -i cygwin); fi +#IS_UNIX=$(uname | grep -i linux) +#if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i unix); fi +#if [ -z "$IS_UNIX" ]; then IS_UNIX=$(uname | grep -i darwin); fi +#IS_DOS=$(uname | grep -i ming) +#if [ -z "$IS_DOS" ]; then IS_DOS=$(uname | grep -i cygwin); fi # set some clam parameters for compilation. if the script can't guess the # right configuration, then you will need to set them in the last 'else' -- 2.34.1