about summary refs log tree commit diff
path: root/scripts/download-using-manifests.pl.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-01-23T16·50+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-01-23T16·50+0000
commitbae75ca5a18edbb9fb959e2e48065a1987ffb61a (patch)
treec1b169f6f290cb1e4c412a61051dd3a1ee987bc5 /scripts/download-using-manifests.pl.in
parent36d9258c0dbfeab095dc5727b6ebcb55afacb0a6 (diff)
* New kind of manifest object: "localPath", which denotes that a store
  path can be created by copying it from another location in the file
  system.  This is useful in the NixOS installation.

Diffstat (limited to 'scripts/download-using-manifests.pl.in')
-rw-r--r--scripts/download-using-manifests.pl.in16
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/download-using-manifests.pl.in b/scripts/download-using-manifests.pl.in
index e02d82c140f7..65ab36084ab9 100644
--- a/scripts/download-using-manifests.pl.in
+++ b/scripts/download-using-manifests.pl.in
@@ -34,17 +34,31 @@ print "\n*** Trying to download/patch `$targetPath'\n";
 
 # Load all manifests.
 my %narFiles;
+my %localPaths;
 my %patches;
 
 for my $manifest (glob "$manifestDir/*.nixmanifest") {
 #    print STDERR "reading $manifest\n";
-    if (readManifest($manifest, \%narFiles, \%patches) < 3) {
+    if (readManifest($manifest, \%narFiles, \%localPaths, \%patches) < 3) {
         print STDERR "you have an old-style manifest `$manifest'; please delete it\n";
         exit 1;
     }
 }
 
 
+# If we can copy from a local path, do that.
+my $localPathList = $localPaths{$targetPath};
+foreach my $localPath (@{$localPathList}) {
+    my $sourcePath = $localPath->{copyFrom};
+    if (-e $sourcePath) {
+        print "\n*** Step 1/1: copying from $sourcePath\n";
+        system("@bindir@/nix-store --dump $sourcePath | @bindir@/nix-store --restore $targetPath") == 0
+            or die "cannot copy `$sourcePath' to `$targetPath'";
+        exit 0;
+    }
+}
+
+
 # Build a graph of all store paths that might contribute to the
 # construction of $targetPath, and the special node "start".  The
 # edges are either patch operations, or downloads of full NAR files.