aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-07-21 22:05:19 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-07-21 22:05:19 +0000
commitd84931ee5607c152b4bc7eb23b7ab94ded9f85c7 (patch)
tree4d74260124d641d4cbc4a802f734eb5a78d91955 /scripts
parentc7bdb76fe461e2335caeea01c16b39a2784fa506 (diff)
* Changed nix-pull to match nix-push.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/nix-collect-garbage.in2
-rw-r--r--scripts/nix-pull.in29
2 files changed, 16 insertions, 15 deletions
diff --git a/scripts/nix-collect-garbage.in b/scripts/nix-collect-garbage.in
index 1506416b2..8f54ba20f 100755
--- a/scripts/nix-collect-garbage.in
+++ b/scripts/nix-collect-garbage.in
@@ -5,7 +5,7 @@ my $storedir = "@prefix@/store";
my %alive;
-open HASHES, "nix -qrh \$(cat $linkdir/*.hash) |" or die "in `nix -qrh'";
+open HASHES, "nix --query --refs \$(cat $linkdir/*.hash) |" or die "in `nix -qrh'";
while (<HASHES>) {
chomp;
$alive{$_} = 1;
diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in
index 47762e857..9a1c1b6b5 100644
--- a/scripts/nix-pull.in
+++ b/scripts/nix-pull.in
@@ -28,21 +28,22 @@ while (<CONFFILE>) {
my $fn = $1;
next if $fn =~ /\.\./;
next if $fn =~ /\//;
- next unless $fn =~ /-([0-9a-z]{32})(-s-([0-9a-z]{32}))?\.nar.bz2$/;
+ next unless $fn =~ /^([0-9a-z]{32})-([0-9a-z]{32})(-s-([0-9a-z]{32}))?.*\.nar\.bz2$/;
my $hash = $1;
- my $fshash = $3;
+ my $id = $2;
+ my $fsid = $4;
- print "registering $hash -> $url/$fn\n";
+ print "registering $id -> $url/$fn\n";
# Construct a Fix expression that fetches and unpacks a
# Nix archive from the network.
my $fetch =
"App(IncludeFix(\"fetchurl/fetchurl.fix\"), " .
- "[(\"url\", \"$url/$fn\"), (\"md5\", \"ignore\")])";
+ "[(\"url\", \"$url/$fn\"), (\"md5\", \"$hash\")])";
my $fixexpr =
"App(IncludeFix(\"nar/unnar.fix\"), " .
"[ (\"nar\", $fetch)" .
- ", (\"name\", \"fetched-$hash\")" .
+ ", (\"name\", \"fetched-$id\")" .
"])";
my $fixfile = "/tmp/nix-pull-tmp.fix";
@@ -51,19 +52,19 @@ while (<CONFFILE>) {
close FIX;
# Instantiate a Nix expression from the Fix expression.
- my $nhash = `fix $fixfile`;
+ my $nid = `fix $fixfile`;
$? and die "instantiating Nix archive expression";
- chomp $nhash;
- die unless $nhash =~ /^([0-9a-z]{32})$/;
+ chomp $nid;
+ die unless $nid =~ /^([0-9a-z]{32})$/;
- push @subs, $hash;
- push @subs, $nhash;
+ push @subs, $id;
+ push @subs, $nid;
# Does the name encode a successor relation?
- if (defined $fshash) {
- print "NORMAL $fshash -> $hash\n";
- push @sucs, $fshash;
- push @sucs, $hash;
+ if (defined $fsid) {
+ print "NORMAL $fsid -> $id\n";
+ push @sucs, $fsid;
+ push @sucs, $id;
}
}