about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-07-22T15·15+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-07-22T15·15+0000
commite877c69d78fe75ae3531b3ed3cb4a4d7b390ccec (patch)
tree3e283c86e6d6079c84de21dcfe393acf0c5caf12 /scripts
parentdf648c4967af7298fe55f75c7616e39e5b5e7d37 (diff)
* Substitutes now should produce a path with the same id as they are
  substituting for (obvious, really).

* For greater efficiency, nix-pull/unnar will place the output in a
  path that is probably the same as what is actually needed, thus
  preventing a path copy.

* Even if a output id is given in a Fix package expression, ensure
  that the resulting Nix derive expression has a different id.  This
  is because Nix expressions that are semantically equivalent (i.e.,
  build the same result) might be different w.r.t. efficiency or
  divergence.  It is absolutely vital for the substitute mechanism
  that such expressions are not used interchangeably.


Diffstat (limited to 'scripts')
-rw-r--r--scripts/nix-pull.in17
1 files changed, 13 insertions, 4 deletions
diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in
index 9a1c1b6b5e4c..f584b6abd1c5 100644
--- a/scripts/nix-pull.in
+++ b/scripts/nix-pull.in
@@ -28,10 +28,18 @@ while (<CONFFILE>) {
             my $fn = $1;
             next if $fn =~ /\.\./;
             next if $fn =~ /\//;
-            next unless $fn =~ /^([0-9a-z]{32})-([0-9a-z]{32})(-s-([0-9a-z]{32}))?.*\.nar\.bz2$/;
+            next unless $fn =~ /^([0-9a-z]{32})-([0-9a-z]{32})(.*)\.nar\.bz2$/;
             my $hash = $1;
-            my $id = $2;
-            my $fsid = $4;
+	    my $id = $2;
+	    my $outname = $3;
+	    my $fsid;
+	    if ($outname =~ /^-/) {
+		next unless $outname =~ /^-((s-([0-9a-z]{32}))?.*)$/;
+		$outname = $1;
+		$fsid = $3;
+	    } else {
+		$outname = "";
+	    }
 
             print "registering $id -> $url/$fn\n";
 
@@ -43,7 +51,8 @@ while (<CONFFILE>) {
             my $fixexpr = 
                 "App(IncludeFix(\"nar/unnar.fix\"), " .
                 "[ (\"nar\", $fetch)" .
-                ", (\"name\", \"fetched-$id\")" .
+                ", (\"name\", \"$outname\")" .
+                ", (\"id\", \"$id\")" .
                 "])";
             
             my $fixfile = "/tmp/nix-pull-tmp.fix";