From 5cad324e693396ad7ee646102b51dd610addefae Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 25 Jul 2020 19:00:24 +0100 Subject: [PATCH] Provide --just-linkfarm option Closes #10 Signed-off-by: Ian Jackson --- README.md | 4 ++++ nailing-cargo | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b1946b0..0a6b478 100644 --- a/README.md +++ b/README.md @@ -363,6 +363,10 @@ Options * `!locked`: cargo would reject `--locked`, so don't pass it. Hazardous. * `!offline`: the build command would reject `--offline`, so never pass it. *Not* overridden by configuration or command line. + * `--just-linkfarm`: Make the out-of-tree linkfarm as if for + `--cargo-lock-update`, but do not actually run any command, nor + try to copy back a a generated `Cargo.lock`. + * `-h` | `--help`: Print usage summary. * `--man` | `--manual`: Format this manual into html using `pandoc` diff --git a/nailing-cargo b/nailing-cargo index 370fa05..cfcb97b 100755 --- a/nailing-cargo +++ b/nailing-cargo @@ -26,6 +26,7 @@ options: -T --target= Specify target architecture -h --help Print this message --man --manual Display complete manual (in w3m) + --just-linkfarm Make the linkfarm as for -u, then stop -s Treat command as `cargo ` --subcommand-props=,... Override command props (see docs) @@ -85,6 +86,7 @@ our $alt_cargo_lock; our $cargo_lock_update; our $pass_options; our $online; +our $just_linkfarm; # our %subcmd_props = ( @@ -518,6 +520,13 @@ sub calculate () { } sub addargs () { + if ($just_linkfarm) { + die "$self: --just-linkfarm but not doing out-of-tree builds!\n" + unless defined $oot_dir; + @ARGV = (); + return; + } + if (!defined $online) { $_ = cfg_uc qw(misc online); if (!defined $_) { @@ -794,7 +803,7 @@ sub invoke () { } sub cargo_lock_update_after () { - if ($cargo_lock_update) { + if ($cargo_lock_update && !$just_linkfarm) { # avoids importing File::Copy and the error handling is about as good $!=0; $?=0; my $r= system qw(cp --), "$build_absdir/Cargo.lock", "Cargo.lock"; @@ -846,7 +855,8 @@ sub parse_args () { OPTS: for (;;) { if (!@ARGV) { - die "$self: need cargo subcommand\n" unless $noact; + die "$self: need cargo subcommand\n" + unless $noact || $just_linkfarm;; push @ARGV, "CARGO-SUBCOMMAND"; # dummy, user may see it } @@ -915,6 +925,9 @@ sub parse_args () { $target = $_; } elsif (m{^--(on|off)line$}) { $online = $1 eq 'on'; + } elsif (m{^--just-linkfarm$}) { + $just_linkfarm = 1; + $cargo_lock_update= 1; } elsif (s{^--subcommand-props=}{}) { my @props = split /\,/, $_; our %subcmd_prop_ok; -- 2.30.2