Update the other substituters

This commit is contained in:
Eelco Dolstra 2012-07-11 18:52:09 -04:00
parent 15c15da482
commit f2bdc87595
3 changed files with 66 additions and 65 deletions

View file

@ -36,21 +36,20 @@ sub findStorePath {
if ($ARGV[0] eq "--query") {
while (<STDIN>) {
my $cmd = $_; chomp $cmd;
chomp;
my ($cmd, @args) = split " ", $_;
if ($cmd eq "have") {
my $storePath = <STDIN>; chomp $storePath;
print STDOUT (defined findStorePath($storePath) ? "1\n" : "0\n");
foreach my $storePath (@args) {
print "$storePath\n" if defined findStorePath($storePath);
}
print "\n";
}
elsif ($cmd eq "info") {
my $storePath = <STDIN>; chomp $storePath;
foreach my $storePath (@args) {
my ($store, $sourcePath) = findStorePath($storePath);
if (!defined $store) {
print "0\n";
next; # not an error
}
print "1\n";
next unless defined $store;
$ENV{"NIX_DB_DIR"} = "$store/var/nix/db";
@ -67,6 +66,7 @@ if ($ARGV[0] eq "--query") {
die "cannot query size of `$storePath'" if $? != 0;
chomp $narSize;
print "$storePath\n";
print "$deriver\n";
print scalar @references, "\n";
print "$_\n" foreach @references;
@ -74,6 +74,9 @@ if ($ARGV[0] eq "--query") {
print "$narSize\n";
}
print "\n";
}
else { die "unknown command `$cmd'"; }
}
}

View file

@ -173,32 +173,27 @@ sub computeSmallestDownload {
if ($ARGV[0] eq "--query") {
while (<STDIN>) {
my $cmd = $_; chomp $cmd;
chomp;
my ($cmd, @args) = split " ", $_;
if ($cmd eq "have") {
my $storePath = <STDIN>; chomp $storePath;
print STDOUT (
scalar @{$dbh->selectcol_arrayref("select 1 from NARs where storePath = ?", {}, $storePath)} > 0
? "1\n" : "0\n");
foreach my $storePath (@args) {
print "$storePath\n" if scalar @{$dbh->selectcol_arrayref("select 1 from NARs where storePath = ?", {}, $storePath)} > 0;
}
print "\n";
}
elsif ($cmd eq "info") {
my $storePath = <STDIN>; chomp $storePath;
foreach my $storePath (@args) {
my $infos = $dbh->selectall_arrayref(
"select * from NARs where storePath = ?",
{ Slice => {} }, $storePath);
my $info;
if (scalar @{$infos} > 0) {
$info = @{$infos}[0];
}
else {
print "0\n";
next; # not an error
}
next unless scalar @{$infos} > 0;
my $info = @{$infos}[0];
print "1\n";
print "$storePath\n";
print "$info->{deriver}\n";
my @references = split " ", $info->{refs};
print scalar @references, "\n";
@ -225,6 +220,9 @@ if ($ARGV[0] eq "--query") {
print "$narSize\n";
}
print "\n";
}
else { die "unknown command `$cmd'"; }
}

View file

@ -155,8 +155,8 @@ void setDefaultsFromEnvironment()
string subs = getEnv("NIX_SUBSTITUTERS", "default");
if (subs == "default") {
//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/copy-from-other-stores.pl");
substituters.push_back(nixLibexecDir + "/nix/substituters/download-using-manifests.pl");
substituters.push_back(nixLibexecDir + "/nix/substituters/download-from-binary-cache.pl");
} else
substituters = tokenizeString(subs, ":");