chiark / gitweb /
catacomb-import-update: Write conversion output to cat/ subdir
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 31 Dec 2019 12:45:50 +0000 (12:45 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 1 Jan 2020 23:48:14 +0000 (23:48 +0000)
This avoids mixing this automunged stuff from Catacomb with normal
secnet code and will thereby avoid accidental manual edits.

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

index b02cbdba1947d6c987218f24bf887adeb02032cc..7c41c96b24bf0278726b467d394601984848aa33 100755 (executable)
@@ -25,12 +25,14 @@ use autodie;
 use IPC::System::Simple qw{runx capturex $EXITVAL};
 
 use Data::Dumper;
+use POSIX;
 
 my $DOCONVERT;
 my $DONOR_VERSION = "UNKNOWN";
 my $DONOR_REVISION = "UNKNOWN";
 my $DONOR_DIR;
 my $DONOR_IMPORT_DIR = "catacomb-import";
+my $RECIP_DIR = 'cat';
 
 (my $PROG = $0) =~ s{^.*/}{};
 
@@ -895,10 +897,13 @@ chomp ($DONOR_REVISION = capturex @with_dir, $DONOR_DIR,
 
 note_path 'debian/copyright', undef;
 
+do { no autodie; mkdir $RECIP_DIR; }
+or $!==EEXIST or die "mkdir $RECIP_DIR: $!" if $DOCONVERT;
+
 for my $f (@WANT_C) {
   (my $base = $f) =~ s{^.*/}{};
   note_path $f, $base;
-  convert_c "$DONOR_DIR/$f", $base;
+  convert_c "$DONOR_DIR/$f", "$RECIP_DIR/$base";
 }
 
 for (my $i = 0; $i < @WANT_TEST; $i += 2) {
@@ -921,7 +926,7 @@ for (my $i = 0; $i < @WANT_TEST; $i += 2) {
     note_path $j, "$base-tests.in";
     push @in, $pre . "$DONOR_DIR/$j";
   }
-  convert_test \@in, "$base-tests.in", $varmap;
+  convert_test \@in, "$RECIP_DIR/$base-tests.in", $varmap;
 }
 
 commit_changes() if !$DOCONVERT;