* nix-build: put the temporary derivation symlink in a temporary
directory rather than the current directory. * nix-build: --drv-link now implies --add-drv-link.
This commit is contained in:
parent
7ae763e16b
commit
2a3f4110c5
3 changed files with 27 additions and 54 deletions
|
@ -2,14 +2,9 @@
|
|||
|
||||
use strict;
|
||||
use Nix::Config;
|
||||
use File::Temp qw(tempdir);
|
||||
|
||||
|
||||
my $addDrvLink = 0;
|
||||
my $addOutLink = 1;
|
||||
|
||||
my $outLink;
|
||||
my $drvLink;
|
||||
|
||||
my $dryRun = 0;
|
||||
my $verbose = 0;
|
||||
|
||||
|
@ -18,17 +13,14 @@ my @buildArgs = ();
|
|||
my @exprs = ();
|
||||
|
||||
|
||||
END {
|
||||
foreach my $fn (glob ".nix-build-tmp-*") {
|
||||
unlink $fn;
|
||||
}
|
||||
}
|
||||
my $tmpDir = tempdir("nix-build.XXXXXX", CLEANUP => 1, TMPDIR => 1)
|
||||
or die "cannot create a temporary directory";
|
||||
|
||||
sub intHandler {
|
||||
exit 1;
|
||||
}
|
||||
my $outLink = "./result";
|
||||
my $drvLink = "$tmpDir/derivation";
|
||||
|
||||
$SIG{'INT'} = 'intHandler';
|
||||
# Ensure that the $tmpDir is deleted.
|
||||
$SIG{'INT'} = sub { exit 1 };
|
||||
|
||||
|
||||
for (my $n = 0; $n < scalar @ARGV; $n++) {
|
||||
|
@ -56,11 +48,11 @@ EOF
|
|||
}
|
||||
|
||||
elsif ($arg eq "--add-drv-link") {
|
||||
$addDrvLink = 1;
|
||||
$drvLink = "./derivation";
|
||||
}
|
||||
|
||||
elsif ($arg eq "--no-out-link" or $arg eq "--no-link") {
|
||||
$addOutLink = 0;
|
||||
$outLink = "$tmpDir/result";
|
||||
}
|
||||
|
||||
elsif ($arg eq "--drv-link") {
|
||||
|
@ -139,17 +131,6 @@ EOF
|
|||
@exprs = ("./default.nix") if scalar @exprs == 0;
|
||||
|
||||
|
||||
if (!defined $drvLink) {
|
||||
$drvLink = "derivation";
|
||||
$drvLink = ".nix-build-tmp-" . $drvLink if !$addDrvLink;
|
||||
}
|
||||
|
||||
if (!defined $outLink) {
|
||||
$outLink = "result";
|
||||
$outLink = ".nix-build-tmp-" . $outLink if !$addOutLink;
|
||||
}
|
||||
|
||||
|
||||
foreach my $expr (@exprs) {
|
||||
|
||||
# Instantiate.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue