diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-09-25T10·44+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-09-25T10·44+0000 |
commit | 68ae953d8a492061bcda7c4d7bf2f5b9432f791c (patch) | |
tree | d5e35a4fe76bf043539d8a49bb00e9e220fa364c /scripts | |
parent | 76c971009149f73453ccec66392625f2b67f8785 (diff) |
* Clean up calls to system().
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/download-using-manifests.pl.in | 22 | ||||
-rw-r--r-- | scripts/nix-channel.in | 12 | ||||
-rw-r--r-- | scripts/nix-collect-garbage.in | 2 | ||||
-rw-r--r-- | scripts/nix-install-package.in | 8 | ||||
-rw-r--r-- | scripts/nix-pack-closure.in | 2 | ||||
-rw-r--r-- | scripts/nix-pull.in | 2 | ||||
-rw-r--r-- | scripts/nix-push.in | 2 | ||||
-rw-r--r-- | scripts/nix-unpack-closure.in | 2 |
8 files changed, 26 insertions, 26 deletions
diff --git a/scripts/download-using-manifests.pl.in b/scripts/download-using-manifests.pl.in index 382eb7c3ae4d..5dd5b817afda 100644 --- a/scripts/download-using-manifests.pl.in +++ b/scripts/download-using-manifests.pl.in @@ -90,8 +90,7 @@ addToQueue $targetPath; sub isValidPath { my $p = shift; - system "@bindir@/nix-store --check-validity '$p' 2> /dev/null"; - return $? == 0; + return system("@bindir@/nix-store --check-validity '$p' 2> /dev/null") == 0; } sub parseHash { @@ -231,8 +230,8 @@ while (scalar @path > 0) { # as a base to one or more patches. So turn the base path # into a NAR archive, to which we can apply the patch. print " packing base path...\n"; - system "@bindir@/nix-store --dump $v > $tmpNar"; - die "cannot dump `$v'" if ($? != 0); + system("@bindir@/nix-store --dump $v > $tmpNar") == 0 + or die "cannot dump `$v'"; } } @@ -249,8 +248,8 @@ while (scalar @path > 0) { # Apply the patch to the NAR archive produced in step 1 (for # the already present path) or a later step (for patch sequences). print " applying patch...\n"; - system "@libexecdir@/bspatch $tmpNar $tmpNar2 $patchPath"; - die "cannot apply patch `$patchPath' to $tmpNar" if ($? != 0); + system("@libexecdir@/bspatch $tmpNar $tmpNar2 $patchPath") == 0 + or die "cannot apply patch `$patchPath' to $tmpNar"; if ($curStep < $maxStep) { # The archive will be used as the base of the next patch. @@ -259,8 +258,8 @@ while (scalar @path > 0) { # This was the last patch. Unpack the final NAR archive # into the target path. print " unpacking patched archive...\n"; - system "@bindir@/nix-store --restore $v < $tmpNar2"; - die "cannot unpack $tmpNar2 into `$v'" if ($? != 0); + system("@bindir@/nix-store --restore $v < $tmpNar2") == 0 + or die "cannot unpack $tmpNar2 into `$v'"; } } @@ -276,12 +275,13 @@ while (scalar @path > 0) { if ($curStep < $maxStep) { # The archive will be used a base to a patch. - system "@bunzip2@ < '$narFilePath' > $tmpNar"; + system("@bunzip2@ < '$narFilePath' > $tmpNar") == 0 + or die "cannot unpack `$narFilePath' into `$v'"; } else { # Unpack the archive into the target path. print " unpacking archive...\n"; - system "@bunzip2@ < '$narFilePath' | @bindir@/nix-store --restore '$v'"; - die "cannot unpack `$narFilePath' into `$v'" if ($? != 0); + system("@bunzip2@ < '$narFilePath' | @bindir@/nix-store --restore '$v'") == 0 + or die "cannot unpack `$narFilePath' into `$v'"; } } diff --git a/scripts/nix-channel.in b/scripts/nix-channel.in index 63a56616b130..19b012922bca 100644 --- a/scripts/nix-channel.in +++ b/scripts/nix-channel.in @@ -70,8 +70,8 @@ sub update { readChannels; # Get rid of all the old substitutes. - system "@bindir@/nix-store --clear-substitutes"; - die "cannot clear substitutes" if ($? != 0); + system("@bindir@/nix-store", "--clear-substitutes") == 0 + or die "cannot clear substitutes"; # Remove all the old manifests. for my $manifest (glob "$stateDir/manifests/*.nixmanifest") { @@ -81,8 +81,8 @@ sub update { # Pull cache manifests. foreach my $url (@channels) { print "pulling cache manifest from `$url'\n"; - system "@bindir@/nix-pull '$url'/MANIFEST"; - die "cannot pull cache manifest from `$url'" if ($? != 0); + system("@bindir@/nix-pull", "$url/MANIFEST") == 0 + or die "cannot pull cache manifest from `$url'"; } # Create a Nix expression that fetches and unpacks the channel Nix @@ -122,8 +122,8 @@ sub update { unlink "$rootFile.tmp"; # Make it the default Nix expression for `nix-env'. - system "@bindir@/nix-env --import '$outPath'"; - die "cannot pull set default Nix expression to `$outPath'" if ($? != 0); + system("@bindir@/nix-env", "--import", "$outPath") == 0 + or die "cannot pull set default Nix expression to `$outPath'"; } diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in index 81975d2d3c4d..f1ea09b8ee93 100644 --- a/scripts/nix-collect-garbage.in +++ b/scripts/nix-collect-garbage.in @@ -29,7 +29,7 @@ if ($removeOld) { $name = $profilesDir . "/" . $name; if (-l $name && (readlink($name) =~ /link/)) { 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"); } } diff --git a/scripts/nix-install-package.in b/scripts/nix-install-package.in index 4f5b0087fee3..35f6d6824838 100644 --- a/scripts/nix-install-package.in +++ b/scripts/nix-install-package.in @@ -68,7 +68,7 @@ if ($interactive && !defined $ENV{"NIX_HAVE_TERMINAL"}) { my $tmpDir; do { $tmpDir = tmpnam(); } until mkdir $tmpDir, 0777; -END { if (defined $tmpDir) { my $x = $?; system ("@coreutils@/rm", "-rf", $tmpDir); $? = $x; } } +END { if (defined $tmpDir) { my $x = $?; system("@coreutils@/rm", "-rf", $tmpDir); $? = $x; } } sub barf { @@ -83,7 +83,7 @@ sub barf { my $pkgFile = $source; if ($fromURL) { $pkgFile = "$tmpDir/tmp.nixpkg"; - system ("@curl@", "--silent", $source, "-o", $pkgFile) == 0 + system("@curl@", "--silent", $source, "-o", $pkgFile) == 0 or barf "curl failed: $?"; } @@ -124,12 +124,12 @@ if ($interactive) { print "\nPulling manifests...\n"; -system ("@bindir@/nix-pull", $manifestURL) == 0 +system("@bindir@/nix-pull", $manifestURL) == 0 or barf "nix-pull failed: $?"; print "\nInstalling package...\n"; -system ("@bindir@/nix-env", "--install", $outPath, @extraNixEnvArgs) == 0 +system("@bindir@/nix-env", "--install", $outPath, @extraNixEnvArgs) == 0 or barf "nix-env failed: $?"; diff --git a/scripts/nix-pack-closure.in b/scripts/nix-pack-closure.in index a29f12021525..ebf7164075cb 100644 --- a/scripts/nix-pack-closure.in +++ b/scripts/nix-pack-closure.in @@ -17,7 +17,7 @@ $binDir = "@bindir@" unless defined $binDir; my $tmpDir; do { $tmpDir = tmpnam(); } until mkdir $tmpDir, 0777; -END { my $x = $?; system ("@coreutils@/rm", "-rf", $tmpDir); $? = $x; } +END { my $x = $?; system("@coreutils@/rm", "-rf", $tmpDir); $? = $x; } mkdir "$tmpDir/contents", 0777 or die; mkdir "$tmpDir/references", 0777 or die; mkdir "$tmpDir/derivers", 0777 or die; diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index 67a7838f19f0..0af036f6f302 100644 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -56,7 +56,7 @@ sub processURL { my $finalPath = "$stateDir/manifests/$baseName-$hash.nixmanifest"; - system("mv -f '$manifest' '$finalPath'") == 0 + system ("@coreutils@/mv", "-f", "$manifest", "$finalPath") == 0 or die "cannot move `$manifest' to `$finalPath"; } diff --git a/scripts/nix-push.in b/scripts/nix-push.in index f11cd1f46f83..02b1dec482a3 100644 --- a/scripts/nix-push.in +++ b/scripts/nix-push.in @@ -227,7 +227,7 @@ writeManifest $manifest, \%narFiles, \%patches; sub copyFile { my $src = shift; my $dst = shift; - system("cp '$src' '$dst.tmp'") == 0 or die "cannot copy file"; + system("@coreutils@/cp", $src, "$dst.tmp") == 0 or die "cannot copy file"; rename("$dst.tmp", "$dst") or die "cannot rename file"; } diff --git a/scripts/nix-unpack-closure.in b/scripts/nix-unpack-closure.in index 01e8ee30d2e9..20fdef7594d2 100644 --- a/scripts/nix-unpack-closure.in +++ b/scripts/nix-unpack-closure.in @@ -15,7 +15,7 @@ $binDir = "@bindir@" unless defined $binDir; my $tmpDir; do { $tmpDir = tmpnam(); } until mkdir $tmpDir, 0777; -END { my $x = $?; system ("@coreutils@/rm", "-rf", $tmpDir); $? = $x; } +END { my $x = $?; system("@coreutils@/rm", "-rf", $tmpDir); $? = $x; } # Unpack the NAR archive on standard input. |