Warn about untrusted binary caches in extra-binary-caches

This commit is contained in:
Eelco Dolstra 2014-08-07 22:46:35 +02:00
parent 6e1f4c1488
commit 57695d8f76

View file

@ -237,7 +237,7 @@ sub getAvailableCaches {
my @untrustedUrls = strToList $Nix::Config::config{"untrusted-binary-caches"}; my @untrustedUrls = strToList $Nix::Config::config{"untrusted-binary-caches"};
@urls = (); @urls = ();
foreach my $url (@untrustedUrls) { foreach my $url (@untrustedUrls) {
die "binary cache $url is not trusted (please add it to trusted-binary-caches [@trustedUrls] in $Nix::Config::confDir/nix.conf)\n" die "binary cache $url is not trusted (please add it to trusted-binary-caches in $Nix::Config::confDir/nix.conf)\n"
unless scalar(grep { $url eq $_ } @trustedUrls) > 0; unless scalar(grep { $url eq $_ } @trustedUrls) > 0;
push @urls, $url; push @urls, $url;
} }
@ -245,7 +245,10 @@ sub getAvailableCaches {
my @untrustedUrls = strToList $Nix::Config::config{"untrusted-extra-binary-caches"} // ""; my @untrustedUrls = strToList $Nix::Config::config{"untrusted-extra-binary-caches"} // "";
foreach my $url (@untrustedUrls) { foreach my $url (@untrustedUrls) {
next unless scalar(grep { $url eq $_ } @trustedUrls) > 0; unless (scalar(grep { $url eq $_ } @trustedUrls) > 0) {
warn "binary cache $url is not trusted (please add it to trusted-binary-caches in $Nix::Config::confDir/nix.conf)\n";
next;
}
push @urls, $url; push @urls, $url;
} }