diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-08-05T12·30+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-08-05T12·30+0000 |
commit | b9c9b461ea3a90d7344a76c072b1f9a3e9d77144 (patch) | |
tree | b15f4ef07e80b1e6ea9d2ecc1915e29c98e4868c | |
parent | 4ce652640b01c97d4df287cbc0ec6766a1438fd2 (diff) |
* Made nix-push much faster.
-rw-r--r-- | scripts/nix-push.in | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/scripts/nix-push.in b/scripts/nix-push.in index 10efc48be158..bb5e6da134f4 100644 --- a/scripts/nix-push.in +++ b/scripts/nix-push.in @@ -1,6 +1,9 @@ #! /usr/bin/perl -w -my @pushlist; +my $fixfile = "/tmp/nix-push-tmp.fix"; +open FIX, ">$fixfile"; +print FIX "["; +my $first = 1; foreach my $id (@ARGV) { @@ -35,6 +38,7 @@ foreach my $id (@ARGV) { foreach my $path (@paths) { next unless ($path =~ /\/([0-9a-z]{32})[^\/]*/); + print "$path\n"; my $pathid = $1; # Construct a name for the Nix archive. If the file is an @@ -51,28 +55,39 @@ foreach my $id (@ARGV) { "[ (\"path\", Slice([\"$pathid\"], [(\"$path\", \"$pathid\", [])]))" . "])"; - my $fixfile = "/tmp/nix-push-tmp.fix"; - open FIX, ">$fixfile"; + print FIX "," unless ($first); + $first = 0; print FIX $fixexpr; - close FIX; - # Instantiate a Nix expression from the Fix expression. - my $nid = `fix $fixfile`; - $? and die "instantiating Nix archive expression"; - chomp $nid; - die unless $nid =~ /^([0-9a-z]{32})$/; + } +} - # Realise the Nix expression. - system "nix --install $nid"; - if ($?) { die "`nix --install' failed"; } - my $npath = `nix --query --list $nid 2> /dev/null`; - $? and die "`nix --query --list' failed"; - chomp $npath; +print FIX "]"; +close FIX; + +# Instantiate a Nix expression from the Fix expression. +my @nids; +print STDERR "running fix...\n"; +open NIDS, "fix $fixfile |" or die "cannot run fix"; +while (<NIDS>) { + chomp; + die unless /^([0-9a-z]{32})$/; + push @nids, $1; +} - push @pushlist, "$npath/*"; - print "$path -> $npath\n"; - } +# Realise the Nix expression. +my @pushlist; +print STDERR "creating archives...\n"; +system "nix --install @nids > /dev/null"; +if ($?) { die "`nix --install' failed"; } + +open NIDS, "nix --query --list @nids |" or die "cannot run nix"; +while (<NIDS>) { + chomp; + die unless (/^\//); + print "$_\n"; + push @pushlist, "$_/*"; } # Push the prebuilts to the server. !!! FIXME |