* Place manifests in /nix/var/nix/manifests.
* Use the new patch downloader.
This commit is contained in:
parent
7eed57e784
commit
3d1b2101cc
|
@ -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
|
||||
|
|
|
@ -1 +1 @@
|
|||
SUBDIRS = fetchurl nar buildenv channels nix-pull
|
||||
SUBDIRS = fetchurl nar buildenv channels
|
||||
|
|
|
@ -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
|
|
@ -1,34 +0,0 @@
|
|||
#! @shell@ -e
|
||||
|
||||
export PATH=/bin:/usr/bin
|
||||
|
||||
mkdir $out
|
||||
|
||||
cat > $out/fetch <<EOF
|
||||
#! @shell@ -e
|
||||
|
||||
export PATH=/bin:/usr/bin
|
||||
|
||||
echo "downloading \$2..."
|
||||
|
||||
export PRINT_PATH=1
|
||||
result=(\$(@bindir@/nix-prefetch-url \$2))
|
||||
|
||||
hash=\${result[0]}
|
||||
path=\${result[1]}
|
||||
|
||||
if test "\$hash" != "\$3"; then
|
||||
echo "hash is \$hash, expected \$3"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "unpacking into \$1..."
|
||||
|
||||
if ! @bunzip2@ < "\$path" | @bindir@/nix-store --restore "\$1"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
chmod +x $out/fetch
|
|
@ -1,7 +0,0 @@
|
|||
{system}:
|
||||
|
||||
derivation {
|
||||
name = "nix-pull";
|
||||
builder = ./builder.sh;
|
||||
inherit system;
|
||||
}
|
|
@ -4,13 +4,14 @@ bin_SCRIPTS = nix-collect-garbage \
|
|||
|
||||
noinst_SCRIPTS = nix-profile.sh
|
||||
|
||||
nix-pull nix-push: readmanifest.pm
|
||||
nix-pull nix-push: readmanifest.pm download-using-manifests.pl
|
||||
|
||||
install-exec-local: readmanifest.pm
|
||||
install-exec-local: readmanifest.pm download-using-manifests.pl
|
||||
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/profile.d
|
||||
$(INSTALL_PROGRAM) nix-profile.sh $(DESTDIR)$(sysconfdir)/profile.d/nix.sh
|
||||
$(INSTALL) -d $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_DATA) readmanifest.pm $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL_PROGRAM) download-using-manifests.pl $(DESTDIR)$(libexecdir)/nix
|
||||
$(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix
|
||||
|
||||
include ../substitute.mk
|
||||
|
@ -20,4 +21,5 @@ EXTRA_DIST = nix-collect-garbage.in \
|
|||
nix-prefetch-url.in nix-install-package.in \
|
||||
nix-channel.in \
|
||||
readmanifest.pm.in \
|
||||
nix-build.in
|
||||
nix-build.in \
|
||||
download-using-manifests.pl.in
|
||||
|
|
4
corepkgs/nix-pull/download.pl → scripts/download-using-manifests.pl.in
Executable file → Normal file
4
corepkgs/nix-pull/download.pl → scripts/download-using-manifests.pl.in
Executable file → Normal file
|
@ -1,9 +1,9 @@
|
|||
#! /usr/bin/perl -w -I/home/eelco/Dev/nix/scripts
|
||||
#! @perl@ -w -I@libexecdir@/nix
|
||||
|
||||
use strict;
|
||||
use readmanifest;
|
||||
|
||||
my $manifestDir = "/home/eelco/Dev/nix/patch/test";
|
||||
my $manifestDir = "@localstatedir@/nix/manifests";
|
||||
|
||||
|
||||
# Check the arguments.
|
0
scripts/nix-build.in
Executable file → Normal file
0
scripts/nix-build.in
Executable file → Normal file
0
scripts/nix-channel.in
Executable file → Normal file
0
scripts/nix-channel.in
Executable file → Normal file
0
scripts/nix-collect-garbage.in
Executable file → Normal file
0
scripts/nix-collect-garbage.in
Executable file → Normal file
|
@ -11,7 +11,7 @@ until mkdir $tmpdir, 0777;
|
|||
|
||||
my $manifest = "$tmpdir/manifest";
|
||||
|
||||
#END { unlink $manifest; rmdir $tmpdir; }
|
||||
END { unlink $manifest; rmdir $tmpdir; }
|
||||
|
||||
|
||||
# Obtain URLs either from the command line or from a configuration file.
|
||||
|
@ -30,6 +30,20 @@ sub processURL {
|
|||
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";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ sub readManifest {
|
|||
my $basePath;
|
||||
my $baseHash;
|
||||
my $patchType;
|
||||
my $narHash;
|
||||
|
||||
while (<MANIFEST>) {
|
||||
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,6 +123,7 @@ 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; }
|
||||
|
|
Loading…
Reference in a new issue