`.Cargo.toml.nailed~`, so you only need this if you want to run
cargo by hand or something.
+ * `--no-nail` | `--nail` (default): Whether to actually nail - ie,
+ whether to actually modify any `Cargo.toml`s while running the
+ command. This can be useful, e.g., in out-of-tree mode with
+ commands that don't actually invoke cargo. Consider passingm
+ `--no-lock` too.
+
* `--no-lock` | `--lock` (default): Whether to take the
nailing-cargo lock. Some kind of protection against concurrent
operation is necessary to prevent multiple instances of
--man --manual Display complete manual (in w3m)
--leave-nailed Leave the nailed Cargo.toml in place
--just-linkfarm | --clean-linkfarm | --keep-linkfarm (default)
+ --no-nail Do not nail, just run the command.
--no-lock Do not take the lock.
-s<subcommand> Treat command as `cargo <subcommand>`
our $just_linkfarm;
our $leave_nailed;
our $oot_clean;
+our $do_nail=1;
our $do_lock=1;
#
}
sub readorigs () {
+ # We (and our callees) populate %packagemap and %manifest, so if we
+ # don't run, they remain empty and nothing is nailed.
+ return unless $do_nail;
+
foreach my $p (keys %{ $nail->{packages} }) {
my $v = $nail->{packages}{$p};
my $subdir = ref($v) ? $v->{subdir} : $v;
print STDERR "$self: package $p in $packagemap{$p}[0]\n" if $verbose>=2;
}
foreach my $mf (keys %manifests) {
- die "internal error" if $do_nail; # belt and braces
+ die "internal error" unless $do_nail; # belt and braces
my ($toml, $mf_org_subdir) = @{ $manifests{$mf} };
foreach my $deps (get_dependency_tables $toml) {
print STDERR "$self: nailed $mf\n" if $verbose>=3;
}
- if (@our_unfound_stab) {
+ if (@our_unfound_stab && $do_nail) {
print STDERR
"$self: *WARNING* cwd is not in Cargo.nail thbough it has Cargo.toml!\n";
}
$cargo_lock_update= 1;
} elsif (m{^--(clean|keep)-linkfarm$}) {
$oot_clean = $1 eq 'clean';
+ } elsif (m{^--(no)?-nail$}) {
+ $do_nail = !$1;
} elsif (m{^--(no)?-lock$}) {
$do_lock = !$1;
} elsif (m{^--leave-nailed$}) {
printf STDERR "$self: nailed (%s manifests, %s packages)%s\n",
(scalar keys %manifests), (scalar keys %packagemap),
(defined($alt_cargo_lock) and ", using `$alt_cargo_lock'")
- if $verbose;
+ if $verbose && $do_nail;
print STDERR "$self: invoking: @display_cmd\n" if $verbose;
my $estatus = invoke();
uninstall() unless $leave_nailed;
$want_uninstall = 0;
-print STDERR "$self: unnailed. status $estatus.\n" if $verbose;
+print STDERR "$self: ".($do_nail ? "unnailed" : "finished")
+ .". status $estatus.\n" if $verbose;
exit $estatus;