1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 03:23:16 +02:00

Use proper quotes everywhere

This commit is contained in:
Eelco Dolstra 2014-08-20 17:00:17 +02:00
parent 373fad75e1
commit 11849a320e
54 changed files with 548 additions and 543 deletions

View file

@ -31,7 +31,7 @@ sub readConfig {
my $config = "$confDir/nix.conf";
return unless -f $config;
open CONFIG, "<$config" or die "cannot open `$config'";
open CONFIG, "<$config" or die "cannot open $config";
while (<CONFIG>) {
/^\s*([\w\-\.]+)\s*=\s*(.*)$/ or next;
$config{$1} = $2;

View file

@ -1,5 +1,6 @@
package Nix::CopyClosure;
use utf8;
use strict;
use Nix::Config;
use Nix::Store;
@ -41,7 +42,7 @@ sub copyToOpen {
# Send the "import paths" command.
syswrite($to, pack("L<x4", 4)) or die;
exportPaths(fileno($to), $sign, @missing);
readInt($from) == 1 or die "remote machine \`$sshHost' failed to import closure\n";
readInt($from) == 1 or die "remote machine $sshHost failed to import closure\n";
}
@ -105,7 +106,7 @@ sub oldCopyTo {
unless ($dryRun) {
open SSH, "| ssh $sshHost @{$sshOpts} @globalSshOpts 'nix-store --import' > /dev/null" or die;
exportPaths(fileno(SSH), $sign, @missing);
close SSH or die "copying store paths to remote machine `$sshHost' failed: $?";
close SSH or die "copying store paths to remote machine $sshHost failed: $?";
}
}
}

View file

@ -1,5 +1,6 @@
package Nix::Manifest;
use utf8;
use strict;
use DBI;
use DBD::SQLite;
@ -58,10 +59,10 @@ sub readManifest_ {
# Decompress the manifest if necessary.
if ($manifest =~ /\.bz2$/) {
open MANIFEST, "$Nix::Config::bzip2 -d < $manifest |"
or die "cannot decompress `$manifest': $!";
or die "cannot decompress $manifest: $!";
} else {
open MANIFEST, "<$manifest"
or die "cannot open `$manifest': $!";
or die "cannot open $manifest: $!";
}
my $inside = 0;
@ -239,7 +240,7 @@ sub updateManifestDB {
# Open/create the database.
our $dbh = DBI->connect("dbi:SQLite:dbname=$dbPath", "", "")
or die "cannot open database `$dbPath'";
or die "cannot open database $dbPath";
$dbh->{RaiseError} = 1;
$dbh->{PrintError} = 0;
@ -354,10 +355,10 @@ EOF
my $version = readManifest_($manifest, \&addNARToDB, \&addPatchToDB);
if ($version < 3) {
die "you have an old-style or corrupt manifest `$manifestLink'; please delete it\n";
die "you have an old-style or corrupt manifest $manifestLink; please delete it\n";
}
if ($version >= 10) {
die "manifest `$manifestLink' is too new; please delete it or upgrade Nix\n";
die "manifest $manifestLink is too new; please delete it or upgrade Nix\n";
}
}
@ -434,27 +435,27 @@ sub parseNARInfo {
if ($requireValidSig) {
if (!defined $sig) {
warn "NAR info file `$location' lacks a signature; ignoring\n";
warn "NAR info file $location lacks a signature; ignoring\n";
return undef;
}
my ($sigVersion, $keyName, $sig64) = split ";", $sig;
$sigVersion //= 0;
if ($sigVersion != 1) {
warn "NAR info file `$location' has unsupported version $sigVersion; ignoring\n";
warn "NAR info file $location has unsupported version $sigVersion; ignoring\n";
return undef;
}
return undef unless defined $keyName && defined $sig64;
my $publicKeyFile = $Nix::Config::config{"binary-cache-public-key-$keyName"};
if (!defined $publicKeyFile) {
warn "NAR info file `$location' is signed by unknown key `$keyName'; ignoring\n";
warn "NAR info file $location is signed by unknown key $keyName; ignoring\n";
return undef;
}
if (! -f $publicKeyFile) {
die "binary cache public key file `$publicKeyFile' does not exist\n";
die "binary cache public key file $publicKeyFile does not exist\n";
return undef;
}
if (!isValidSignature($publicKeyFile, $sig64, $signedData)) {
warn "NAR info file `$location' has an invalid signature; ignoring\n";
warn "NAR info file $location has an invalid signature; ignoring\n";
return undef;
}
$res->{signedBy} = $keyName;

View file

@ -1,5 +1,6 @@
package Nix::Utils;
use utf8;
use File::Temp qw(tempdir);
our @ISA = qw(Exporter);
@ -25,7 +26,7 @@ sub uniq {
sub writeFile {
my ($fn, $s) = @_;
open TMP, ">$fn" or die "cannot create file `$fn': $!";
open TMP, ">$fn" or die "cannot create file $fn: $!";
print TMP "$s" or die;
close TMP or die;
}
@ -33,7 +34,7 @@ sub writeFile {
sub readFile {
local $/ = undef;
my ($fn) = @_;
open TMP, "<$fn" or die "cannot open file `$fn': $!";
open TMP, "<$fn" or die "cannot open file $fn: $!";
my $s = <TMP>;
close TMP or die;
return $s;