1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 12:11:28 +00:00

* Some things are best done in Perl.

svn path=/nixos/trunk/; revision=7773
This commit is contained in:
Eelco Dolstra 2007-01-23 14:34:44 +00:00
parent 668c146e33
commit 903a64c87d
3 changed files with 39 additions and 17 deletions

View file

@ -1,4 +1,4 @@
{ stdenv, cdrtools
{ stdenv, perl, cdrtools
# The file name of the resulting ISO image.
, isoName ? "cd.iso"
@ -29,7 +29,7 @@ assert bootable -> bootImage != "";
stdenv.mkDerivation {
name = "iso9660-image";
builder = ./make-iso9660-image.sh;
buildInputs = [cdrtools];
buildInputs = [perl cdrtools];
inherit isoName bootable bootImage;
# !!! should use XML.
@ -42,6 +42,6 @@ stdenv.mkDerivation {
# For obtaining the closure of `storeContents'.
exportReferencesGraph =
map (x: [("closure-" + baseNameOf x.symlink) x.object]) storeContents;
pathsFromGraph = ./paths-from-graph.sh;
map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents;
pathsFromGraph = ./paths-from-graph.pl;
}

View file

@ -12,28 +12,24 @@ if test -n "$bootable"; then
fi
# Add the individual files.
graftList=
for ((i = 0; i < ${#targets_[@]}; i++)); do
graftList="$graftList ${targets_[$i]}=$(readlink -f ${sources_[$i]})"
done
# Add the closures of the top-level store objects.
storePaths=$(perl $pathsFromGraph closure-*)
for i in $storePaths; do
graftList="$graftList ${i:1}=$i"
done
# Add symlinks to the top-level store objects.
for ((n = 0; n < ${#objects[*]}; n++)); do
object=${objects[$n]}
symlink=${symlinks[$n]}
# Get the paths in the closure of `object'.
closure=closure-$(basename $symlink)
if ! test -e $closure; then
echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.'
exit 1
fi
storePaths=$($SHELL $pathsFromGraph $closure)
for i in $storePaths; do
graftList="$graftList ${i:1}=$i"
done
if test "$symlink" != "none"; then
mkdir -p $(dirname ./$symlink)
ln -s $object ./$symlink

View file

@ -0,0 +1,26 @@
use strict;
my %storePaths;
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;
for (my $i = 0; $i < $count; ++$i) {
my $ref = <GRAPH>;
}
}
close GRAPH;
}
foreach my $storePath (sort (keys %storePaths)) {
print "$storePath\n";
}