* Some things are best done in Perl.
svn path=/nixos/trunk/; revision=7773
This commit is contained in:
parent
668c146e33
commit
903a64c87d
|
@ -1,4 +1,4 @@
|
||||||
{ stdenv, cdrtools
|
{ stdenv, perl, cdrtools
|
||||||
|
|
||||||
# The file name of the resulting ISO image.
|
# The file name of the resulting ISO image.
|
||||||
, isoName ? "cd.iso"
|
, isoName ? "cd.iso"
|
||||||
|
@ -29,7 +29,7 @@ assert bootable -> bootImage != "";
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "iso9660-image";
|
name = "iso9660-image";
|
||||||
builder = ./make-iso9660-image.sh;
|
builder = ./make-iso9660-image.sh;
|
||||||
buildInputs = [cdrtools];
|
buildInputs = [perl cdrtools];
|
||||||
inherit isoName bootable bootImage;
|
inherit isoName bootable bootImage;
|
||||||
|
|
||||||
# !!! should use XML.
|
# !!! should use XML.
|
||||||
|
@ -42,6 +42,6 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
# For obtaining the closure of `storeContents'.
|
# For obtaining the closure of `storeContents'.
|
||||||
exportReferencesGraph =
|
exportReferencesGraph =
|
||||||
map (x: [("closure-" + baseNameOf x.symlink) x.object]) storeContents;
|
map (x: [("closure-" + baseNameOf x.object) x.object]) storeContents;
|
||||||
pathsFromGraph = ./paths-from-graph.sh;
|
pathsFromGraph = ./paths-from-graph.pl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,28 +12,24 @@ if test -n "$bootable"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add the individual files.
|
||||||
graftList=
|
graftList=
|
||||||
for ((i = 0; i < ${#targets_[@]}; i++)); do
|
for ((i = 0; i < ${#targets_[@]}; i++)); do
|
||||||
graftList="$graftList ${targets_[$i]}=$(readlink -f ${sources_[$i]})"
|
graftList="$graftList ${targets_[$i]}=$(readlink -f ${sources_[$i]})"
|
||||||
done
|
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
|
for ((n = 0; n < ${#objects[*]}; n++)); do
|
||||||
object=${objects[$n]}
|
object=${objects[$n]}
|
||||||
symlink=${symlinks[$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
|
if test "$symlink" != "none"; then
|
||||||
mkdir -p $(dirname ./$symlink)
|
mkdir -p $(dirname ./$symlink)
|
||||||
ln -s $object ./$symlink
|
ln -s $object ./$symlink
|
||||||
|
|
26
helpers/paths-from-graph.pl
Normal file
26
helpers/paths-from-graph.pl
Normal 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";
|
||||||
|
}
|
Loading…
Reference in a new issue