chiark / gitweb /
catacomb-import-update: Install the conversion outputs at the end
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 31 Dec 2019 14:23:52 +0000 (14:23 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 1 Jan 2020 23:48:14 +0000 (23:48 +0000)
This makes this more suitable for use with make, as it doesn't write
"wrong" output files.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
catacomb-import-update

index 792e86cf4b50cde0b37b3e52435da13dc6cc900d..b02cbdba1947d6c987218f24bf887adeb02032cc 100755 (executable)
@@ -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: