mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Update the other substituters
This commit is contained in:
parent
15c15da482
commit
f2bdc87595
3 changed files with 66 additions and 65 deletions
|
@ -36,42 +36,45 @@ sub findStorePath {
|
||||||
if ($ARGV[0] eq "--query") {
|
if ($ARGV[0] eq "--query") {
|
||||||
|
|
||||||
while (<STDIN>) {
|
while (<STDIN>) {
|
||||||
my $cmd = $_; chomp $cmd;
|
chomp;
|
||||||
|
my ($cmd, @args) = split " ", $_;
|
||||||
|
|
||||||
if ($cmd eq "have") {
|
if ($cmd eq "have") {
|
||||||
my $storePath = <STDIN>; chomp $storePath;
|
foreach my $storePath (@args) {
|
||||||
print STDOUT (defined findStorePath($storePath) ? "1\n" : "0\n");
|
print "$storePath\n" if defined findStorePath($storePath);
|
||||||
|
}
|
||||||
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($cmd eq "info") {
|
elsif ($cmd eq "info") {
|
||||||
my $storePath = <STDIN>; chomp $storePath;
|
foreach my $storePath (@args) {
|
||||||
my ($store, $sourcePath) = findStorePath($storePath);
|
my ($store, $sourcePath) = findStorePath($storePath);
|
||||||
if (!defined $store) {
|
next unless defined $store;
|
||||||
print "0\n";
|
|
||||||
next; # not an error
|
$ENV{"NIX_DB_DIR"} = "$store/var/nix/db";
|
||||||
|
|
||||||
|
my $deriver = `@bindir@/nix-store --query --deriver $storePath`;
|
||||||
|
die "cannot query deriver of `$storePath'" if $? != 0;
|
||||||
|
chomp $deriver;
|
||||||
|
$deriver = "" if $deriver eq "unknown-deriver";
|
||||||
|
|
||||||
|
my @references = split "\n",
|
||||||
|
`@bindir@/nix-store --query --references $storePath`;
|
||||||
|
die "cannot query references of `$storePath'" if $? != 0;
|
||||||
|
|
||||||
|
my $narSize = `@bindir@/nix-store --query --size $storePath`;
|
||||||
|
die "cannot query size of `$storePath'" if $? != 0;
|
||||||
|
chomp $narSize;
|
||||||
|
|
||||||
|
print "$storePath\n";
|
||||||
|
print "$deriver\n";
|
||||||
|
print scalar @references, "\n";
|
||||||
|
print "$_\n" foreach @references;
|
||||||
|
print "$narSize\n";
|
||||||
|
print "$narSize\n";
|
||||||
}
|
}
|
||||||
print "1\n";
|
|
||||||
|
|
||||||
$ENV{"NIX_DB_DIR"} = "$store/var/nix/db";
|
print "\n";
|
||||||
|
|
||||||
my $deriver = `@bindir@/nix-store --query --deriver $storePath`;
|
|
||||||
die "cannot query deriver of `$storePath'" if $? != 0;
|
|
||||||
chomp $deriver;
|
|
||||||
$deriver = "" if $deriver eq "unknown-deriver";
|
|
||||||
|
|
||||||
my @references = split "\n",
|
|
||||||
`@bindir@/nix-store --query --references $storePath`;
|
|
||||||
die "cannot query references of `$storePath'" if $? != 0;
|
|
||||||
|
|
||||||
my $narSize = `@bindir@/nix-store --query --size $storePath`;
|
|
||||||
die "cannot query size of `$storePath'" if $? != 0;
|
|
||||||
chomp $narSize;
|
|
||||||
|
|
||||||
print "$deriver\n";
|
|
||||||
print scalar @references, "\n";
|
|
||||||
print "$_\n" foreach @references;
|
|
||||||
print "$narSize\n";
|
|
||||||
print "$narSize\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else { die "unknown command `$cmd'"; }
|
else { die "unknown command `$cmd'"; }
|
||||||
|
|
|
@ -173,56 +173,54 @@ sub computeSmallestDownload {
|
||||||
if ($ARGV[0] eq "--query") {
|
if ($ARGV[0] eq "--query") {
|
||||||
|
|
||||||
while (<STDIN>) {
|
while (<STDIN>) {
|
||||||
my $cmd = $_; chomp $cmd;
|
chomp;
|
||||||
|
my ($cmd, @args) = split " ", $_;
|
||||||
|
|
||||||
if ($cmd eq "have") {
|
if ($cmd eq "have") {
|
||||||
my $storePath = <STDIN>; chomp $storePath;
|
foreach my $storePath (@args) {
|
||||||
print STDOUT (
|
print "$storePath\n" if scalar @{$dbh->selectcol_arrayref("select 1 from NARs where storePath = ?", {}, $storePath)} > 0;
|
||||||
scalar @{$dbh->selectcol_arrayref("select 1 from NARs where storePath = ?", {}, $storePath)} > 0
|
}
|
||||||
? "1\n" : "0\n");
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif ($cmd eq "info") {
|
elsif ($cmd eq "info") {
|
||||||
my $storePath = <STDIN>; chomp $storePath;
|
foreach my $storePath (@args) {
|
||||||
|
|
||||||
my $infos = $dbh->selectall_arrayref(
|
my $infos = $dbh->selectall_arrayref(
|
||||||
"select * from NARs where storePath = ?",
|
"select * from NARs where storePath = ?",
|
||||||
{ Slice => {} }, $storePath);
|
{ Slice => {} }, $storePath);
|
||||||
|
|
||||||
my $info;
|
next unless scalar @{$infos} > 0;
|
||||||
if (scalar @{$infos} > 0) {
|
my $info = @{$infos}[0];
|
||||||
$info = @{$infos}[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
print "0\n";
|
|
||||||
next; # not an error
|
|
||||||
}
|
|
||||||
|
|
||||||
print "1\n";
|
print "$storePath\n";
|
||||||
print "$info->{deriver}\n";
|
print "$info->{deriver}\n";
|
||||||
my @references = split " ", $info->{refs};
|
my @references = split " ", $info->{refs};
|
||||||
print scalar @references, "\n";
|
print scalar @references, "\n";
|
||||||
print "$_\n" foreach @references;
|
print "$_\n" foreach @references;
|
||||||
|
|
||||||
my @path = computeSmallestDownload $storePath;
|
my @path = computeSmallestDownload $storePath;
|
||||||
|
|
||||||
my $downloadSize = 0;
|
my $downloadSize = 0;
|
||||||
while (scalar @path > 0) {
|
while (scalar @path > 0) {
|
||||||
my $edge = pop @path;
|
my $edge = pop @path;
|
||||||
my $u = $edge->{start};
|
my $u = $edge->{start};
|
||||||
my $v = $edge->{end};
|
my $v = $edge->{end};
|
||||||
if ($edge->{type} eq "patch") {
|
if ($edge->{type} eq "patch") {
|
||||||
$downloadSize += $edge->{info}->{size} || 0;
|
$downloadSize += $edge->{info}->{size} || 0;
|
||||||
}
|
}
|
||||||
elsif ($edge->{type} eq "narfile") {
|
elsif ($edge->{type} eq "narfile") {
|
||||||
$downloadSize += $edge->{info}->{size} || 0;
|
$downloadSize += $edge->{info}->{size} || 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "$downloadSize\n";
|
||||||
|
|
||||||
|
my $narSize = $info->{narSize} || 0;
|
||||||
|
print "$narSize\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "$downloadSize\n";
|
print "\n";
|
||||||
|
|
||||||
my $narSize = $info->{narSize} || 0;
|
|
||||||
print "$narSize\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else { die "unknown command `$cmd'"; }
|
else { die "unknown command `$cmd'"; }
|
||||||
|
|
|
@ -155,8 +155,8 @@ void setDefaultsFromEnvironment()
|
||||||
|
|
||||||
string subs = getEnv("NIX_SUBSTITUTERS", "default");
|
string subs = getEnv("NIX_SUBSTITUTERS", "default");
|
||||||
if (subs == "default") {
|
if (subs == "default") {
|
||||||
//substituters.push_back(nixLibexecDir + "/nix/substituters/copy-from-other-stores.pl");
|
substituters.push_back(nixLibexecDir + "/nix/substituters/copy-from-other-stores.pl");
|
||||||
//substituters.push_back(nixLibexecDir + "/nix/substituters/download-using-manifests.pl");
|
substituters.push_back(nixLibexecDir + "/nix/substituters/download-using-manifests.pl");
|
||||||
substituters.push_back(nixLibexecDir + "/nix/substituters/download-from-binary-cache.pl");
|
substituters.push_back(nixLibexecDir + "/nix/substituters/download-from-binary-cache.pl");
|
||||||
} else
|
} else
|
||||||
substituters = tokenizeString(subs, ":");
|
substituters = tokenizeString(subs, ":");
|
||||||
|
|
Loading…
Reference in a new issue