From ab0bc4999a49efbc8e1c25989662a96e32fa0cc5 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 22 Nov 2003 18:45:56 +0000 Subject: * Maintain integrity of the substitute and successor mappings when deleting a path in the store. * Allow absolute paths in Nix expressions. * Get nix-prefetch-url to work again. * Various other fixes. --- corepkgs/fetchurl/Makefile.am | 11 ++++++----- corepkgs/fetchurl/builder.sh.in | 19 +++++++++++++++++++ corepkgs/fetchurl/default.nix | 8 ++++++++ corepkgs/fetchurl/fetchurl.fix | 10 ---------- corepkgs/fetchurl/fetchurl.sh.in | 19 ------------------- 5 files changed, 33 insertions(+), 34 deletions(-) create mode 100644 corepkgs/fetchurl/builder.sh.in create mode 100644 corepkgs/fetchurl/default.nix delete mode 100644 corepkgs/fetchurl/fetchurl.fix delete mode 100644 corepkgs/fetchurl/fetchurl.sh.in (limited to 'corepkgs/fetchurl') diff --git a/corepkgs/fetchurl/Makefile.am b/corepkgs/fetchurl/Makefile.am index 0c8f0c9399ef..270bf0142488 100644 --- a/corepkgs/fetchurl/Makefile.am +++ b/corepkgs/fetchurl/Makefile.am @@ -1,10 +1,11 @@ -all-local: fetchurl.sh +all-local: builder.sh install-exec-local: - $(INSTALL) -d $(datadir)/fix/fetchurl - $(INSTALL_DATA) fetchurl.fix $(datadir)/fix/fetchurl - $(INSTALL_PROGRAM) fetchurl.sh $(datadir)/fix/fetchurl + $(INSTALL) -d $(datadir)/nix/corepkgs + $(INSTALL) -d $(datadir)/nix/corepkgs/fetchurl + $(INSTALL_DATA) default.nix $(datadir)/nix/corepkgs/fetchurl + $(INSTALL_PROGRAM) builder.sh $(datadir)/nix/corepkgs/fetchurl include ../../substitute.mk -EXTRA_DIST = fetchurl.fix fetchurl.sh.in +EXTRA_DIST = default.nix builder.sh.in diff --git a/corepkgs/fetchurl/builder.sh.in b/corepkgs/fetchurl/builder.sh.in new file mode 100644 index 000000000000..a6cc6993028a --- /dev/null +++ b/corepkgs/fetchurl/builder.sh.in @@ -0,0 +1,19 @@ +#! /bin/sh + +export PATH=/bin:/usr/bin + +echo "downloading $url into $out..." + +prefetch=@prefix@/store/nix-prefetch-url-$md5 +if test -f "$prefetch"; then + echo "using prefetched $prefetch"; + mv $prefetch $out || exit 1 +else + @wget@ --passive-ftp "$url" -O "$out" || exit 1 +fi + +actual=$(@bindir@/nix-hash --flat $out) +if test "$actual" != "$md5"; then + echo "hash is $actual, expected $md5" + exit 1 +fi diff --git a/corepkgs/fetchurl/default.nix b/corepkgs/fetchurl/default.nix new file mode 100644 index 000000000000..663bba4a3800 --- /dev/null +++ b/corepkgs/fetchurl/default.nix @@ -0,0 +1,8 @@ +{system, url, md5}: derivation { + name = baseNameOf (toString url); + system = system; + builder = ./builder.sh; + url = url; + md5 = md5; + id = md5; +} diff --git a/corepkgs/fetchurl/fetchurl.fix b/corepkgs/fetchurl/fetchurl.fix deleted file mode 100644 index 0221b612cfe3..000000000000 --- a/corepkgs/fetchurl/fetchurl.fix +++ /dev/null @@ -1,10 +0,0 @@ -Function(["url", "md5"], - Package( - [ ("build", Relative("fetchurl/fetchurl.sh")) - , ("url", Var("url")) - , ("md5", Var("md5")) - , ("name", BaseName(Var("url"))) - , ("id", Var("md5")) - ] - ) -) diff --git a/corepkgs/fetchurl/fetchurl.sh.in b/corepkgs/fetchurl/fetchurl.sh.in deleted file mode 100644 index a6cc6993028a..000000000000 --- a/corepkgs/fetchurl/fetchurl.sh.in +++ /dev/null @@ -1,19 +0,0 @@ -#! /bin/sh - -export PATH=/bin:/usr/bin - -echo "downloading $url into $out..." - -prefetch=@prefix@/store/nix-prefetch-url-$md5 -if test -f "$prefetch"; then - echo "using prefetched $prefetch"; - mv $prefetch $out || exit 1 -else - @wget@ --passive-ftp "$url" -O "$out" || exit 1 -fi - -actual=$(@bindir@/nix-hash --flat $out) -if test "$actual" != "$md5"; then - echo "hash is $actual, expected $md5" - exit 1 -fi -- cgit 1.4.1