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