Revert "stdenv: introduce baseHash() to replace stripHash()"

Introduced by mistake

This reverts commit e71a5cb87841f0af4a2279517b77a9a07ba394c0.

+29 -38
+13 -17
doc/stdenv.xml
··· 1191 1191 <replaceable>file</replaceable>.</para></listitem> 1192 1192 </varlistentry> 1193 1193 1194 - <varlistentry xml:id='fun-baseHash'> 1195 - <term> 1196 - <function>baseHash</function> 1197 - <replaceable>path</replaceable> 1198 - <replaceable>suffix</replaceable> 1199 - </term> 1194 + 1195 + <varlistentry xml:id='fun-stripHash'> 1196 + <term><function>stripHash</function> 1197 + <replaceable>path</replaceable></term> 1200 1198 <listitem><para>Strips the directory and hash part of a store 1201 1199 path, storing the name part in the environment variable 1202 - <literal>strippedName</literal>. If <literal>suffix</literal> is also 1203 - provided, the suffix will also be removed. For example:</para> 1200 + <literal>strippedName</literal>. For example: 1204 1201 1205 1202 <programlisting> 1206 - baseHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" 1203 + stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" 1207 1204 # prints coreutils-8.24 1205 + echo $strippedName 1208 1206 </programlisting> 1209 1207 1208 + If you wish to store the result in another variable, then the 1209 + following idiom may be useful: 1210 + 1210 1211 <programlisting> 1211 - baseHash "/nix/store/0016702zbydafsr20n9l1dcw7x2bf6jj-arraysugar-0.1.0.gem" .gem 1212 - # prints arraysugar-0.1.0 1212 + name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24" 1213 + someVar=$(stripHash $name; echo $strippedName) 1213 1214 </programlisting> 1214 - </listitem> 1215 1215 1216 + </para></listitem> 1216 1217 </varlistentry> 1217 1218 1218 - <varlistentry xml:id='fun-stripHash'> 1219 - <term><function>stripHash</function> 1220 - <replaceable>path</replaceable></term> 1221 - <listitem><para>Deprecated. Use baseHash instead.</para></listitem> 1222 - </varlistentry> 1223 1219 1224 1220 </variablelist> 1225 1221
+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/$(baseHash $i | sed 's/\.in//') 15 + dst=$out/$subDir/$((stripHash $i; echo $strippedName) | 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/$(baseHash $i | sed 's/\.in//') 26 + dst=$out/$subDir/$((stripHash $i; echo $strippedName) | sed 's/\.in//') 27 27 doSub $i $dst 28 28 fi 29 29 done
+2 -1
pkgs/build-support/vm/default.nix
··· 531 531 532 532 # Hacky: RPM looks for <basename>.spec inside the tarball, so 533 533 # strip off the hash. 534 - srcName=$(baseHash "$src") 534 + stripHash "$src" 535 + srcName="$strippedName" 535 536 cp "$src" "$srcName" # `ln' doesn't work always work: RPM requires that the file is owned by root 536 537 537 538 export HOME=/tmp/home
+1 -1
pkgs/data/fonts/droid/default.nix
··· 41 41 sourceRoot = "./"; 42 42 43 43 unpackCmd = '' 44 - ttfName=$(baseHash $curSrc) 44 + ttfName=$(basename $(stripHash $curSrc; echo $strippedName)) 45 45 cp $curSrc ./$ttfName 46 46 ''; 47 47
+2 -1
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 - cp -p $catalog $(baseHash $catalog) 6 + stripHash $catalog 7 + cp -p $catalog $strippedName
+2 -9
pkgs/stdenv/generic/setup.sh
··· 484 484 } 485 485 486 486 487 - # DEPRECATED, use baseHash - 2016-06-23 487 + # Utility function: return the base name of the given path, with the 488 + # prefix `HASH-' removed, if present. 488 489 stripHash() { 489 490 strippedName=$(basename $1); 490 491 if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then ··· 492 493 fi 493 494 } 494 495 495 - # Print NAME with any leading directory components and hash removed. 496 - # If specified, also remove a trailing SUFFIX. 497 - # 498 - # Usage: baseHash NAME [SUFFIX] 499 - # Usage: baseName -a [-s SUFFIX] NAME... 500 - baseHash() { 501 - basename "$@" | sed -s 's/^[a-z0-9]\{32\}-//g' 502 - } 503 496 504 497 unpackCmdHooks+=(_defaultUnpack) 505 498 _defaultUnpack() {
+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/$(baseHash $dotGraph .dot)-f-$i.dot 7 + targetName=$out/$(basename $(stripHash $dotGraph; echo $strippedName) .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=$(baseHash $postscript) 188 + input=$(stripHash $postscript; echo $strippedName) 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/$(baseHash $sourceFile .dot).pdf 7 + targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .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/$(baseHash $sourceFile .dot).ps 7 + targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .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/$(baseHash $sourceFile .lhs).tex 13 + targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .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 $(baseHash $i) 19 + ln -s $i $(stripHash $i; echo $strippedName) 20 20 fi 21 21 done 22 22 23 - rootName=$(baseHash "$rootFile") 23 + rootName=$(basename $(stripHash "$rootFile"; echo $strippedName)) 24 24 25 25 rootNameBase=$(echo "$rootName" | sed 's/\..*//') 26 26