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.

authored by Profpatsch and committed by Franz Pletz bef6bef0 8417c3aa

+27 -22
+4 -5
doc/stdenv.xml
··· 1231 <term><function>stripHash</function> 1232 <replaceable>path</replaceable></term> 1233 <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: 1236 1237 <programlisting> 1238 stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" 1239 - # prints coreutils-8.24 1240 - echo $strippedName 1241 </programlisting> 1242 1243 If you wish to store the result in another variable, then the ··· 1245 1246 <programlisting> 1247 name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" 1248 - someVar=$(stripHash $name; echo $strippedName) 1249 </programlisting> 1250 1251 </para></listitem>
··· 1231 <term><function>stripHash</function> 1232 <replaceable>path</replaceable></term> 1233 <listitem><para>Strips the directory and hash part of a store 1234 + path, outputting the name part to <literal>stdout</literal>. 1235 + For example: 1236 1237 <programlisting> 1238 + # prints coreutils-8.24 1239 stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" 1240 </programlisting> 1241 1242 If you wish to store the result in another variable, then the ··· 1244 1245 <programlisting> 1246 name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" 1247 + someVar=$(stripHash $name) 1248 </programlisting> 1249 1250 </para></listitem>
+8
nixos/doc/manual/release-notes/rl-1703.xml
··· 50 which prevents ptracing non-child processes. 51 This means you will not be able to attach gdb to an existing process, 52 but will need to start that process from gdb (so it is a child). 53 </para> 54 </listitem> 55 </itemizedlist>
··· 50 which prevents ptracing non-child processes. 51 This means you will not be able to attach gdb to an existing process, 52 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>. 61 </para> 62 </listitem> 63 </itemizedlist>
+2 -2
nixos/modules/services/networking/ircd-hybrid/builder.sh
··· 12 if test "$(echo $i | cut -c1-2)" = "=>"; then 13 subDir=$(echo $i | cut -c3-) 14 else 15 - dst=$out/$subDir/$((stripHash $i; echo $strippedName) | sed 's/\.in//') 16 doSub $i $dst 17 chmod +x $dst # !!! 18 fi ··· 23 if test "$(echo $i | cut -c1-2)" = "=>"; then 24 subDir=$(echo $i | cut -c3-) 25 else 26 - dst=$out/$subDir/$((stripHash $i; echo $strippedName) | sed 's/\.in//') 27 doSub $i $dst 28 fi 29 done
··· 12 if test "$(echo $i | cut -c1-2)" = "=>"; then 13 subDir=$(echo $i | cut -c3-) 14 else 15 + dst=$out/$subDir/$(stripHash $i | sed 's/\.in//') 16 doSub $i $dst 17 chmod +x $dst # !!! 18 fi ··· 23 if test "$(echo $i | cut -c1-2)" = "=>"; then 24 subDir=$(echo $i | cut -c3-) 25 else 26 + dst=$out/$subDir/$(stripHash $i | sed 's/\.in//') 27 doSub $i $dst 28 fi 29 done
+1 -2
pkgs/build-support/vm/default.nix
··· 537 538 # Hacky: RPM looks for <basename>.spec inside the tarball, so 539 # strip off the hash. 540 - stripHash "$src" 541 - srcName="$strippedName" 542 cp "$src" "$srcName" # `ln' doesn't work always work: RPM requires that the file is owned by root 543 544 export HOME=/tmp/home
··· 537 538 # Hacky: RPM looks for <basename>.spec inside the tarball, so 539 # strip off the hash. 540 + srcName="$(stripHash "$src")" 541 cp "$src" "$srcName" # `ln' doesn't work always work: RPM requires that the file is owned by root 542 543 export HOME=/tmp/home
+1 -1
pkgs/data/fonts/droid/default.nix
··· 41 sourceRoot = "./"; 42 43 unpackCmd = '' 44 - ttfName=$(basename $(stripHash $curSrc; echo $strippedName)) 45 cp $curSrc ./$ttfName 46 ''; 47
··· 41 sourceRoot = "./"; 42 43 unpackCmd = '' 44 + ttfName=$(basename $(stripHash $curSrc)) 45 cp $curSrc ./$ttfName 46 ''; 47
+1 -1
pkgs/data/fonts/roboto-mono/default.nix
··· 54 sourceRoot = "./"; 55 56 unpackCmd = '' 57 - ttfName=$(basename $(stripHash $curSrc; echo $strippedName)) 58 cp $curSrc ./$ttfName 59 ''; 60
··· 54 sourceRoot = "./"; 55 56 unpackCmd = '' 57 + ttfName=$(basename $(stripHash $curSrc)) 58 cp $curSrc ./$ttfName 59 ''; 60
+1 -1
pkgs/data/fonts/roboto-slab/default.nix
··· 30 sourceRoot = "./"; 31 32 unpackCmd = '' 33 - ttfName=$(basename $(stripHash $curSrc; echo $strippedName)) 34 cp $curSrc ./$ttfName 35 ''; 36
··· 30 sourceRoot = "./"; 31 32 unpackCmd = '' 33 + ttfName=$(basename $(stripHash $curSrc)) 34 cp $curSrc ./$ttfName 35 ''; 36
+1 -2
pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh
··· 3 mkdir -p $out/xml/dtd/docbook-ebnf 4 cd $out/xml/dtd/docbook-ebnf 5 cp -p $dtd dbebnf.dtd 6 - stripHash $catalog 7 - cp -p $catalog $strippedName
··· 3 mkdir -p $out/xml/dtd/docbook-ebnf 4 cd $out/xml/dtd/docbook-ebnf 5 cp -p $dtd dbebnf.dtd 6 + cp -p $catalog $(stripHash $catalog)
+1 -1
pkgs/stdenv/generic/setup.sh
··· 495 stripHash() { 496 strippedName=$(basename $1); 497 if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then 498 - strippedName=$(echo "$strippedName" | cut -c34-) 499 fi 500 } 501
··· 495 stripHash() { 496 strippedName=$(basename $1); 497 if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then 498 + echo "$strippedName" | cut -c34- 499 fi 500 } 501
+1 -1
pkgs/tools/typesetting/tex/nix/animatedot.sh
··· 4 5 for ((i = 1; i <= $nrFrames; i++)); do 6 echo "producing frame $i..."; 7 - targetName=$out/$(basename $(stripHash $dotGraph; echo $strippedName) .dot)-f-$i.dot 8 cpp -DFRAME=$i < $dotGraph > $targetName 9 done
··· 4 5 for ((i = 1; i <= $nrFrames; i++)); do 6 echo "producing frame $i..."; 7 + targetName=$out/$(basename $(stripHash $dotGraph) .dot)-f-$i.dot 8 cpp -DFRAME=$i < $dotGraph > $targetName 9 done
+1 -1
pkgs/tools/typesetting/tex/nix/default.nix
··· 185 if test -d $postscript; then 186 input=$(ls $postscript/*.ps) 187 else 188 - input=$(stripHash $postscript; echo $strippedName) 189 ln -s $postscript $input 190 fi 191
··· 185 if test -d $postscript; then 186 input=$(ls $postscript/*.ps) 187 else 188 + input=$(stripHash $postscript) 189 ln -s $postscript $input 190 fi 191
+1 -1
pkgs/tools/typesetting/tex/nix/dot2pdf.sh
··· 4 5 dot2pdf() { 6 sourceFile=$1 7 - targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).pdf 8 echo "converting $sourceFile to $targetName..." 9 export FONTCONFIG_FILE=$fontsConf 10 dot -Tpdf $sourceFile > $targetName
··· 4 5 dot2pdf() { 6 sourceFile=$1 7 + targetName=$out/$(basename $(stripHash $sourceFile) .dot).pdf 8 echo "converting $sourceFile to $targetName..." 9 export FONTCONFIG_FILE=$fontsConf 10 dot -Tpdf $sourceFile > $targetName
+1 -1
pkgs/tools/typesetting/tex/nix/dot2ps.sh
··· 4 5 dot2ps() { 6 sourceFile=$1 7 - targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).ps 8 echo "converting $sourceFile to $targetName..." 9 dot -Tps $sourceFile > $targetName 10 }
··· 4 5 dot2ps() { 6 sourceFile=$1 7 + targetName=$out/$(basename $(stripHash $sourceFile) .dot).ps 8 echo "converting $sourceFile to $targetName..." 9 dot -Tps $sourceFile > $targetName 10 }
+1 -1
pkgs/tools/typesetting/tex/nix/lhs2tex.sh
··· 10 11 lhstex() { 12 sourceFile=$1 13 - targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .lhs).tex 14 echo "converting $sourceFile to $targetName..." 15 lhs2TeX -o "$targetName" $flags "$sourceFile" 16 }
··· 10 11 lhstex() { 12 sourceFile=$1 13 + targetName=$out/$(basename $(stripHash $sourceFile) .lhs).tex 14 echo "converting $sourceFile to $targetName..." 15 lhs2TeX -o "$targetName" $flags "$sourceFile" 16 }
+2 -2
pkgs/tools/typesetting/tex/nix/run-latex.sh
··· 16 if test -d $i; then 17 ln -s $i/* . 18 else 19 - ln -s $i $(stripHash $i; echo $strippedName) 20 fi 21 done 22 23 - rootName=$(basename $(stripHash "$rootFile"; echo $strippedName)) 24 25 rootNameBase=$(echo "$rootName" | sed 's/\..*//') 26
··· 16 if test -d $i; then 17 ln -s $i/* . 18 else 19 + ln -s $i $(stripHash $i) 20 fi 21 done 22 23 + rootName=$(basename $(stripHash "$rootFile")) 24 25 rootNameBase=$(echo "$rootName" | sed 's/\..*//') 26