summary refs log tree commit diff
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2016-10-11 18:09:56 +0200
committerFranz Pletz <fpletz@fnordicwalking.de>2016-10-11 18:34:36 +0200
commitbef6bef0d2ce2ef7cfaa3e9f1eac2cdc793560c4 (patch)
tree6f7439b3f02e47ed1960a0b4d62ee4c01ef6d7af
parent8417c3aae100c1a46e423804a2f6a85a82816685 (diff)
downloadnixpkgs-bef6bef0d2ce2ef7cfaa3e9f1eac2cdc793560c4.tar
nixpkgs-bef6bef0d2ce2ef7cfaa3e9f1eac2cdc793560c4.tar.gz
nixpkgs-bef6bef0d2ce2ef7cfaa3e9f1eac2cdc793560c4.tar.bz2
nixpkgs-bef6bef0d2ce2ef7cfaa3e9f1eac2cdc793560c4.tar.lz
nixpkgs-bef6bef0d2ce2ef7cfaa3e9f1eac2cdc793560c4.tar.xz
nixpkgs-bef6bef0d2ce2ef7cfaa3e9f1eac2cdc793560c4.tar.zst
nixpkgs-bef6bef0d2ce2ef7cfaa3e9f1eac2cdc793560c4.zip
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.
-rw-r--r--doc/stdenv.xml9
-rw-r--r--nixos/doc/manual/release-notes/rl-1703.xml8
-rw-r--r--nixos/modules/services/networking/ircd-hybrid/builder.sh4
-rw-r--r--pkgs/build-support/vm/default.nix3
-rw-r--r--pkgs/data/fonts/droid/default.nix2
-rw-r--r--pkgs/data/fonts/roboto-mono/default.nix2
-rw-r--r--pkgs/data/fonts/roboto-slab/default.nix2
-rw-r--r--pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh3
-rw-r--r--pkgs/stdenv/generic/setup.sh2
-rw-r--r--pkgs/tools/typesetting/tex/nix/animatedot.sh2
-rw-r--r--pkgs/tools/typesetting/tex/nix/default.nix2
-rw-r--r--pkgs/tools/typesetting/tex/nix/dot2pdf.sh2
-rw-r--r--pkgs/tools/typesetting/tex/nix/dot2ps.sh2
-rw-r--r--pkgs/tools/typesetting/tex/nix/lhs2tex.sh2
-rw-r--r--pkgs/tools/typesetting/tex/nix/run-latex.sh4
15 files changed, 27 insertions, 22 deletions
diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index 2e88d6b4154..68441ea9393 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -1231,13 +1231,12 @@ echo @foo@
     <term><function>stripHash</function>
     <replaceable>path</replaceable></term>
     <listitem><para>Strips the directory and hash part of a store
-    path, storing the name part in the environment variable
-    <literal>strippedName</literal>. For example:
+    path, outputting the name part to <literal>stdout</literal>.
+    For example:
     
 <programlisting>
-stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
 # prints coreutils-8.24
-echo $strippedName
+stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
 </programlisting>
 
     If you wish to store the result in another variable, then the
@@ -1245,7 +1244,7 @@ echo $strippedName
     
 <programlisting>
 name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
-someVar=$(stripHash $name; echo $strippedName)
+someVar=$(stripHash $name)
 </programlisting>
 
     </para></listitem>
diff --git a/nixos/doc/manual/release-notes/rl-1703.xml b/nixos/doc/manual/release-notes/rl-1703.xml
index c1107977db7..34cdf9c0211 100644
--- a/nixos/doc/manual/release-notes/rl-1703.xml
+++ b/nixos/doc/manual/release-notes/rl-1703.xml
@@ -50,6 +50,14 @@ following incompatible changes:</para>
       which prevents ptracing non-child processes.
       This means you will not be able to attach gdb to an existing process,
       but will need to start that process from gdb (so it is a child).
+  </listitem>
+
+  <listitem>
+    <para>
+      The <literal>stripHash</literal> bash function in <literal>stdenv</literal>
+      changed according to its documentation; it now outputs the stripped name to
+      <literal>stdout</literal> instead of putting it in the variable
+      <literal>strippedName</literal>.
     </para>
   </listitem>
 </itemizedlist>
diff --git a/nixos/modules/services/networking/ircd-hybrid/builder.sh b/nixos/modules/services/networking/ircd-hybrid/builder.sh
index f2c92878a4d..38312210df2 100644
--- a/nixos/modules/services/networking/ircd-hybrid/builder.sh
+++ b/nixos/modules/services/networking/ircd-hybrid/builder.sh
@@ -12,7 +12,7 @@ for i in $scripts; do
     if test "$(echo $i | cut -c1-2)" = "=>"; then
         subDir=$(echo $i | cut -c3-)
     else
-        dst=$out/$subDir/$((stripHash $i; echo $strippedName) | sed 's/\.in//')
+        dst=$out/$subDir/$(stripHash $i | sed 's/\.in//')
         doSub $i $dst
         chmod +x $dst # !!!
     fi
@@ -23,7 +23,7 @@ for i in $substFiles; do
     if test "$(echo $i | cut -c1-2)" = "=>"; then
         subDir=$(echo $i | cut -c3-)
     else
-        dst=$out/$subDir/$((stripHash $i; echo $strippedName) | sed 's/\.in//')
+        dst=$out/$subDir/$(stripHash $i | sed 's/\.in//')
         doSub $i $dst
     fi
 done
diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix
index 245d0bebb45..7f89e36f752 100644
--- a/pkgs/build-support/vm/default.nix
+++ b/pkgs/build-support/vm/default.nix
@@ -537,8 +537,7 @@ rec {
 
       # Hacky: RPM looks for <basename>.spec inside the tarball, so
       # strip off the hash.
-      stripHash "$src"
-      srcName="$strippedName"
+      srcName="$(stripHash "$src")"
       cp "$src" "$srcName" # `ln' doesn't work always work: RPM requires that the file is owned by root
 
       export HOME=/tmp/home
diff --git a/pkgs/data/fonts/droid/default.nix b/pkgs/data/fonts/droid/default.nix
index 784dfe71007..8051606632d 100644
--- a/pkgs/data/fonts/droid/default.nix
+++ b/pkgs/data/fonts/droid/default.nix
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
   sourceRoot = "./";
 
   unpackCmd = ''
-    ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
+    ttfName=$(basename $(stripHash $curSrc))
     cp $curSrc ./$ttfName
   '';
 
diff --git a/pkgs/data/fonts/roboto-mono/default.nix b/pkgs/data/fonts/roboto-mono/default.nix
index 451725a6d80..e9eff414bc1 100644
--- a/pkgs/data/fonts/roboto-mono/default.nix
+++ b/pkgs/data/fonts/roboto-mono/default.nix
@@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
   sourceRoot = "./";
 
   unpackCmd = ''
-    ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
+    ttfName=$(basename $(stripHash $curSrc))
     cp $curSrc ./$ttfName
   '';
 
diff --git a/pkgs/data/fonts/roboto-slab/default.nix b/pkgs/data/fonts/roboto-slab/default.nix
index ade9fd2350e..5a8a3f3c120 100644
--- a/pkgs/data/fonts/roboto-slab/default.nix
+++ b/pkgs/data/fonts/roboto-slab/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
   sourceRoot = "./";
 
   unpackCmd = ''
-    ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
+    ttfName=$(basename $(stripHash $curSrc))
     cp $curSrc ./$ttfName
   '';
 
diff --git a/pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh b/pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh
index 70fd729297c..939305d486a 100644
--- a/pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh
+++ b/pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh
@@ -3,5 +3,4 @@ source $stdenv/setup
 mkdir -p $out/xml/dtd/docbook-ebnf
 cd $out/xml/dtd/docbook-ebnf
 cp -p $dtd dbebnf.dtd
-stripHash $catalog
-cp -p $catalog $strippedName
+cp -p $catalog $(stripHash $catalog)
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index feb82fd9226..15238a44598 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -495,7 +495,7 @@ dumpVars() {
 stripHash() {
     strippedName=$(basename $1);
     if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then
-        strippedName=$(echo "$strippedName" | cut -c34-)
+        echo "$strippedName" | cut -c34-
     fi
 }
 
diff --git a/pkgs/tools/typesetting/tex/nix/animatedot.sh b/pkgs/tools/typesetting/tex/nix/animatedot.sh
index 46a2c515e03..f038b83ff7a 100644
--- a/pkgs/tools/typesetting/tex/nix/animatedot.sh
+++ b/pkgs/tools/typesetting/tex/nix/animatedot.sh
@@ -4,6 +4,6 @@ mkdir -p $out
 
 for ((i = 1; i <= $nrFrames; i++)); do
     echo "producing frame $i...";
-    targetName=$out/$(basename $(stripHash $dotGraph; echo $strippedName) .dot)-f-$i.dot
+    targetName=$out/$(basename $(stripHash $dotGraph) .dot)-f-$i.dot
     cpp -DFRAME=$i < $dotGraph > $targetName
 done
diff --git a/pkgs/tools/typesetting/tex/nix/default.nix b/pkgs/tools/typesetting/tex/nix/default.nix
index ce5c025475a..0566e511870 100644
--- a/pkgs/tools/typesetting/tex/nix/default.nix
+++ b/pkgs/tools/typesetting/tex/nix/default.nix
@@ -185,7 +185,7 @@ rec {
         if test -d $postscript; then
           input=$(ls $postscript/*.ps)
         else
-          input=$(stripHash $postscript; echo $strippedName)
+          input=$(stripHash $postscript)
           ln -s $postscript $input
         fi
 
diff --git a/pkgs/tools/typesetting/tex/nix/dot2pdf.sh b/pkgs/tools/typesetting/tex/nix/dot2pdf.sh
index c416bf235a1..71cf601dfac 100644
--- a/pkgs/tools/typesetting/tex/nix/dot2pdf.sh
+++ b/pkgs/tools/typesetting/tex/nix/dot2pdf.sh
@@ -4,7 +4,7 @@ mkdir -p $out
 
 dot2pdf() {
     sourceFile=$1
-    targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).pdf
+    targetName=$out/$(basename $(stripHash $sourceFile) .dot).pdf
     echo "converting $sourceFile to $targetName..."
     export FONTCONFIG_FILE=$fontsConf
     dot -Tpdf $sourceFile > $targetName
diff --git a/pkgs/tools/typesetting/tex/nix/dot2ps.sh b/pkgs/tools/typesetting/tex/nix/dot2ps.sh
index c70e76ce4c7..dd8de4a23db 100644
--- a/pkgs/tools/typesetting/tex/nix/dot2ps.sh
+++ b/pkgs/tools/typesetting/tex/nix/dot2ps.sh
@@ -4,7 +4,7 @@ mkdir -p $out
 
 dot2ps() {
     sourceFile=$1
-    targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).ps
+    targetName=$out/$(basename $(stripHash $sourceFile) .dot).ps
     echo "converting $sourceFile to $targetName..."
     dot -Tps $sourceFile > $targetName
 }
diff --git a/pkgs/tools/typesetting/tex/nix/lhs2tex.sh b/pkgs/tools/typesetting/tex/nix/lhs2tex.sh
index f34b3944c8e..bfef3df6b0e 100644
--- a/pkgs/tools/typesetting/tex/nix/lhs2tex.sh
+++ b/pkgs/tools/typesetting/tex/nix/lhs2tex.sh
@@ -10,7 +10,7 @@ cd $startDir
 
 lhstex() {
     sourceFile=$1
-    targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .lhs).tex
+    targetName=$out/$(basename $(stripHash $sourceFile) .lhs).tex
     echo "converting $sourceFile to $targetName..."
     lhs2TeX -o "$targetName" $flags "$sourceFile"
 }
diff --git a/pkgs/tools/typesetting/tex/nix/run-latex.sh b/pkgs/tools/typesetting/tex/nix/run-latex.sh
index fa27520d11c..3941fdcac4a 100644
--- a/pkgs/tools/typesetting/tex/nix/run-latex.sh
+++ b/pkgs/tools/typesetting/tex/nix/run-latex.sh
@@ -16,11 +16,11 @@ for i in $extraFiles; do
     if test -d $i; then
         ln -s $i/* .
     else
-        ln -s $i $(stripHash $i; echo $strippedName)
+        ln -s $i $(stripHash $i)
     fi
 done
 
-rootName=$(basename $(stripHash "$rootFile"; echo $strippedName))
+rootName=$(basename $(stripHash "$rootFile"))
 
 rootNameBase=$(echo "$rootName" | sed 's/\..*//')