From 5b0dba83eddb3c231e21bb5934a91c67a666c36a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 25 Jul 2020 01:12:07 +0100 Subject: [PATCH] nailing-cargo: Print a better error about missing update mode If the user forgot generate-lockfile, we would fail with a confusing ENOENT error from the command script. Instead, spot this situation. This also gives us a place to do decide to mkdir -p or something. Related to #5, but does not fix it completely. Signed-off-by: Ian Jackson --- nailing-cargo | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nailing-cargo b/nailing-cargo index ae2b04b..b170568 100755 --- a/nailing-cargo +++ b/nailing-cargo @@ -533,6 +533,16 @@ END { } } +sub consider_directories () { + return unless defined $oot_dir; + my $bsubdir = "../$oot_dir/$subdir"; + return if stat $bsubdir; + die "$0: build directory $bsubdir inaccessible\n" + unless $!==ENOENT; + return if $cargo_lock_update; # will make it + die "$0: build directory $bsubdir does not exist, and not in Cargo.lock update mode!\n"; +} + our $cleanup_cargo_lock; sub makebackups () { foreach my $mf (keys %manifests) { @@ -799,6 +809,7 @@ consider_oot(); readorigs(); calculate(); addargs(); +consider_directories(); our @display_cmd = @ARGV; oot_massage_cmdline(); setenvs(); -- 2.30.2