* Don't use the "replace-literal" command in stdenv; instead use bash's pattern replacement feature. "replace-literal" is an uncommon command so it was a headache during the bootstrap.

svn path=/nixpkgs/branches/stdenv-updates/; revision=31681

+9 -17
-1
pkgs/stdenv/common-path.nix
··· 11 11 pkgs.gnumake 12 12 pkgs.bash 13 13 pkgs.patch 14 - pkgs.replace 15 14 pkgs.xz 16 15 ]
-2
pkgs/stdenv/generic/builder.sh
··· 16 16 17 17 mkdir $out 18 18 19 - # Can't use substitute() here, because replace may not have been 20 - # built yet (in the bootstrap). 21 19 sed \ 22 20 -e "s^@preHook@^$_preHook^g" \ 23 21 -e "s^@postHook@^$_postHook^g" \
+9 -13
pkgs/stdenv/generic/setup.sh
··· 315 315 local output="$2" 316 316 317 317 local -a params=("$@") 318 - local -a args=() 319 318 320 319 local n p pattern replacement varName 320 + 321 + local content="$(cat $input)" 321 322 322 323 for ((n = 2; n < ${#params[*]}; n += 1)); do 323 324 p=${params[$n]} 324 325 325 - if test "$p" = "--replace"; then 326 + if [ "$p" = --replace ]; then 326 327 pattern="${params[$((n + 1))]}" 327 328 replacement="${params[$((n + 2))]}" 328 329 n=$((n + 2)) 329 330 fi 330 331 331 - if test "$p" = "--subst-var"; then 332 + if [ "$p" = --subst-var ]; then 332 333 varName="${params[$((n + 1))]}" 333 334 pattern="@$varName@" 334 335 replacement="${!varName}" 335 336 n=$((n + 1)) 336 337 fi 337 338 338 - if test "$p" = "--subst-var-by"; then 339 + if [ "$p" = --subst-var-by ]; then 339 340 pattern="@${params[$((n + 1))]}@" 340 341 replacement="${params[$((n + 2))]}" 341 342 n=$((n + 2)) 342 343 fi 343 344 344 - if test ${#args[@]} != 0; then 345 - args[${#args[@]}]="-a" 346 - fi 347 - args[${#args[@]}]="$pattern" 348 - args[${#args[@]}]="$replacement" 345 + content="${content//"$pattern"/$replacement}" 349 346 done 350 347 351 - replace-literal -e -s -- "${args[@]}" < "$input" > "$output".tmp 352 - if test -x "$output"; then 353 - chmod +x "$output".tmp 354 - fi 348 + # !!! This doesn't work properly if $content is "-n". 349 + echo -n "$content" > "$output".tmp 350 + if [ -x "$output" ]; then chmod +x "$output".tmp; fi 355 351 mv -f "$output".tmp "$output" 356 352 } 357 353
-1
pkgs/stdenv/linux/make-bootstrap-tools.nix
··· 133 133 cp -d ${gnumake}/bin/* $out/bin 134 134 cp -d ${patch}/bin/* $out/bin 135 135 cp ${patchelf}/bin/* $out/bin 136 - cp ${replace}/bin/* $out/bin 137 136 138 137 cp -d ${gnugrep.pcre}/lib/libpcre*.so* $out/lib # needed by grep 139 138