From 862f4c154e883611ba9dfefe921c87e6423075ea Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 13 Dec 2004 13:47:38 +0000 Subject: * Patch deployment. `download.pl' (intended to be used in the substitute mechanism) creates a store path by downloading full NAR archives and/or patches specified in the available manifests. Any combination of present paths, full downloads, and patches can be used to construct the target path. In particular, patches can be chained in sequence; and full NAR archives of the target path can be omitted (i.e., patch-only deployment is possible). A shortest path algorithm is used to find the smallest set of files to be downloaded (the edge weights are currently file sizes, but one can imagine taking the network speed to the various source into account). Patches are binary deltas between two store paths. To be precise, they are the output of the `bsdiff' program applied to the NAR archives obtained by dumping (`nix-store --dump') the two store paths. The advantage of diff'ing NAR archives (and not, say, doing file-by-file diffs) is that file renames/moves are handled automatically. The disadvantage is that we cannot optimise creation of unchanged files (by hard-linking). --- scripts/nix-pull.in | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'scripts/nix-pull.in') diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index a802760a5293..66d99ff7c9b5 100644 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -19,14 +19,24 @@ my $confFile = "@sysconfdir@/nix/prebuilts.conf"; my %storePaths2urls; my %urls2hashes; my %successors; -sub doURL { + +sub processURL { my $url = shift; - processURL $manifest, $url, \%storePaths2urls, \%urls2hashes, \%successors; + + $url =~ s/\/$//; + print "obtaining list of Nix archives at $url...\n"; + + system("@curl@ --fail --silent --show-error --location --max-redirs 20 " . + "'$url' > '$manifest'") == 0 + or die "curl failed: $?"; + + readManifest $manifest, \%storePaths2urls, \%urls2hashes, \%successors; } + if (scalar @ARGV > 0) { while (@ARGV) { my $url = shift @ARGV; - doURL $url; + processURL $url; } } else { open CONFFILE, "<$confFile"; @@ -34,7 +44,7 @@ if (scalar @ARGV > 0) { chomp; if (/^\s*(\S+)\s*(\#.*)?$/) { my $url = $1; - doURL $url; + processURL $url; } } close CONFFILE; -- cgit 1.4.1