git.iko.soy/typeable/nixpkgs
on master help sign in
Revert "stdenv: introduce baseHash() to replace stripHash()"

Introduced by mistake This reverts commit e71a5cb87841f0af4a2279517b77a9a07ba394c0.

commit4f5918cd2e11082f33b3ce6a1bdcd5f70c68d3c2 authorzimbatm <zimbatm@zimbatm.com> dateSat 25 Jun 2016, 14:25 (10 years ago) parent893ab31
12 files changed+29−38
doc/stdenv.xml+13−17 nixos/modules/services/networking/ircd-hybrid/builder.sh+2−2 pkgs/build-support/vm/default.nix+2−1 pkgs/data/fonts/droid/default.nix+1−1 pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh+2−1 pkgs/stdenv/generic/setup.sh+2−9 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+13−17
@@ -1191,35 +1191,31 @@ echo @foo@
11911191 <replaceable>file</replaceable>.</para></listitem>
11921192 </varlistentry>
11931193
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>
12001198 <listitem><para>Strips the directory and hash part of a store
12011199 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:
12041201
12051202<programlisting>
1206−baseHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
1203+stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
12071204# prints coreutils-8.24
1205+echo $strippedName
12081206</programlisting>
12091207
1208+ If you wish to store the result in another variable, then the
1209+ following idiom may be useful:
1210+
12101211<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)
12131214</programlisting>
1214− </listitem>
12151215
1216+ </para></listitem>
12161217 </varlistentry>
12171218
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>
12231219
12241220</variablelist>
12251221
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/$(baseHash $i | sed 's/\.in//')
15+ dst=$out/$subDir/$((stripHash $i; echo $strippedName) | 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/$(baseHash $i | sed 's/\.in//')
26+ dst=$out/$subDir/$((stripHash $i; echo $strippedName) | sed 's/\.in//')
2727 doSub $i $dst
2828 fi
2929done
pkgs/build-support/vm/default.nix+2−1
@@ -531,7 +531,8 @@ rec {
531531
532532 # Hacky: RPM looks for <basename>.spec inside the tarball, so
533533 # strip off the hash.
534− srcName=$(baseHash "$src")
534+ stripHash "$src"
535+ srcName="$strippedName"
535536 cp "$src" "$srcName" # `ln' doesn't work always work: RPM requires that the file is owned by root
536537
537538 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=$(baseHash $curSrc)
44+ ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
4545 cp $curSrc ./$ttfName
4646 '';
4747
pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh+2−1
@@ -3,4 +3,5 @@ source $stdenv/setup
33mkdir -p $out/xml/dtd/docbook-ebnf
44cd $out/xml/dtd/docbook-ebnf
55cp -p $dtd dbebnf.dtd
6−cp -p $catalog $(baseHash $catalog)
6+stripHash $catalog
7+cp -p $catalog $strippedName
pkgs/stdenv/generic/setup.sh+2−9
@@ -484,7 +484,8 @@ dumpVars() {
484484}
485485
486486
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.
488489stripHash() {
489490 strippedName=$(basename $1);
490491 if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then
@@ -492,14 +493,6 @@ stripHash() {
492493 fi
493494}
494495
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−}
503496
504497unpackCmdHooks+=(_defaultUnpack)
505498_defaultUnpack() {
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/$(baseHash $dotGraph .dot)-f-$i.dot
7+ targetName=$out/$(basename $(stripHash $dotGraph; echo $strippedName) .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=$(baseHash $postscript)
188+ input=$(stripHash $postscript; echo $strippedName)
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/$(baseHash $sourceFile .dot).pdf
7+ targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .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/$(baseHash $sourceFile .dot).ps
7+ targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .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/$(baseHash $sourceFile .lhs).tex
13+ targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .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 $(baseHash $i)
19+ ln -s $i $(stripHash $i; echo $strippedName)
2020 fi
2121done
2222
23−rootName=$(baseHash "$rootFile")
23+rootName=$(basename $(stripHash "$rootFile"; echo $strippedName))
2424
2525rootNameBase=$(echo "$rootName" | sed 's/\..*//')
2626