* Urgh.
This commit is contained in:
parent
eb86b6f5a5
commit
4213b8d8ec
|
@ -4,6 +4,9 @@ use strict;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use IO::Handle;
|
use IO::Handle;
|
||||||
|
|
||||||
|
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
||||||
|
|
||||||
|
|
||||||
STDOUT->autoflush(1);
|
STDOUT->autoflush(1);
|
||||||
|
|
||||||
my @remoteStoresAll = split ':', ($ENV{"NIX_OTHER_STORES"} or "");
|
my @remoteStoresAll = split ':', ($ENV{"NIX_OTHER_STORES"} or "");
|
||||||
|
@ -87,7 +90,7 @@ elsif ($ARGV[0] eq "--substitute") {
|
||||||
(my $infoFile, my $sourcePath) = findStorePath $storePath;
|
(my $infoFile, my $sourcePath) = findStorePath $storePath;
|
||||||
die unless $infoFile;
|
die unless $infoFile;
|
||||||
print "\n*** Copying `$storePath' from `$sourcePath'\n\n";
|
print "\n*** Copying `$storePath' from `$sourcePath'\n\n";
|
||||||
system("@bindir@/nix-store --dump $sourcePath | @bindir@/nix-store --restore $storePath") == 0
|
system("$binDir/nix-store --dump $sourcePath | $binDir/nix-store --restore $storePath") == 0
|
||||||
or die "cannot copy `$sourcePath' to `$storePath'";
|
or die "cannot copy `$sourcePath' to `$storePath'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ use readmanifest;
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
use File::Temp qw(tempdir);
|
use File::Temp qw(tempdir);
|
||||||
|
|
||||||
|
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
||||||
|
|
||||||
STDOUT->autoflush(1);
|
STDOUT->autoflush(1);
|
||||||
|
|
||||||
my $manifestDir = "@localstatedir@/nix/manifests";
|
my $manifestDir = "@localstatedir@/nix/manifests";
|
||||||
|
@ -98,7 +100,7 @@ foreach my $localPath (@{$localPathList}) {
|
||||||
my $sourcePath = $localPath->{copyFrom};
|
my $sourcePath = $localPath->{copyFrom};
|
||||||
if (-e $sourcePath) {
|
if (-e $sourcePath) {
|
||||||
print "\n*** Step 1/1: copying from $sourcePath\n";
|
print "\n*** Step 1/1: copying from $sourcePath\n";
|
||||||
system("@bindir@/nix-store --dump $sourcePath | @bindir@/nix-store --restore $targetPath") == 0
|
system("$binDir/nix-store --dump $sourcePath | $binDir/nix-store --restore $targetPath") == 0
|
||||||
or die "cannot copy `$sourcePath' to `$targetPath'";
|
or die "cannot copy `$sourcePath' to `$targetPath'";
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +149,7 @@ addToQueue $targetPath;
|
||||||
|
|
||||||
sub isValidPath {
|
sub isValidPath {
|
||||||
my $p = shift;
|
my $p = shift;
|
||||||
return system("@bindir@/nix-store --check-validity '$p' 2> /dev/null") == 0;
|
return system("$binDir/nix-store --check-validity '$p' 2> /dev/null") == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub parseHash {
|
sub parseHash {
|
||||||
|
@ -181,7 +183,7 @@ while ($queueFront < scalar @queue) {
|
||||||
my ($baseHashAlgo, $baseHash) = parseHash $patch->{baseHash};
|
my ($baseHashAlgo, $baseHash) = parseHash $patch->{baseHash};
|
||||||
my $format = "--base32";
|
my $format = "--base32";
|
||||||
$format = "" if $baseHashAlgo eq "md5";
|
$format = "" if $baseHashAlgo eq "md5";
|
||||||
my $hash = `@bindir@/nix-hash --type '$baseHashAlgo' $format "$patch->{basePath}"`;
|
my $hash = `$binDir/nix-hash --type '$baseHashAlgo' $format "$patch->{basePath}"`;
|
||||||
chomp $hash;
|
chomp $hash;
|
||||||
# print " MY HASH is $hash\n";
|
# print " MY HASH is $hash\n";
|
||||||
if ($hash ne $baseHash) {
|
if ($hash ne $baseHash) {
|
||||||
|
@ -263,7 +265,7 @@ sub downloadFile {
|
||||||
$ENV{"PRINT_PATH"} = 1;
|
$ENV{"PRINT_PATH"} = 1;
|
||||||
$ENV{"QUIET"} = 1;
|
$ENV{"QUIET"} = 1;
|
||||||
$ENV{"NIX_HASH_ALGO"} = $hashAlgo;
|
$ENV{"NIX_HASH_ALGO"} = $hashAlgo;
|
||||||
my ($hash2, $path) = `@bindir@/nix-prefetch-url '$url' '$hash'`;
|
my ($hash2, $path) = `$binDir/nix-prefetch-url '$url' '$hash'`;
|
||||||
die "download of `$url' failed" unless $? == 0;
|
die "download of `$url' failed" unless $? == 0;
|
||||||
chomp $hash2;
|
chomp $hash2;
|
||||||
chomp $path;
|
chomp $path;
|
||||||
|
@ -287,7 +289,7 @@ while (scalar @path > 0) {
|
||||||
# as a base to one or more patches. So turn the base path
|
# as a base to one or more patches. So turn the base path
|
||||||
# into a NAR archive, to which we can apply the patch.
|
# into a NAR archive, to which we can apply the patch.
|
||||||
print " packing base path...\n";
|
print " packing base path...\n";
|
||||||
system("@bindir@/nix-store --dump $v > $tmpNar") == 0
|
system("$binDir/nix-store --dump $v > $tmpNar") == 0
|
||||||
or die "cannot dump `$v'";
|
or die "cannot dump `$v'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,7 +317,7 @@ while (scalar @path > 0) {
|
||||||
# This was the last patch. Unpack the final NAR archive
|
# This was the last patch. Unpack the final NAR archive
|
||||||
# into the target path.
|
# into the target path.
|
||||||
print " unpacking patched archive...\n";
|
print " unpacking patched archive...\n";
|
||||||
system("@bindir@/nix-store --restore $v < $tmpNar2") == 0
|
system("$binDir/nix-store --restore $v < $tmpNar2") == 0
|
||||||
or die "cannot unpack $tmpNar2 into `$v'";
|
or die "cannot unpack $tmpNar2 into `$v'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,7 +339,7 @@ while (scalar @path > 0) {
|
||||||
} else {
|
} else {
|
||||||
# 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' | @bindir@/nix-store --restore '$v'") == 0
|
system("@bunzip2@ < '$narFilePath' | $binDir/nix-store --restore '$v'") == 0
|
||||||
or die "cannot unpack `$narFilePath' into `$v'";
|
or die "cannot unpack `$narFilePath' into `$v'";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
||||||
|
|
||||||
|
|
||||||
my $addDrvLink = 0;
|
my $addDrvLink = 0;
|
||||||
my $addOutLink = 1;
|
my $addOutLink = 1;
|
||||||
|
@ -124,7 +126,7 @@ foreach my $expr (@exprs) {
|
||||||
# Instantiate.
|
# Instantiate.
|
||||||
my @drvPaths;
|
my @drvPaths;
|
||||||
# !!! would prefer the perl 5.8.0 pipe open feature here.
|
# !!! would prefer the perl 5.8.0 pipe open feature here.
|
||||||
my $pid = open(DRVPATHS, "-|") || exec "@bindir@/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr;
|
my $pid = open(DRVPATHS, "-|") || exec "$binDir/nix-instantiate", "--add-root", $drvLink, "--indirect", @instArgs, $expr;
|
||||||
while (<DRVPATHS>) {chomp; push @drvPaths, $_;}
|
while (<DRVPATHS>) {chomp; push @drvPaths, $_;}
|
||||||
close DRVPATHS or exit 1;
|
close DRVPATHS or exit 1;
|
||||||
|
|
||||||
|
@ -135,7 +137,7 @@ foreach my $expr (@exprs) {
|
||||||
|
|
||||||
# Build.
|
# Build.
|
||||||
my @outPaths;
|
my @outPaths;
|
||||||
$pid = open(OUTPATHS, "-|") || exec "@bindir@/nix-store", "--add-root", $outLink, "--indirect", "-rv",
|
$pid = open(OUTPATHS, "-|") || exec "$binDir/nix-store", "--add-root", $outLink, "--indirect", "-rv",
|
||||||
@buildArgs, @drvPaths;
|
@buildArgs, @drvPaths;
|
||||||
while (<OUTPATHS>) {chomp; push @outPaths, $_;}
|
while (<OUTPATHS>) {chomp; push @outPaths, $_;}
|
||||||
close OUTPATHS or exit 1;
|
close OUTPATHS or exit 1;
|
||||||
|
|
|
@ -4,6 +4,8 @@ use strict;
|
||||||
|
|
||||||
my $profilesDir = "@localstatedir@/nix/profiles";
|
my $profilesDir = "@localstatedir@/nix/profiles";
|
||||||
|
|
||||||
|
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
||||||
|
|
||||||
|
|
||||||
# Process the command line arguments.
|
# Process the command line arguments.
|
||||||
my @args = ();
|
my @args = ();
|
||||||
|
@ -34,7 +36,7 @@ sub removeOldGenerations {
|
||||||
$name = $dir . "/" . $name;
|
$name = $dir . "/" . $name;
|
||||||
if (-l $name && (readlink($name) =~ /link/)) {
|
if (-l $name && (readlink($name) =~ /link/)) {
|
||||||
print STDERR "removing old generations of profile $name\n";
|
print STDERR "removing old generations of profile $name\n";
|
||||||
system("@bindir@/nix-env", "-p", $name, "--delete-generations", "old");
|
system("$binDir/nix-env", "-p", $name, "--delete-generations", "old");
|
||||||
}
|
}
|
||||||
elsif (! -l $name && -d $name) {
|
elsif (! -l $name && -d $name) {
|
||||||
removeOldGenerations $name;
|
removeOldGenerations $name;
|
||||||
|
@ -48,4 +50,4 @@ removeOldGenerations $profilesDir if $removeOld;
|
||||||
|
|
||||||
|
|
||||||
# Run the actual garbage collector.
|
# Run the actual garbage collector.
|
||||||
exec "@bindir@/nix-store", "--gc", @args;
|
exec "$binDir/nix-store", "--gc", @args;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#! @perl@ -w
|
#! @perl@ -w
|
||||||
|
|
||||||
my $binDir = $ENV{"NIX_BIN_DIR"};
|
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
||||||
$binDir = "@bindir@" unless defined $binDir;
|
|
||||||
|
|
||||||
|
|
||||||
if (scalar @ARGV < 1) {
|
if (scalar @ARGV < 1) {
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
use strict;
|
use strict;
|
||||||
use File::Temp qw(tempdir);
|
use File::Temp qw(tempdir);
|
||||||
|
|
||||||
|
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
||||||
|
|
||||||
|
|
||||||
sub usageError {
|
sub usageError {
|
||||||
print STDERR <<EOF;
|
print STDERR <<EOF;
|
||||||
|
@ -59,7 +61,7 @@ if ($interactive && !defined $ENV{"NIX_HAVE_TERMINAL"}) {
|
||||||
$ENV{"NIX_HAVE_TERMINAL"} = "1";
|
$ENV{"NIX_HAVE_TERMINAL"} = "1";
|
||||||
$ENV{"LD_LIBRARY_PATH"} = "";
|
$ENV{"LD_LIBRARY_PATH"} = "";
|
||||||
foreach my $term ("xterm", "konsole", "gnome-terminal", "xterm") {
|
foreach my $term ("xterm", "konsole", "gnome-terminal", "xterm") {
|
||||||
exec($term, "-e", "@bindir@/nix-install-package", @ARGV);
|
exec($term, "-e", "$binDir/nix-install-package", @ARGV);
|
||||||
}
|
}
|
||||||
die "cannot execute `xterm'";
|
die "cannot execute `xterm'";
|
||||||
}
|
}
|
||||||
|
@ -122,12 +124,12 @@ if ($interactive) {
|
||||||
|
|
||||||
|
|
||||||
print "\nPulling manifests...\n";
|
print "\nPulling manifests...\n";
|
||||||
system("@bindir@/nix-pull", $manifestURL) == 0
|
system("$binDir/nix-pull", $manifestURL) == 0
|
||||||
or barf "nix-pull failed: $?";
|
or barf "nix-pull failed: $?";
|
||||||
|
|
||||||
|
|
||||||
print "\nInstalling package...\n";
|
print "\nInstalling package...\n";
|
||||||
system("@bindir@/nix-env", "--install", $outPath, "--force-name", $drvName, @extraNixEnvArgs) == 0
|
system("$binDir/nix-env", "--install", $outPath, "--force-name", $drvName, @extraNixEnvArgs) == 0
|
||||||
or barf "nix-env failed: $?";
|
or barf "nix-env failed: $?";
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@ use readmanifest;
|
||||||
my $tmpDir = tempdir("nix-pull.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
my $tmpDir = tempdir("nix-pull.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
||||||
or die "cannot create a temporary directory";
|
or die "cannot create a temporary directory";
|
||||||
|
|
||||||
my $binDir = $ENV{"NIX_BIN_DIR"};
|
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
||||||
$binDir = "@bindir@" unless defined $binDir;
|
|
||||||
|
|
||||||
my $libexecDir = $ENV{"NIX_LIBEXEC_DIR"};
|
my $libexecDir = $ENV{"NIX_LIBEXEC_DIR"};
|
||||||
$libexecDir = "@libexecdir@" unless defined $libexecDir;
|
$libexecDir = "@libexecdir@" unless defined $libexecDir;
|
||||||
|
|
|
@ -16,8 +16,7 @@ my $curl = "@curl@ --fail --silent";
|
||||||
my $extraCurlFlags = ${ENV{'CURL_FLAGS'}};
|
my $extraCurlFlags = ${ENV{'CURL_FLAGS'}};
|
||||||
$curl = "$curl $extraCurlFlags" if defined $extraCurlFlags;
|
$curl = "$curl $extraCurlFlags" if defined $extraCurlFlags;
|
||||||
|
|
||||||
my $binDir = $ENV{"NIX_BIN_DIR"};
|
my $binDir = $ENV{"NIX_BIN_DIR"} || "@bindir@";
|
||||||
$binDir = "@bindir@" unless defined $binDir;
|
|
||||||
|
|
||||||
my $dataDir = $ENV{"NIX_DATA_DIR"};
|
my $dataDir = $ENV{"NIX_DATA_DIR"};
|
||||||
$dataDir = "@datadir@" unless defined $dataDir;
|
$dataDir = "@datadir@" unless defined $dataDir;
|
||||||
|
|
|
@ -65,6 +65,8 @@ for i in \
|
||||||
$NIX_BIN_DIR/nix/readmanifest.pm \
|
$NIX_BIN_DIR/nix/readmanifest.pm \
|
||||||
; do
|
; do
|
||||||
sed < $i > $i.tmp \
|
sed < $i > $i.tmp \
|
||||||
|
-e "s^$REAL_BIN_DIR/nix-store^$NIX_BIN_DIR/nix-store^" \
|
||||||
|
-e "s^$REAL_BIN_DIR/nix-hash^$NIX_BIN_DIR/nix-hash^" \
|
||||||
-e "s^$REAL_LIBEXEC_DIR^$NIX_LIBEXEC_DIR^" \
|
-e "s^$REAL_LIBEXEC_DIR^$NIX_LIBEXEC_DIR^" \
|
||||||
-e "s^$REAL_LOCALSTATE_DIR^$NIX_LOCALSTATE_DIR^" \
|
-e "s^$REAL_LOCALSTATE_DIR^$NIX_LOCALSTATE_DIR^" \
|
||||||
-e "s^$REAL_DATA_DIR^$NIX_DATA_DIR^" \
|
-e "s^$REAL_DATA_DIR^$NIX_DATA_DIR^" \
|
||||||
|
|
Loading…
Reference in a new issue