Skip to content

Commit b087618

Browse files
committedJul 24, 2017
Revert "stdenv: Store one package per line in nix-support/propagated-*"
As @oxij points out in [1], this breakage is especially serious because it changes the contents of built environments without a corresonding change in their hashes. Also, the revert is easier than I thought. This reverts commit 3cb745d. [1]: #27427 (comment)
1 parent f4a8e6a commit b087618

File tree

15 files changed

+22
-31
lines changed

15 files changed

+22
-31
lines changed
 

‎pkgs/build-support/cc-wrapper/default.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ stdenv.mkDerivation {
275275
# Propagate the wrapped cc so that if you install the wrapper,
276276
# you get tools like gcov, the manpages, etc. as well (including
277277
# for binutils and Glibc).
278-
printLines ${cc} ${cc.man or ""} ${binutils_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages
278+
echo ${cc} ${cc.man or ""} ${binutils_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages
279279
280-
printLines ${toString extraPackages} > $out/nix-support/propagated-native-build-inputs
280+
echo ${toString extraPackages} > $out/nix-support/propagated-native-build-inputs
281281
''
282282

283283
+ optionalString (targetPlatform.isSunOS && nativePrefix != "") ''

‎pkgs/build-support/gcc-wrapper-old/builder.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,5 @@ cp -p $utils $out/nix-support/utils.sh
211211
# tools like gcov, the manpages, etc. as well (including for binutils
212212
# and Glibc).
213213
if test -z "$nativeTools"; then
214-
printLines $gcc $binutils $libc $libc_bin > $out/nix-support/propagated-user-env-packages
214+
echo $gcc $binutils $libc $libc_bin > $out/nix-support/propagated-user-env-packages
215215
fi

‎pkgs/build-support/setup-hooks/multiple-outputs.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ _multioutPropagateDev() {
202202

203203
mkdir -p "${!propagaterOutput}"/nix-support
204204
for output in $propagatedBuildOutputs; do
205-
echo "${!output}" >> "${!propagaterOutput}"/nix-support/$propagatedBuildInputsFile
205+
echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/$propagatedBuildInputsFile
206206
done
207207
}
208208

‎pkgs/build-support/trivial-builders.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ rec {
8484
mkdir -p $out/nix-support
8585
cp ${script} $out/nix-support/setup-hook
8686
'' + lib.optionalString (deps != []) ''
87-
printLines ${toString deps} > $out/nix-support/propagated-native-build-inputs
87+
echo ${toString deps} > $out/nix-support/propagated-native-build-inputs
8888
'' + lib.optionalString (substitutions != {}) ''
8989
substituteAll ${script} $out/nix-support/setup-hook
9090
'');

‎pkgs/desktops/kde-4.14/kde-package/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ rec {
8686
};})
8787
''
8888
mkdir -pv $out/nix-support
89-
printLines ${toString list} | tee $out/nix-support/propagated-user-env-packages
89+
echo "${toString list}" | tee $out/nix-support/propagated-user-env-packages
9090
'';
9191

9292
# Given manifest module data, return the module

‎pkgs/development/compilers/openjdk-darwin/8.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ let
3333
# any package that depends on the JRE has $CLASSPATH set up
3434
# properly.
3535
mkdir -p $out/nix-support
36-
printLines ${setJavaClassPath} > $out/nix-support/propagated-native-build-inputs
36+
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-native-build-inputs
3737
3838
install_name_tool -change /usr/X11/lib/libfreetype.6.dylib ${freetype}/lib/libfreetype.6.dylib $out/jre/lib/libfontmanager.dylib
3939

‎pkgs/development/compilers/openjdk-darwin/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let
2323
# any package that depends on the JRE has $CLASSPATH set up
2424
# properly.
2525
mkdir -p $out/nix-support
26-
printLines ${setJavaClassPath} > $out/nix-support/propagated-native-build-inputs
26+
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-native-build-inputs
2727
2828
install_name_tool -change /usr/X11/lib/libfreetype.6.dylib ${freetype}/lib/libfreetype.6.dylib $out/jre/lib/libfontmanager.dylib
2929

‎pkgs/development/compilers/openjdk/7.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ let
190190
# any package that depends on the JRE has $CLASSPATH set up
191191
# properly.
192192
mkdir -p $jre/nix-support
193-
printLines ${setJavaClassPath} > $jre/nix-support/propagated-native-build-inputs
193+
echo -n "${setJavaClassPath}" > $jre/nix-support/propagated-native-build-inputs
194194
195195
# Set JAVA_HOME automatically.
196196
mkdir -p $out/nix-support

‎pkgs/development/compilers/openjdk/8.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ let
202202
# any package that depends on the JRE has $CLASSPATH set up
203203
# properly.
204204
mkdir -p $jre/nix-support
205-
printLines ${setJavaClassPath} > $jre/nix-support/propagated-native-build-inputs
205+
echo -n "${setJavaClassPath}" > $jre/nix-support/propagated-native-build-inputs
206206
207207
# Set JAVA_HOME automatically.
208208
mkdir -p $out/nix-support

‎pkgs/development/compilers/oraclejdk/jdk-linux-base.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ let result = stdenv.mkDerivation rec {
165165
ln -s $jrePath/lib/${architecture}/libnpjp2.so $jrePath/lib/${architecture}/plugins
166166
167167
mkdir -p $out/nix-support
168-
printLines ${setJavaClassPath} > $out/nix-support/propagated-native-build-inputs
168+
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-native-build-inputs
169169
170170
# Set JAVA_HOME automatically.
171171
cat <<EOF >> $out/nix-support/setup-hook

‎pkgs/development/compilers/zulu/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ in stdenv.mkDerivation rec {
5454
find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \;
5555
5656
mkdir -p $out/nix-support
57-
printLines ${setJavaClassPath} > $out/nix-support/propagated-native-build-inputs
57+
echo -n "${setJavaClassPath}" > $out/nix-support/propagated-native-build-inputs
5858
5959
# Set JAVA_HOME automatically.
6060
cat <<EOF >> $out/nix-support/setup-hook

‎pkgs/development/haskell-modules/generic-builder.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ stdenv.mkDerivation ({
311311
${optionalString isGhcjs ''
312312
for exeDir in "$out/bin/"*.jsexe; do
313313
exe="''${exeDir%.jsexe}"
314-
printLines '#!${nodejs}/bin/node' > "$exe"
314+
printf '%s\n' '#!${nodejs}/bin/node' > "$exe"
315315
cat "$exeDir/all.js" >> "$exe"
316316
chmod +x "$exe"
317317
done

‎pkgs/misc/misc.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ in
2323
*/
2424
collection = {list, name} : runCommand "collection-${name}" {} ''
2525
mkdir -p $out/nix-support
26-
printLines ${builtins.toString list} > $out/nix-support/propagated-user-env-packages
26+
echo ${builtins.toString list} > $out/nix-support/propagated-user-env-packages
2727
'';
2828

2929
/* creates a derivation symlinking references C/C++ libs into one include and lib directory called $out/cdt-envs/${name}

‎pkgs/stdenv/generic/builder.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export PATH=
12
for i in $initialPath; do
23
if [ "$i" = / ]; then i=; fi
34
PATH=$PATH${PATH:+:}$i/bin
@@ -14,6 +15,4 @@ cat "$setup" >> $out/setup
1415
# Allow the user to install stdenv using nix-env and get the packages
1516
# in stdenv.
1617
mkdir $out/nix-support
17-
if [ "$propagatedUserEnvPkgs" ]; then
18-
printf '%s\n' $propagatedUserEnvPkgs > $out/nix-support/propagated-user-env-packages
19-
fi
18+
echo $propagatedUserEnvPkgs > $out/nix-support/propagated-user-env-packages

‎pkgs/stdenv/generic/setup.sh

+6-14
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,6 @@ isScript() {
215215
if [[ "$magic" =~ \#! ]]; then return 0; else return 1; fi
216216
}
217217

218-
# printf unfortunately will print a trailing newline regardless
219-
printLines() {
220-
[[ $# -gt 0 ]] || return 0
221-
printf '%s\n' "$@"
222-
}
223218

224219
######################################################################
225220
# Initialisation.
@@ -305,12 +300,9 @@ findInputs() {
305300
fi
306301

307302
if [ -f "$pkg/nix-support/$propagatedBuildInputsFile" ]; then
308-
local fd pkgNext
309-
exec {fd}<"$pkg/nix-support/$propagatedBuildInputsFile"
310-
while IFS= read -r -u $fd pkgNext; do
311-
findInputs "$pkgNext" $var $propagatedBuildInputsFile
303+
for i in $(cat "$pkg/nix-support/$propagatedBuildInputsFile"); do
304+
findInputs "$i" $var $propagatedBuildInputsFile
312305
done
313-
exec {fd}<&-
314306
fi
315307
}
316308

@@ -802,17 +794,17 @@ fixupPhase() {
802794
fi
803795
if [ -n "$propagated" ]; then
804796
mkdir -p "${!outputDev}/nix-support"
805-
printLines $propagated > "${!outputDev}/nix-support/propagated-native-build-inputs"
797+
echo "$propagated" > "${!outputDev}/nix-support/propagated-native-build-inputs"
806798
fi
807799
else
808800
if [ -n "$propagatedBuildInputs" ]; then
809801
mkdir -p "${!outputDev}/nix-support"
810-
printLines $propagatedBuildInputs > "${!outputDev}/nix-support/propagated-build-inputs"
802+
echo "$propagatedBuildInputs" > "${!outputDev}/nix-support/propagated-build-inputs"
811803
fi
812804

813805
if [ -n "$propagatedNativeBuildInputs" ]; then
814806
mkdir -p "${!outputDev}/nix-support"
815-
printLines $propagatedNativeBuildInputs > "${!outputDev}/nix-support/propagated-native-build-inputs"
807+
echo "$propagatedNativeBuildInputs" > "${!outputDev}/nix-support/propagated-native-build-inputs"
816808
fi
817809
fi
818810

@@ -825,7 +817,7 @@ fixupPhase() {
825817

826818
if [ -n "$propagatedUserEnvPkgs" ]; then
827819
mkdir -p "${!outputBin}/nix-support"
828-
printLines $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages"
820+
echo "$propagatedUserEnvPkgs" > "${!outputBin}/nix-support/propagated-user-env-packages"
829821
fi
830822

831823
runHook postFixup

0 commit comments

Comments
 (0)