diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-05-01T23·16+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-05-01T23·16+0000 |
commit | 93aefd9fc0250eda2c47d22a88922d319cde34b8 (patch) | |
tree | 76ed8bbf3758f48a7b8d594552b80dfbf23540ec /corepkgs/channels/unpack.sh.in | |
parent | a9d15d4f434fece269852a65be836d1338ed787d (diff) |
* 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".
Diffstat (limited to 'corepkgs/channels/unpack.sh.in')
-rw-r--r-- | corepkgs/channels/unpack.sh.in | 29 |
1 files changed, 20 insertions, 9 deletions
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 |