at 23.11-pre 1.4 kB view raw
1source $stdenv/setup 2 3sources_=($sources) 4targets_=($targets) 5 6objects=($objects) 7symlinks=($symlinks) 8 9 10# Remove the initial slash from a path, since genisofs likes it that way. 11stripSlash() { 12 res="$1" 13 if test "${res:0:1}" = /; then res=${res:1}; fi 14} 15 16# Add the individual files. 17for ((i = 0; i < ${#targets_[@]}; i++)); do 18 stripSlash "${targets_[$i]}" 19 mkdir -p "$(dirname "$res")" 20 cp -a "${sources_[$i]}" "$res" 21done 22 23 24# Add the closures of the top-level store objects. 25chmod +w . 26mkdir -p nix/store 27for i in $(< $closureInfo/store-paths); do 28 cp -a "$i" "${i:1}" 29done 30 31 32# TODO tar ruxo 33# Also include a manifest of the closures in a format suitable for 34# nix-store --load-db. 35cp $closureInfo/registration nix-path-registration 36 37# Add symlinks to the top-level store objects. 38for ((n = 0; n < ${#objects[*]}; n++)); do 39 object=${objects[$n]} 40 symlink=${symlinks[$n]} 41 if test "$symlink" != "none"; then 42 mkdir -p $(dirname ./$symlink) 43 ln -s $object ./$symlink 44 fi 45done 46 47$extraCommands 48 49mkdir -p $out/tarball 50 51rm env-vars 52 53time tar --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner -c * $extraArgs | $compressCommand > $out/tarball/$fileName.tar${extension} 54 55mkdir -p $out/nix-support 56echo $system > $out/nix-support/system 57echo "file system-tarball $out/tarball/$fileName.tar${extension}" > $out/nix-support/hydra-build-products