chiark / gitweb /
nailing-cargo: Spot an obvious mistake
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 17 Jun 2020 23:51:46 +0000 (00:51 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 17 Jun 2020 23:51:46 +0000 (00:51 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
nailing-cargo

index 31eefe780dbc2af33d07181686aa525fd9dfbde0..65116123abbdc9215b1432724329558f1e786454 100755 (executable)
@@ -710,7 +710,18 @@ sub nailed ($) {
 }    
 
 sub install () {
+  my @our_unfound_stab = stat_exists('Cargo.toml', 'local Cargo.toml')
+    ? (stat _) : ();
   foreach my $mf (keys %manifests) {
+    if (@our_unfound_stab) {
+      if (stat_exists $mf, "manifest in to-be-nailed directory") {
+       my @mf_stab = stat _ ;
+       if ("@mf_stab[0..1]" eq "@our_unfound_stab[0..1]") {
+         @our_unfound_stab = ();
+       }
+      }
+    }
+
     my $nailing = "$mf.nailing~";
     my $nailed = nailed($mf);
     my ($use, $rm);
@@ -733,6 +744,11 @@ sub install () {
     unlink_or_enoent $rm or die "$self: remove old $rm: $!\n";
     print STDERR "$self: nailed $mf\n" if $verbose>=3;
   }
+
+  if (@our_unfound_stab) {
+    print STDERR
+ "$self: *WARNING* cwd is not in Cargo.nail thbough it has Cargo.toml!\n";
+  }
 }
 
 sub invoke () {