diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-04-06 08:18:51 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-04-06 08:18:51 +0000 |
commit | 03f1d1ecb5ef69c8c065c83373f9f9f749995c50 (patch) | |
tree | 015504d426363cf19aea03589281593cf7f31a20 /scripts/nix-prefetch-url.in | |
parent | 59b94ee18ac0cba5c7b261ee72550a4d3db0acb5 (diff) |
* Switched from wget to curl.
* Made the dependencies on bzip2 and the shell explicit.
Diffstat (limited to 'scripts/nix-prefetch-url.in')
-rw-r--r-- | scripts/nix-prefetch-url.in | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/nix-prefetch-url.in b/scripts/nix-prefetch-url.in index d921e922b..df6a1c86a 100644 --- a/scripts/nix-prefetch-url.in +++ b/scripts/nix-prefetch-url.in @@ -10,7 +10,7 @@ print "fetching $url...\n"; my $out = "@storedir@/nix-prefetch-url-$$"; -system "@wget@ --passive-ftp '$url' -O '$out'"; +system "@curl@ --fail --location --max-redirs 20 \"$url\" > \"$out\""; $? == 0 or die "unable to fetch $url"; my $hash=`@bindir@/nix-hash --flat $out`; @@ -27,11 +27,12 @@ my $nixexpr = "(import @datadir@/nix/corepkgs/fetchurl) " . "{url = $url; md5 = \"$hash\"; system = \"@system@\";}"; -print "expr: $nixexpr\n"; +#print STDERR "expr: $nixexpr\n"; # Instantiate a Nix expression. -print STDERR "instantiating Nix expression...\n"; -my $pid = open2(\*READ, \*WRITE, "nix-instantiate -") or die "cannot run nix-instantiate"; +#print STDERR "instantiating Nix expression...\n"; +my $pid = open2(\*READ, \*WRITE, "@bindir@/nix-instantiate -") + or die "cannot run nix-instantiate"; print WRITE $nixexpr; close WRITE; @@ -43,8 +44,13 @@ waitpid $pid, 0; $? == 0 or die "nix-instantiate failed"; # Run Nix. -print STDERR "realising store expression $drvpath...\n"; -system "nix-store --realise $drvpath > /dev/null"; +#print STDERR "realising store expression $drvpath...\n"; +system "@bindir@/nix-store --realise $drvpath > /dev/null"; $? == 0 or die "realisation failed"; +my $path = `@bindir@/nix-store -qn $drvpath`; +$? == 0 or die "query failed"; + +print "path is $path"; + unlink $out2; |