aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-09 12:57:13 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-09 12:57:13 +0000
commit98df735b5149bc1e39ce6b0bae13fbf7cebcdc05 (patch)
tree9a9549e0689400b71e230ba51317a2590969b63d /scripts
parent582e01c06f9ecee25a31c34562926b41dc2856eb (diff)
* Propagate the deriver of a path through the substitute mechanism.
* Removed some dead code (successor stuff) from nix-push. * Updated terminology in the tests (store expr -> drv path). * Check that the deriver is set properly in the tests.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/nix-pull.in1
-rw-r--r--scripts/nix-push.in29
-rw-r--r--scripts/readmanifest.pm.in12
3 files changed, 17 insertions, 25 deletions
diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in
index 7f46236b8..13a2199fb 100644
--- a/scripts/nix-pull.in
+++ b/scripts/nix-pull.in
@@ -81,6 +81,7 @@ foreach my $storePath (keys %narFiles) {
my $narFileList = $narFiles{$storePath};
foreach my $narFile (@{$narFileList}) {
print WRITE "$storePath\n";
+ print WRITE "$narFile->{deriver}\n";
print WRITE "$libexecDir/nix/download-using-manifests.pl\n";
print WRITE "0\n";
my @references = split " ", $narFile->{references};
diff --git a/scripts/nix-push.in b/scripts/nix-push.in
index 60ccce4ed..52f4a3012 100644
--- a/scripts/nix-push.in
+++ b/scripts/nix-push.in
@@ -138,7 +138,6 @@ print STDERR "creating manifest...\n";
my %narFiles;
my %patches;
-my %successors;
my @nararchives;
for (my $n = 0; $n < scalar @storePaths; $n++) {
@@ -169,7 +168,14 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
my $narbz2Size = (stat $narfile)[7];
- my $references = join(" ", split(" ", `$binDir/nix-store --query --references '$storePath'`));
+ my $references = `$binDir/nix-store --query --references '$storePath'`;
+ die "cannot query references for `$storePath'" if $? != 0;
+ $references = join(" ", split(" ", $references));
+
+ my $deriver = `$binDir/nix-store --query --deriver '$storePath'`;
+ die "cannot query deriver for `$storePath'" if $? != 0;
+ chomp $deriver;
+ $deriver = "" if $deriver eq "unknown-deriver";
my $url;
if ($localCopy) {
@@ -184,27 +190,12 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
, narHash => $narHash
, hashAlgo => "sha1"
, references => $references
+ , deriver => $deriver
}
];
-
- if ($storePath =~ /\.store$/) {
- open PREDS, "$binDir/nix-store --query --predecessors $storePath |" or die "cannot run nix";
- while (<PREDS>) {
- chomp;
- die unless (/^\//);
- my $pred = $_;
- # Only include predecessors that are themselves being
- # pushed.
- if (defined $storePaths{$pred}) {
- $successors{$pred} = $storePath;
- }
- }
- close PREDS;
- }
-
}
-writeManifest $manifest, \%narFiles, \%patches, \%successors;
+writeManifest $manifest, \%narFiles, \%patches;
sub copyFile {
diff --git a/scripts/readmanifest.pm.in b/scripts/readmanifest.pm.in
index ea1c5a447..0d14ffd1b 100644
--- a/scripts/readmanifest.pm.in
+++ b/scripts/readmanifest.pm.in
@@ -51,6 +51,7 @@ sub readManifest {
my $patchType;
my $narHash;
my $references;
+ my $deriver;
while (<MANIFEST>) {
chomp;
@@ -73,6 +74,7 @@ sub readManifest {
undef $baseHash;
undef $patchType;
$references = "";
+ $deriver = "";
}
} else {
@@ -102,6 +104,7 @@ sub readManifest {
push @{$narFileList},
{ url => $url, hash => $hash, size => $size
, narHash => $narHash, references => $references
+ , deriver => $deriver
};
}
@@ -131,6 +134,7 @@ sub readManifest {
elsif (/^\s*Type:\s*(\S+)\s*$/) { $patchType = $1; }
elsif (/^\s*NarHash:\s*(\S+)\s*$/) { $narHash = $1; }
elsif (/^\s*References:\s*(.*)\s*$/) { $references = $1; }
+ elsif (/^\s*Deriver:\s*(\S+)\s*$/) { $deriver = $1; }
# Compatibility;
elsif (/^\s*NarURL:\s*(\S+)\s*$/) { $url = $1; }
@@ -148,7 +152,6 @@ sub writeManifest
my $manifest = shift;
my $narFiles = shift;
my $patches = shift;
- my $successors = shift;
open MANIFEST, ">$manifest.tmp"; # !!! check exclusive
@@ -164,11 +167,8 @@ sub writeManifest
print MANIFEST " Size: $narFile->{size}\n";
print MANIFEST " References: $narFile->{references}\n"
if defined $narFile->{references} && $narFile->{references} ne "";
- foreach my $p (keys %{$successors}) { # !!! quadratic
- if ($$successors{$p} eq $storePath) {
- print MANIFEST " SuccOf: $p\n";
- }
- }
+ print MANIFEST " Deriver: $narFile->{deriver}\n"
+ if defined $narFile->{deriver} && $narFile->{deriver} ne "";
print MANIFEST "}\n";
}
}