chiark / gitweb /
Provide --leave-nailed option
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2020 18:07:52 +0000 (19:07 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2020 18:07:52 +0000 (19:07 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
README.md
nailing-cargo

index 0a6b4787d48d52a90f68c7eed51b5cee8f578901..e7a5c52aa6a773d221fab3e2274a3cd83bb67ab6 100644 (file)
--- a/README.md
+++ b/README.md
@@ -353,7 +353,6 @@ Options
     * `!target`: cargo would reject `--target=<arch>`; in this case nailing-cargo's `-T` option is ineffective.
     * `!target-dir`: cargo would reject `--target-dir`, so don't pass it.  (Usually we pass `--target-dir=target` when we pass `--manifest-path`, since cargo's default is `target` in the same directory as `Cargo.toml`.)
 
-
     There are also some properties which should not be needed, but are
     provided for completeness.  Do not use these to solve the problem
     of nailing-cargo passing cargo options to a build command which is
@@ -363,10 +362,18 @@ 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`.
 
+  * `--leave-nailed`: At the end, leave all the `Cargo.toml` files in
+    their edited state, rather than (trying to) clean them up.  To
+    clean this up later, run `nailing-cargo` again without this option.
+    Without this option, the nailed versions are left in
+     `.Cargo.toml.nailed~`, so you only need this if you want to run
+    cargo by hand or something.
+
   * `-h` | `--help`: Print usage summary.
 
   * `--man` | `--manual`: Format this manual into html using `pandoc`
index cfcb97bcc2d9349f9029cf5a32db0fa24a846529..106671867be8067015c735fba150d2d9a54946ef 100755 (executable)
@@ -27,6 +27,7 @@ options:
   -h --help                       Print this message
   --man --manual                  Display complete manual (in w3m)
   --just-linkfarm                 Make the linkfarm as for -u, then stop
+  --leave-nailed                  Leave the nailed Cargo.toml in place
 
   -s<subcommand>                  Treat command as `cargo <subcommand>`
   --subcommand-props=<prop>,...   Override command props (see docs)
@@ -87,6 +88,7 @@ our $cargo_lock_update;
 our $pass_options;
 our $online;
 our $just_linkfarm;
+our $leave_nailed;
 
 #
 our %subcmd_props = (
@@ -928,6 +930,8 @@ sub parse_args () {
     } elsif (m{^--just-linkfarm$}) {
       $just_linkfarm = 1;
       $cargo_lock_update= 1;
+    } elsif (m{^--leave-nailed$}) {
+      $leave_nailed = 1;
     } elsif (s{^--subcommand-props=}{}) {
       my @props = split /\,/, $_;
       our %subcmd_prop_ok;
@@ -1007,7 +1011,7 @@ if ($dump) {
 
 exit 0 if $noact;
 
-$want_uninstall = 1;
+$want_uninstall = !$leave_nailed;
 makebackups();
 install();
 
@@ -1021,7 +1025,7 @@ my $estatus = invoke();
 
 cargo_lock_update_after();
 
-uninstall();
+uninstall() unless $leave_nailed;
 $want_uninstall = 0;
 
 print STDERR "$self: unnailed.  status $estatus.\n" if $verbose;