about summary refs log tree commit diff
path: root/pkgs/build-support/kernel/paths-from-graph.pl
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2008-03-17 10:40:47 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2008-03-17 10:40:47 +0000
commit3ee0b9bb74b0331e0aae0bb452074ef14967393f (patch)
tree50aecf67fea2027949db6fd2535c5314e54af191 /pkgs/build-support/kernel/paths-from-graph.pl
parented9107e33c7fe0b746dfe767da13142fe57b7414 (diff)
downloadnixlib-3ee0b9bb74b0331e0aae0bb452074ef14967393f.tar
nixlib-3ee0b9bb74b0331e0aae0bb452074ef14967393f.tar.gz
nixlib-3ee0b9bb74b0331e0aae0bb452074ef14967393f.tar.bz2
nixlib-3ee0b9bb74b0331e0aae0bb452074ef14967393f.tar.lz
nixlib-3ee0b9bb74b0331e0aae0bb452074ef14967393f.tar.xz
nixlib-3ee0b9bb74b0331e0aae0bb452074ef14967393f.tar.zst
nixlib-3ee0b9bb74b0331e0aae0bb452074ef14967393f.zip
* makeInitrd, makeModulesClosure: moved from NixOS.
* Use sh from klibc in the initrd.

svn path=/nixpkgs/trunk/; revision=11154
Diffstat (limited to 'pkgs/build-support/kernel/paths-from-graph.pl')
-rw-r--r--pkgs/build-support/kernel/paths-from-graph.pl68
1 files changed, 68 insertions, 0 deletions
diff --git a/pkgs/build-support/kernel/paths-from-graph.pl b/pkgs/build-support/kernel/paths-from-graph.pl
new file mode 100644
index 000000000000..43ce4e68db44
--- /dev/null
+++ b/pkgs/build-support/kernel/paths-from-graph.pl
@@ -0,0 +1,68 @@
+use strict;
+use File::Basename;
+
+my %storePaths;
+my %refs;
+
+foreach my $graph (@ARGV) {
+    open GRAPH, "<$graph" or die;
+
+    while (<GRAPH>) {
+        chomp;
+        my $storePath = "$_";
+        $storePaths{$storePath} = 1;
+
+        my $deriver = <GRAPH>; chomp $deriver;
+        my $count = <GRAPH>; chomp $count;
+
+        my @refs = ();
+        for (my $i = 0; $i < $count; ++$i) {
+            my $ref = <GRAPH>; chomp $ref;
+            push @refs, $ref;
+        }
+        $refs{$storePath} = \@refs;
+        
+    }
+    
+    close GRAPH;
+}
+
+
+if ($ENV{"printManifest"} eq "1") {
+    print "version {\n";
+    print "  ManifestVersion: 3\n";
+    print "}\n";
+
+    foreach my $storePath (sort (keys %storePaths)) {
+        my $base = basename $storePath;
+        print "localPath {\n";
+        print "  StorePath: $storePath\n";
+        print "  CopyFrom: /tmp/inst-store/$base\n";
+        print "  References: ";
+        foreach my $ref (@{$refs{$storePath}}) {
+            print "$ref ";
+        }
+        print "\n";
+        print "}\n";
+    }
+}
+
+elsif ($ENV{"printRegistration"} eq "1") {
+    # This is the format used by `nix-store --register-validity
+    # --hash-given' / `nix-store --load-db'.
+    foreach my $storePath (sort (keys %storePaths)) {
+        print "$storePath\n";
+        print "0000000000000000000000000000000000000000000000000000000000000000\n"; # !!! fix
+        print "\n"; # don't care about preserving the deriver
+        print scalar(@{$refs{$storePath}}), "\n";
+        foreach my $ref (@{$refs{$storePath}}) {
+            print "$ref\n";
+        }
+    }
+}
+
+else {
+    foreach my $storePath (sort (keys %storePaths)) {
+        print "$storePath\n";
+    }
+}