From: Ian Jackson Date: Tue, 31 Dec 2019 14:23:52 +0000 (+0000) Subject: catacomb-import-update: Install the conversion outputs at the end X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=08370c1eef43f8a1dd80114a8b7469f6d1ff2b95;p=secnet.git catacomb-import-update: Install the conversion outputs at the end This makes this more suitable for use with make, as it doesn't write "wrong" output files. Signed-off-by: Ian Jackson --- diff --git a/catacomb-import-update b/catacomb-import-update index 792e86c..b02cbdb 100755 --- a/catacomb-import-update +++ b/catacomb-import-update @@ -44,6 +44,7 @@ sub moan ($) { print STDERR "$PROG: $_[0]\n"; } my %DONOR_PATH_MAP = (); my %DONOR_REV_MAP = (); my %RECIP_CACHE = (); +my @RENAME_LIST; sub note_path ($$) { my ($donor, $recip) = @_; @@ -449,7 +450,8 @@ EOF ## Done. close $in; - close $out; rename "$to.new", "$to"; + close $out; + push @RENAME_LIST, $to } ###-------------------------------------------------------------------------- @@ -772,7 +774,8 @@ EOF print $out "test " . $test . "\n\n"; print $out $chunk; } - close $out; rename "$to.new", "$to"; + close $out; + push @RENAME_LIST, $to; } ###-------------------------------------------------------------------------- @@ -923,6 +926,12 @@ for (my $i = 0; $i < @WANT_TEST; $i += 2) { commit_changes() if !$DOCONVERT; +if ($DOCONVERT) { + foreach my $to (@RENAME_LIST) { + rename "$to.new", "$to"; + } +} + # Local variables: # cperl-indent-level: 2 # End: