mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 22:16:16 +02:00
* Fix handling of chained patches: don't skip patches if intermediate
paths are missing, etc.
This commit is contained in:
parent
581bcb986f
commit
3745cecc6a
1 changed files with 20 additions and 13 deletions
|
@ -67,6 +67,12 @@ sub addEdge {
|
||||||
|
|
||||||
addToQueue $targetPath;
|
addToQueue $targetPath;
|
||||||
|
|
||||||
|
sub isValidPath {
|
||||||
|
my $p = shift;
|
||||||
|
system "nix-store --isvalid '$p' 2> /dev/null";
|
||||||
|
return $? == 0;
|
||||||
|
}
|
||||||
|
|
||||||
while ($queueFront < scalar @queue) {
|
while ($queueFront < scalar @queue) {
|
||||||
my $u = $queue[$queueFront++];
|
my $u = $queue[$queueFront++];
|
||||||
print "$u\n";
|
print "$u\n";
|
||||||
|
@ -75,8 +81,7 @@ while ($queueFront < scalar @queue) {
|
||||||
|
|
||||||
# If the path already exists, it has distance 0 from the "start"
|
# If the path already exists, it has distance 0 from the "start"
|
||||||
# node.
|
# node.
|
||||||
system "nix-store --isvalid '$u' 2> /dev/null";
|
if (isValidPath($u)) {
|
||||||
if ($? == 0) {
|
|
||||||
addEdge "start", $u, 0, "present", undef;
|
addEdge "start", $u, 0, "present", undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,13 +90,15 @@ while ($queueFront < scalar @queue) {
|
||||||
# Add patch edges.
|
# Add patch edges.
|
||||||
my $patchList = $patches{$u};
|
my $patchList = $patches{$u};
|
||||||
foreach my $patch (@{$patchList}) {
|
foreach my $patch (@{$patchList}) {
|
||||||
# !!! this should be cached
|
if (isValidPath($patch->{basePath})) {
|
||||||
my $hash = `nix-hash "$patch->{basePath}"`;
|
# !!! this should be cached
|
||||||
chomp $hash;
|
my $hash = `nix-hash "$patch->{basePath}"`;
|
||||||
print " MY HASH is $hash\n";
|
chomp $hash;
|
||||||
if ($hash ne $patch->{baseHash}) {
|
print " MY HASH is $hash\n";
|
||||||
print " REJECTING PATCH from $patch->{basePath}\n";
|
if ($hash ne $patch->{baseHash}) {
|
||||||
next;
|
print " REJECTING PATCH from $patch->{basePath}\n";
|
||||||
|
next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print " PATCH from $patch->{basePath}\n";
|
print " PATCH from $patch->{basePath}\n";
|
||||||
addToQueue $patch->{basePath};
|
addToQueue $patch->{basePath};
|
||||||
|
@ -206,8 +213,8 @@ while (scalar @path > 0) {
|
||||||
|
|
||||||
# Unpack the resulting NAR archive into the target path.
|
# Unpack the resulting NAR archive into the target path.
|
||||||
print " unpacking patched archive...\n";
|
print " unpacking patched archive...\n";
|
||||||
system "nix-store --restore $targetPath < /tmp/nar2";
|
system "nix-store --restore $v < /tmp/nar2";
|
||||||
die "cannot unpack /tmp/nar2 into `$targetPath'" if ($? != 0);
|
die "cannot unpack /tmp/nar2 into `$v'" if ($? != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($edge->{type} eq "narfile") {
|
elsif ($edge->{type} eq "narfile") {
|
||||||
|
@ -222,8 +229,8 @@ while (scalar @path > 0) {
|
||||||
|
|
||||||
# Unpack the archive into the target path.
|
# Unpack the archive into the target path.
|
||||||
print " unpacking archive...\n";
|
print " unpacking archive...\n";
|
||||||
system "bunzip2 < '$narFilePath' | nix-store --restore '$targetPath'";
|
system "bunzip2 < '$narFilePath' | nix-store --restore '$v'";
|
||||||
die "cannot unpack `$narFilePath' into `$targetPath'" if ($? != 0);
|
die "cannot unpack `$narFilePath' into `$v'" if ($? != 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue