From 93aefd9fc0250eda2c47d22a88922d319cde34b8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 1 May 2007 23:16:38 +0000 Subject: * Give unpacked channels more sensible names than 0, 1, ... They now get the basename of the channel URL (e.g., nixpkgs-unstable). The top-level Nix expression of the channel is now an attribute set, the attributes of which are the individual channels (e.g., {nixpkgs_unstable = ...; strategoxt_unstable = ...}). This makes attribute paths ("nix-env -qaA" and "nix-env -iA") more sensible, e.g., "nix-env -iA nixpkgs_unstable.subversion". --- corepkgs/channels/unpack.sh.in | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'corepkgs') diff --git a/corepkgs/channels/unpack.sh.in b/corepkgs/channels/unpack.sh.in index 80c177024c55..03c6e5b2f894 100644 --- a/corepkgs/channels/unpack.sh.in +++ b/corepkgs/channels/unpack.sh.in @@ -5,18 +5,29 @@ cd $out/tmp expr=$out/default.nix -echo '[' > $expr +echo '{' > $expr -nr=0 -for i in $inputs; do - echo "unpacking $i" - @bunzip2@ < $i | @tar@ xf - - @coreutils@/mv * ../$nr # !!! hacky - echo "(import ./$nr)" >> $expr - nr=$(($nr + 1)) +inputs=($inputs) +for ((n = 0; n < ${#inputs[*]}; n += 2)); do + channelName=${inputs[n]} + channelTarball=${inputs[n+1]} + echo "unpacking channel $channelName" + @bunzip2@ < $channelTarball | @tar@ xf - + + nr=1 + dirName=$channelName + while test -e ../$dirName; do + nr=$((nr+1)) + dirName=$channelName-$nr + done + + @coreutils@/mv * ../$dirName # !!! hacky + + attrName=$(echo $dirName | @tr@ -- '- ' '__') + echo "$attrName = import ./$dirName {};" >> $expr done -echo ']' >> $expr +echo '} // {_combineChannels = true;}' >> $expr cd .. @coreutils@/rmdir tmp -- cgit 1.4.1