|
|
|
@ -677,7 +677,7 @@ namespace eval punk::mix::base { |
|
|
|
if {$opt_use_tar != 0} { |
|
|
|
if {$opt_use_tar != 0} { |
|
|
|
set target [file tail $path] |
|
|
|
set target [file tail $path] |
|
|
|
set tmplocation [punk::mix::util::tmpdir] |
|
|
|
set tmplocation [punk::mix::util::tmpdir] |
|
|
|
set archivename $tmplocation/[punk::mix::util::tmpfile].tar |
|
|
|
set archivename $tmplocation/[punk::mix::util::tmpfile].tar ;#generates a unique filename - does not create the file. |
|
|
|
|
|
|
|
|
|
|
|
cd $base ;#cd is process-wide.. keep cd in effect for as small a scope as possible. (review for thread issues) |
|
|
|
cd $base ;#cd is process-wide.. keep cd in effect for as small a scope as possible. (review for thread issues) |
|
|
|
|
|
|
|
|
|
|
|
@ -687,14 +687,38 @@ namespace eval punk::mix::base { |
|
|
|
set tsstart [clock millis] |
|
|
|
set tsstart [clock millis] |
|
|
|
if {[set tarpath [auto_execok tar]] ne ""} { |
|
|
|
if {[set tarpath [auto_execok tar]] ne ""} { |
|
|
|
#using an external binary is *significantly* faster than tar::create - but comes with some risks |
|
|
|
#using an external binary is *significantly* faster than tar::create - but comes with some risks |
|
|
|
#review - need to check behaviour/flag variances across platforms |
|
|
|
set versioninfo [exec {*}$tarpath --version] |
|
|
|
|
|
|
|
#look for "bsdtar" vs "GNU" |
|
|
|
|
|
|
|
#GNU tar is more common on linux - but also available on windows via gnuutils or msys |
|
|
|
|
|
|
|
#<system32>/tar.exe on windows is likely to be bsdtar. |
|
|
|
|
|
|
|
#GNU tar on windows will commonly fail with 'cannot connect to C: resolve failed' - may need --force-local flag |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#review - need to further check behaviour/flag variances across platforms |
|
|
|
#don't use -z flag. On at least some tar versions the zipped file will contain a timestamped subfolder of filename.tar - which ruins the checksum |
|
|
|
#don't use -z flag. On at least some tar versions the zipped file will contain a timestamped subfolder of filename.tar - which ruins the checksum |
|
|
|
#also - tar is generally faster without the compression (although this may vary depending on file size and disk speed?) |
|
|
|
#also - tar is generally faster without the compression (although this may vary depending on file size and disk speed?) |
|
|
|
exec {*}$tarpath -cf $archivename $target ;#{*} needed in case spaces in tarpath |
|
|
|
|
|
|
|
|
|
|
|
if {[string match "*GNU*" $versioninfo]} { |
|
|
|
|
|
|
|
set flags "--force-local" |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
#presumably bsdtar - which is more likely to be present on windows - and doesn't seem to have the same issue with drive letters in paths |
|
|
|
|
|
|
|
set flags "" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if {[catch { |
|
|
|
|
|
|
|
#{*}$tarpath needed in case spaces in tarpath |
|
|
|
|
|
|
|
exec {*}$tarpath -cf {*}$flags $archivename $target |
|
|
|
|
|
|
|
} errMsg]} { |
|
|
|
set tsend [clock millis] |
|
|
|
set tsend [clock millis] |
|
|
|
set ms [expr {$tsend - $tsstart}] |
|
|
|
set ms [expr {$tsend - $tsstart}] |
|
|
|
puts stdout " tar -cf done ($ms ms)" |
|
|
|
puts stdout " 'tar -cf $flags' ERROR ($ms ms) - falling back to tar::create\n error info: $errMsg" |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
set tsend [clock millis] |
|
|
|
|
|
|
|
set ms [expr {$tsend - $tsstart}] |
|
|
|
|
|
|
|
puts stdout " 'tar -cf $flags' done ($ms ms)" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if {![file exists $archivename]} { |
|
|
|
|
|
|
|
#fallback to tar library approach if external tar failed to create the archive. |
|
|
|
set tsstart [clock millis] ;#don't include auto_exec search time for tar::create |
|
|
|
set tsstart [clock millis] ;#don't include auto_exec search time for tar::create |
|
|
|
tar::create $archivename $target |
|
|
|
tar::create $archivename $target |
|
|
|
set tsend [clock millis] |
|
|
|
set tsend [clock millis] |
|
|
|
@ -703,6 +727,7 @@ namespace eval punk::mix::base { |
|
|
|
puts stdout " NOTE: install tar executable for potentially *much* faster directory checksum processing" |
|
|
|
puts stdout " NOTE: install tar executable for potentially *much* faster directory checksum processing" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if {$ftype eq "file"} { |
|
|
|
if {$ftype eq "file"} { |
|
|
|
set sizeinfo "(size [punk::lib::format_number [file size $target]] bytes)" |
|
|
|
set sizeinfo "(size [punk::lib::format_number [file size $target]] bytes)" |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|