git.iko.soy/typeable/nixpkgs
on master help sign in
stdenv/stripHash: print to stdout, not to variable

`stripHash` documentation states that it prints out the stripped name to the stdout, but the function stored the value in `strippedName` instead. Basically all usages did something like `$(stripHash $foo | echo $strippedName)` which is just braindamaged. Fixed the implementation and all invocations.

commitbef6bef0d2ce2ef7cfaa3e9f1eac2cdc793560c4 authorProfpatsch <mail@profpatsch.de> dateTue 11 Oct 2016, 18:09 (10 years ago) parent8417c3a
15 files changed+27−22
doc/stdenv.xml+4−5 nixos/doc/manual/release-notes/rl-1703.xml+8 nixos/modules/services/networking/ircd-hybrid/builder.sh+2−2 pkgs/build-support/vm/default.nix+1−2 pkgs/data/fonts/droid/default.nix+1−1 pkgs/data/fonts/roboto-mono/default.nix+1−1 pkgs/data/fonts/roboto-slab/default.nix+1−1 pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh+1−2 pkgs/stdenv/generic/setup.sh+1−1 pkgs/tools/typesetting/tex/nix/animatedot.sh+1−1 pkgs/tools/typesetting/tex/nix/default.nix+1−1 pkgs/tools/typesetting/tex/nix/dot2pdf.sh+1−1 pkgs/tools/typesetting/tex/nix/dot2ps.sh+1−1 pkgs/tools/typesetting/tex/nix/lhs2tex.sh+1−1 pkgs/tools/typesetting/tex/nix/run-latex.sh+2−2
doc/stdenv.xml+4−5
@@ -1231,13 +1231,12 @@ echo @foo@
12311231 <term><function>stripHash</function>
12321232 <replaceable>path</replaceable></term>
12331233 <listitem><para>Strips the directory and hash part of a store
1234− path, storing the name part in the environment variable
1235− <literal>strippedName</literal>. For example:
1234+ path, outputting the name part to <literal>stdout</literal>.
1235+ For example:
12361236
12371237<programlisting>
1238−stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
12391238# prints coreutils-8.24
1240−echo $strippedName
1239+stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
12411240</programlisting>
12421241
12431242 If you wish to store the result in another variable, then the
@@ -1245,7 +1244,7 @@ echo $strippedName
12451244
12461245<programlisting>
12471246name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
1248−someVar=$(stripHash $name; echo $strippedName)
1247+someVar=$(stripHash $name)
12491248</programlisting>
12501249
12511250 </para></listitem>
nixos/doc/manual/release-notes/rl-1703.xml+8
@@ -50,6 +50,14 @@ following incompatible changes:</para>
5050 which prevents ptracing non-child processes.
5151 This means you will not be able to attach gdb to an existing process,
5252 but will need to start that process from gdb (so it is a child).
53+ </listitem>
54+
55+ <listitem>
56+ <para>
57+ The <literal>stripHash</literal> bash function in <literal>stdenv</literal>
58+ changed according to its documentation; it now outputs the stripped name to
59+ <literal>stdout</literal> instead of putting it in the variable
60+ <literal>strippedName</literal>.
5361 </para>
5462 </listitem>
5563</itemizedlist>
nixos/modules/services/networking/ircd-hybrid/builder.sh+2−2
@@ -12,7 +12,7 @@ for i in $scripts; do
1212 if test "$(echo $i | cut -c1-2)" = "=>"; then
1313 subDir=$(echo $i | cut -c3-)
1414 else
15− dst=$out/$subDir/$((stripHash $i; echo $strippedName) | sed 's/\.in//')
15+ dst=$out/$subDir/$(stripHash $i | sed 's/\.in//')
1616 doSub $i $dst
1717 chmod +x $dst # !!!
1818 fi
@@ -23,7 +23,7 @@ for i in $substFiles; do
2323 if test "$(echo $i | cut -c1-2)" = "=>"; then
2424 subDir=$(echo $i | cut -c3-)
2525 else
26− dst=$out/$subDir/$((stripHash $i; echo $strippedName) | sed 's/\.in//')
26+ dst=$out/$subDir/$(stripHash $i | sed 's/\.in//')
2727 doSub $i $dst
2828 fi
2929done
pkgs/build-support/vm/default.nix+1−2
@@ -537,8 +537,7 @@ rec {
537537
538538 # Hacky: RPM looks for <basename>.spec inside the tarball, so
539539 # strip off the hash.
540− stripHash "$src"
541− srcName="$strippedName"
540+ srcName="$(stripHash "$src")"
542541 cp "$src" "$srcName" # `ln' doesn't work always work: RPM requires that the file is owned by root
543542
544543 export HOME=/tmp/home
pkgs/data/fonts/droid/default.nix+1−1
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
4141 sourceRoot = "./";
4242
4343 unpackCmd = ''
44− ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
44+ ttfName=$(basename $(stripHash $curSrc))
4545 cp $curSrc ./$ttfName
4646 '';
4747
pkgs/data/fonts/roboto-mono/default.nix+1−1
@@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
5454 sourceRoot = "./";
5555
5656 unpackCmd = ''
57− ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
57+ ttfName=$(basename $(stripHash $curSrc))
5858 cp $curSrc ./$ttfName
5959 '';
6060
pkgs/data/fonts/roboto-slab/default.nix+1−1
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
3030 sourceRoot = "./";
3131
3232 unpackCmd = ''
33− ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
33+ ttfName=$(basename $(stripHash $curSrc))
3434 cp $curSrc ./$ttfName
3535 '';
3636
pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh+1−2
@@ -3,5 +3,4 @@ source $stdenv/setup
33mkdir -p $out/xml/dtd/docbook-ebnf
44cd $out/xml/dtd/docbook-ebnf
55cp -p $dtd dbebnf.dtd
6−stripHash $catalog
7−cp -p $catalog $strippedName
6+cp -p $catalog $(stripHash $catalog)
pkgs/stdenv/generic/setup.sh+1−1
@@ -495,7 +495,7 @@ dumpVars() {
495495stripHash() {
496496 strippedName=$(basename $1);
497497 if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then
498− strippedName=$(echo "$strippedName" | cut -c34-)
498+ echo "$strippedName" | cut -c34-
499499 fi
500500}
501501
pkgs/tools/typesetting/tex/nix/animatedot.sh+1−1
@@ -4,6 +4,6 @@ mkdir -p $out
44
55for ((i = 1; i <= $nrFrames; i++)); do
66 echo "producing frame $i...";
7− targetName=$out/$(basename $(stripHash $dotGraph; echo $strippedName) .dot)-f-$i.dot
7+ targetName=$out/$(basename $(stripHash $dotGraph) .dot)-f-$i.dot
88 cpp -DFRAME=$i < $dotGraph > $targetName
99done
pkgs/tools/typesetting/tex/nix/default.nix+1−1
@@ -185,7 +185,7 @@ rec {
185185 if test -d $postscript; then
186186 input=$(ls $postscript/*.ps)
187187 else
188− input=$(stripHash $postscript; echo $strippedName)
188+ input=$(stripHash $postscript)
189189 ln -s $postscript $input
190190 fi
191191
pkgs/tools/typesetting/tex/nix/dot2pdf.sh+1−1
@@ -4,7 +4,7 @@ mkdir -p $out
44
55dot2pdf() {
66 sourceFile=$1
7− targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).pdf
7+ targetName=$out/$(basename $(stripHash $sourceFile) .dot).pdf
88 echo "converting $sourceFile to $targetName..."
99 export FONTCONFIG_FILE=$fontsConf
1010 dot -Tpdf $sourceFile > $targetName
pkgs/tools/typesetting/tex/nix/dot2ps.sh+1−1
@@ -4,7 +4,7 @@ mkdir -p $out
44
55dot2ps() {
66 sourceFile=$1
7− targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).ps
7+ targetName=$out/$(basename $(stripHash $sourceFile) .dot).ps
88 echo "converting $sourceFile to $targetName..."
99 dot -Tps $sourceFile > $targetName
1010}
pkgs/tools/typesetting/tex/nix/lhs2tex.sh+1−1
@@ -10,7 +10,7 @@ cd $startDir
1010
1111lhstex() {
1212 sourceFile=$1
13− targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .lhs).tex
13+ targetName=$out/$(basename $(stripHash $sourceFile) .lhs).tex
1414 echo "converting $sourceFile to $targetName..."
1515 lhs2TeX -o "$targetName" $flags "$sourceFile"
1616}
pkgs/tools/typesetting/tex/nix/run-latex.sh+2−2
@@ -16,11 +16,11 @@ for i in $extraFiles; do
1616 if test -d $i; then
1717 ln -s $i/* .
1818 else
19− ln -s $i $(stripHash $i; echo $strippedName)
19+ ln -s $i $(stripHash $i)
2020 fi
2121done
2222
23−rootName=$(basename $(stripHash "$rootFile"; echo $strippedName))
23+rootName=$(basename $(stripHash "$rootFile"))
2424
2525rootNameBase=$(echo "$rootName" | sed 's/\..*//')
2626