diff --git a/configure.ac b/configure.ac index 2e247053e..d7574bbad 100644 --- a/configure.ac +++ b/configure.ac @@ -195,7 +195,6 @@ AC_CONFIG_FILES([Makefile corepkgs/nar/Makefile corepkgs/buildenv/Makefile corepkgs/channels/Makefile - corepkgs/nix-pull/Makefile doc/Makefile doc/manual/Makefile misc/Makefile diff --git a/corepkgs/Makefile.am b/corepkgs/Makefile.am index ca4cea2fc..c9ea11cef 100644 --- a/corepkgs/Makefile.am +++ b/corepkgs/Makefile.am @@ -1 +1 @@ -SUBDIRS = fetchurl nar buildenv channels nix-pull +SUBDIRS = fetchurl nar buildenv channels diff --git a/corepkgs/nix-pull/Makefile.am b/corepkgs/nix-pull/Makefile.am deleted file mode 100644 index 91adb4853..000000000 --- a/corepkgs/nix-pull/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -all-local: builder.sh - -install-exec-local: - $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs - $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/nix-pull - $(INSTALL_DATA) default.nix $(DESTDIR)$(datadir)/nix/corepkgs/nix-pull - $(INSTALL_PROGRAM) builder.sh $(DESTDIR)$(datadir)/nix/corepkgs/nix-pull - -include ../../substitute.mk - -EXTRA_DIST = default.nix builder.sh.in diff --git a/corepkgs/nix-pull/builder.sh.in b/corepkgs/nix-pull/builder.sh.in deleted file mode 100644 index cc1a125d8..000000000 --- a/corepkgs/nix-pull/builder.sh.in +++ /dev/null @@ -1,34 +0,0 @@ -#! @shell@ -e - -export PATH=/bin:/usr/bin - -mkdir $out - -cat > $out/fetch < '$manifest'") == 0 or die "curl failed: $?"; - + readManifest $manifest, \%narFiles, \%patches, \%successors; + + my $baseName = "unnamed"; + if ($url =~ /\/([^\/]+)\/[^\/]+$/) { # get the forelast component + $baseName = $1; + } + + my $hash = `@bindir@/nix-hash --flat '$manifest'` + or die "cannot hash `$manifest'"; + chomp $hash; + + my $finalPath = "@localstatedir@/nix/manifests/$baseName-$hash.nixmanifest"; + + system("mv '$manifest' '$finalPath'") == 0 + or die "cannot move `$manifest' to `$finalPath"; } while (@ARGV) { @@ -42,18 +56,6 @@ my $size = scalar (keys %narFiles); print "$size store paths in manifest\n"; -# Instantiate a store expression that builds the substitute program -# (the program that fetches URLs and unpacks them into the store). -my $nixExpr = - "(import @datadir@/nix/corepkgs/nix-pull) " . - "{system = \"@system@\";}"; - -print STDERR "building downloader...\n"; -my $substProgram = `echo '$nixExpr' | @bindir@/nix-store -qnf \$(@bindir@/nix-instantiate -)` - or die "cannot instantiate Nix expression"; -chomp $substProgram; - - # Register all substitutes. print STDERR "registering substitutes...\n"; @@ -66,10 +68,8 @@ foreach my $storePath (keys %narFiles) { my $narFileList = $narFiles{$storePath}; foreach my $narFile (@{$narFileList}) { print WRITE "$storePath\n"; - print WRITE "$substProgram/fetch\n"; - print WRITE "2\n"; - print WRITE "$narFile->{url}\n"; - print WRITE "$narFile->{hash}\n"; + print WRITE "@libexecdir@/nix/download-using-manifests.pl\n"; + print WRITE "0\n"; } } diff --git a/scripts/readmanifest.pm.in b/scripts/readmanifest.pm.in index 8d6694ff2..7f41bd55f 100644 --- a/scripts/readmanifest.pm.in +++ b/scripts/readmanifest.pm.in @@ -19,6 +19,7 @@ sub readManifest { my $basePath; my $baseHash; my $patchType; + my $narHash; while () { chomp; @@ -34,6 +35,7 @@ sub readManifest { undef $hash; $size = 999999999; @preds = (); + undef $narHash; } elsif (/^patch \{$/) { $type = "patch"; @@ -44,6 +46,7 @@ sub readManifest { undef $basePath; undef $baseHash; undef $patchType; + undef $narHash; } else { die "bad line: $_"; } } else { @@ -71,7 +74,9 @@ sub readManifest { } if (!$found) { push @{$narFileList}, - {url => $url, hash => $hash, size => $size}; + { url => $url, hash => $hash, size => $size + , narHash => $narHash + }; } foreach my $p (@preds) { @@ -102,6 +107,7 @@ sub readManifest { push @{$patchList}, { url => $url, hash => $hash, size => $size , basePath => $basePath, baseHash => $baseHash + , narHash => $narHash }; } @@ -117,11 +123,12 @@ sub readManifest { elsif (/^\s*BasePath:\s*(\/\S+)\s*$/) { $basePath = $1; } elsif (/^\s*BaseHash:\s*(\S+)\s*$/) { $baseHash = $1; } elsif (/^\s*Type:\s*(\S+)\s*$/) { $patchType = $1; } + elsif (/^\s*NarHash:\s*(\S+)\s*$/) { $narHash = $1; } # Compatibility; elsif (/^\s*NarURL:\s*(\S+)\s*$/) { $url = $1; } elsif (/^\s*MD5:\s*(\S+)\s*$/) { $hash = $1; } - + else { die "bad line: $_"; } } }