chiark / gitweb /
Provide --just-linkfarm option
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2020 18:00:24 +0000 (19:00 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2020 18:00:49 +0000 (19:00 +0100)
Closes #10

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
README.md
nailing-cargo

index b1946b058172c0293c085bd4baa8af82cd0c0bd5..0a6b4787d48d52a90f68c7eed51b5cee8f578901 100644 (file)
--- 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`
index 370fa05c5e7cbb586032045abb97a7c2b64da461..cfcb97bcc2d9349f9029cf5a32db0fa24a846529 100755 (executable)
@@ -26,6 +26,7 @@ options:
   -T<arch>  --target=<arch>       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<subcommand>                  Treat command as `cargo <subcommand>`
   --subcommand-props=<prop>,...   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;