From: Ian Jackson Date: Tue, 31 Dec 2019 17:08:55 +0000 (+0000) Subject: catacomb-import-update: Rename directory variables X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=903b46a5c2a0165fc8d429f39264bc2534ad0c91;p=secnet.git catacomb-import-update: Rename directory variables There are three directories, not two, now. The previous arrangement's variablenames, which now take different values at different times, are confusing. Signed-off-by: Ian Jackson --- diff --git a/catacomb-import-update b/catacomb-import-update index 1d8e0ff..0ed4fe5 100755 --- a/catacomb-import-update +++ b/catacomb-import-update @@ -30,9 +30,9 @@ 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 $DONOR_DIR = '../catacomb'; +my $IMPORT_DIR = "catacomb-import"; +my $OUTPUT_DIR = 'cat'; my $MAKEFILE_FRAGMENT = "secnet-import.auto.mk"; (my $PROG = $0) =~ s{^.*/}{}; @@ -59,7 +59,7 @@ sub note_path ($$) { } my $recip_rev = capturex "git", "rev-list", "--max-count=1", - "HEAD", "--", "$DONOR_IMPORT_DIR/$donor"; chomp $recip_rev; + "HEAD", "--", "$IMPORT_DIR/$donor"; chomp $recip_rev; my $donor_rev; if ($recip_rev eq "") @@ -114,7 +114,7 @@ sub commit_changes () { return if $DOCONVERT; - my $idir = $DONOR_IMPORT_DIR; + my $idir = $IMPORT_DIR; runx 'rm', '-rf', $idir; runx 'mkdir', $idir; @@ -906,10 +906,9 @@ die "usage: $PROG --import|--convert\n" $DOCONVERT = $1 eq 'convert'; if ($DOCONVERT) { - $DONOR_DIR = $0; - $DONOR_DIR =~ s{[^/]+$}{$DONOR_IMPORT_DIR} or die "$0 ?"; + $0 =~ m{/[^/]+$} or die "$0 invoked confusingly ?"; + $IMPORT_DIR = "$`/$IMPORT_DIR"; } else { - $DONOR_DIR = "../catacomb"; chomp ($DONOR_VERSION = capturex @with_dir, $DONOR_DIR, "git", "describe", "--abbrev=4", "--dirty=+"); chomp ($DONOR_REVISION = capturex @with_dir, $DONOR_DIR, @@ -918,13 +917,15 @@ if ($DOCONVERT) { note_path 'debian/copyright', undef; -do { no autodie; mkdir $RECIP_DIR; } -or $!==EEXIST or die "mkdir $RECIP_DIR: $!" if $DOCONVERT; +if ($DOCONVERT) { + do { no autodie; mkdir $OUTPUT_DIR; } + or $!==EEXIST or die "mkdir $OUTPUT_DIR: $!"; +} for my $f (@WANT_C) { (my $base = $f) =~ s{^.*/}{}; note_path $f, $base; - convert_c "$DONOR_DIR/$f", "$RECIP_DIR/$base"; + convert_c "$IMPORT_DIR/$f", "$OUTPUT_DIR/$base"; } for (my $i = 0; $i < @WANT_TEST; $i += 2) { @@ -945,17 +946,17 @@ for (my $i = 0; $i < @WANT_TEST; $i += 2) { $base = $b; } note_path $j, "$base-tests.in"; - push @in, $pre . "$DONOR_DIR/$j"; + push @in, $pre . "$IMPORT_DIR/$j"; } - convert_test \@in, "$RECIP_DIR/$base-tests.in", $varmap; + convert_test \@in, "$OUTPUT_DIR/$base-tests.in", $varmap; } commit_changes() if !$DOCONVERT; if ($DOCONVERT) { - my $mff2 = "$RECIP_DIR/$MAKEFILE_FRAGMENT.compare"; + my $mff2 = "$OUTPUT_DIR/$MAKEFILE_FRAGMENT.compare"; write_makefile_fragment($mff2); - runx "diff", "-u", "$DONOR_DIR/$MAKEFILE_FRAGMENT", $mff2; + runx "diff", "-u", "$IMPORT_DIR/$MAKEFILE_FRAGMENT", $mff2; foreach my $to (@RENAME_LIST) { rename "$to.new", "$to";