summaryrefslogtreecommitdiffstats
path: root/solenv/bin/deliver.pl
diff options
context:
space:
mode:
authorHans-Joachim Lankenau <hjs@openoffice.org>2009-09-04 16:14:57 +0200
committerHans-Joachim Lankenau <hjs@openoffice.org>2009-09-04 16:14:57 +0200
commitc6703df672656c8203eb1dee3882e00fd9f11e16 (patch)
treefe0136d984ddf8eb3574d1af19c52af0de2c1c5b /solenv/bin/deliver.pl
parent#i103316# - rework localize.sdf detection (diff)
parentCreate DEV300_m57 milestone tag from trunk@275796 (diff)
downloadcore-c6703df672656c8203eb1dee3882e00fd9f11e16.tar.gz
core-c6703df672656c8203eb1dee3882e00fd9f11e16.zip
update to m57
Diffstat (limited to 'solenv/bin/deliver.pl')
-rwxr-xr-xsolenv/bin/deliver.pl32
1 files changed, 28 insertions, 4 deletions
diff --git a/solenv/bin/deliver.pl b/solenv/bin/deliver.pl
index e5d97db8b45c..055d97dbcb3e 100755
--- a/solenv/bin/deliver.pl
+++ b/solenv/bin/deliver.pl
@@ -1226,7 +1226,19 @@ sub zip_files
$work_file =~ s/\.zip$//;
$work_file .= (sprintf('.%d-%d', $$, time())) . ".zip";
die "Error: temp file $work_file already exists" if ( -e $work_file);
- copy($zip_file, $work_file) if ( -e $zip_file );
+ if ( -e $zip_file ) {
+ if ( -z $zip_file) {
+ # sometimes there are files of 0 byte size - remove them
+ unlink $zip_file or print_error("can't remove empty file '$zip_file': $!",0);
+ } else {
+ if ( ! copy($zip_file, $work_file)) {
+ # give a warning, not an error:
+ # we can zip from scratch instead of just updating the old zip file
+ print_warning("can't copy'$zip_file' into '$work_file': $!", 0);
+ unlink $work_file;
+ }
+ }
+ }
} else {
# No pre processing necessary, working directly on solver.
$work_file = $zip_file;
@@ -1268,9 +1280,21 @@ sub zip_files
} elsif ( $zip_file eq $common_zip_file) {
# rename work file back
if ( -e $work_file ) {
- if (! rename($work_file, $zip_file)) {
- print_error("can't rename temporary file to $zip_file: $!",0);
- unlink $work_file;
+ if ( -e $zip_file) {
+ # do some tricks to be fast. otherwise we may disturb other platforms
+ # by unlinking a file which just gets copied -> stale file handle.
+ my $buffer_file=$work_file . '_rm';
+ rename($zip_file, $buffer_file) or warn "Warning: can't rename old zip file '$zip_file': $!";
+ if (! rename($work_file, $zip_file)) {
+ print_error("can't rename temporary file to $zip_file: $!",0);
+ unlink $work_file;
+ }
+ unlink $buffer_file;
+ } else {
+ if (! rename($work_file, $zip_file)) {
+ print_error("can't rename temporary file to $zip_file: $!",0);
+ unlink $work_file;
+ }
}
}
}