chiark
/
gitweb
/
~ianmdlvl
/
nailing-cargo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0abca44
)
OOT FIXES
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 10 May 2020 21:50:54 +0000
(22:50 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 10 May 2020 21:52:00 +0000
(22:52 +0100)
nailing-cargo
patch
|
blob
|
history
diff --git
a/nailing-cargo
b/nailing-cargo
index df034e037eabfb9a2e783c4238dd4bbf2e144f99..083287ace7af033e7e29657463afaeaef00f95c8 100755
(executable)
--- a/
nailing-cargo
+++ b/
nailing-cargo
@@
-75,7
+75,9
@@
$worksphere =~ s{/([^/]+)$}{}
our $subdir = $1; # leafname
our $lockfile = "../.nailing-cargo.lock";
our $subdir = $1; # leafname
our $lockfile = "../.nailing-cargo.lock";
-our $oot_cargo_lock_faff;
+
+our $cargo_lock_update;
+our $cargo_manifest_args;
our @configs;
our $verbose=1;
our @configs;
our $verbose=1;
@@
-228,6
+230,18
@@
sub readnail () {
}
}
}
}
+our $oot_dir; # oot.dir or "Build"
+
+sub consider_oot () {
+ $oot_dir = cfgs qw(oot dir);
+ my $use = cfgs qw(oot use);
+ unless (defined($oot_dir) || defined($use)) {
+ $cargo_lock_update//=0;
+ return;
+ }
+ $oot_dir //= 'Build';
+}
+
our %manifests;
our %packagemap;
our %manifests;
our %packagemap;
@@
-302,33
+316,40
@@
sub calculate () {
}
}
}
}
-our @out_command;
+sub addargs () {
+ if (@ARGV>=2 &&
+ $ARGV[0] =~ m{\bcargo\b} &&
+ $ARGV[1] =~ m/generate-lockfile|update/) {
+ $cargo_lock_update //= 1;
+ } else {
+ $cargo_lock_update //= 0;
+ }
+ $cargo_manifest_args //=
+ (defined $oot_dir) && !$cargo_lock_update;
+
+ if ($cargo_manifest_args) {
+ push @ARGV, "--manifest-path=${src_absdir}/Cargo.toml",
+ qw(--locked --target-dir=target);
+ }
-our $oot_dir; # oot.dir or "Build"
-our $oot_absdir;
+our $oot_absdir;
our $build_absdir; # .../Build/<subdir>
our $build_absdir; # .../Build/<subdir>
-sub calculate_oot () {
- $oot_dir = cfgs qw(oot dir);
- my $use = cfgs qw(oot use);
- return unless defined($oot_dir) || defined($use);
- $oot_dir //= 'Build';
-
- if (@ARGV && $ARGV[0] =~ m/generate-lockfile|update/) {
- $oot_cargo_lock_faff = 1;
- }
+sub oot_massage_cmdline () {
+ return unless defined $oot_dir;
+ my $use = cfgs qw(oot use);
$oot_absdir = ($oot_dir !~ m{^/} ? "$worksphere/" : ""). $oot_dir;
$build_absdir = "$oot_absdir/$subdir";
my ($pre,$post);
my @xargs;
$oot_absdir = ($oot_dir !~ m{^/} ? "$worksphere/" : ""). $oot_dir;
$build_absdir = "$oot_absdir/$subdir";
my ($pre,$post);
my @xargs;
- if (!$
oot_cargo_lock_faff
) {
+ if (!$
cargo_lock_update
) {
push @xargs, $build_absdir;
($pre, $post) = ('cd "$1"; shift;', '');
} else {
push @xargs, $build_absdir;
($pre, $post) = ('cd "$1"; shift;', '');
} else {
- push @xargs, $
build
_absdir, $subdir, $src_absdir;
+ push @xargs, $
oot
_absdir, $subdir, $src_absdir;
($pre, $post) = (<<'END', <<'END');
cd "$1"; shift;
mkdir -p -- "$1"; cd "$1"; shift;
($pre, $post) = (<<'END', <<'END');
cd "$1"; shift;
mkdir -p -- "$1"; cd "$1"; shift;
@@
-494,12
+515,16
@@
while (@ARGV && $ARGV[0] =~ m/^-/) {
$noact++;
} elsif (s{^-D}{-}) {
$dump++;
$noact++;
} elsif (s{^-D}{-}) {
$dump++;
- } elsif (s{^-L}{-}) {
- $oot_cargo_lock_faff=1;
+ } elsif (s{^-([uU])}{-}) {
+ $cargo_lock_update= $1=~m/[A-Z]/;
+ } elsif (s{^-([mM])}{-}) {
+ $cargo_manifest_args= $1=~m/[A-Z]/;
} else {
die "$self: unknown short option(s) $_\n";
}
}
} else {
die "$self: unknown short option(s) $_\n";
}
}
+ } elsif (m{^--no-cargo-lock-update}) {
+ $cargo_lock_update=0;
} else {
die "$self: unknown long option $_\n";
}
} else {
die "$self: unknown long option $_\n";
}
@@
-509,6
+534,7
@@
die "$self: need command to run\n" unless @ARGV || $noact;
takelock();
readnail();
takelock();
readnail();
+consider_oot();
readorigs();
calculate();
calculate_oot();
readorigs();
calculate();
calculate_oot();