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

Introduced by mistake

This reverts commit e71a5cb87841f0af4a2279517b77a9a07ba394c0.

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