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.

Changed files
+27 -22
doc
nixos
doc
manual
release-notes
modules
services
networking
ircd-hybrid
pkgs
build-support
data
fonts
droid
roboto-mono
roboto-slab
sgml+xml
schemas
xml-dtd
docbook-ebnf
stdenv
generic
tools
+4 -5
doc/stdenv.xml
···
<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>
+
# prints coreutils-8.24
stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
-
# prints coreutils-8.24
-
echo $strippedName
</programlisting>
If you wish to store the result in another variable, then the
···
<programlisting>
name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
-
someVar=$(stripHash $name; echo $strippedName)
+
someVar=$(stripHash $name)
</programlisting>
</para></listitem>
+8
nixos/doc/manual/release-notes/rl-1703.xml
···
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>
+2 -2
nixos/modules/services/networking/ircd-hybrid/builder.sh
···
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
···
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
+1 -2
pkgs/build-support/vm/default.nix
···
# 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
+1 -1
pkgs/data/fonts/droid/default.nix
···
sourceRoot = "./";
unpackCmd = ''
-
ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
+
ttfName=$(basename $(stripHash $curSrc))
cp $curSrc ./$ttfName
'';
+1 -1
pkgs/data/fonts/roboto-mono/default.nix
···
sourceRoot = "./";
unpackCmd = ''
-
ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
+
ttfName=$(basename $(stripHash $curSrc))
cp $curSrc ./$ttfName
'';
+1 -1
pkgs/data/fonts/roboto-slab/default.nix
···
sourceRoot = "./";
unpackCmd = ''
-
ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
+
ttfName=$(basename $(stripHash $curSrc))
cp $curSrc ./$ttfName
'';
+1 -2
pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh
···
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)
+1 -1
pkgs/stdenv/generic/setup.sh
···
stripHash() {
strippedName=$(basename $1);
if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then
-
strippedName=$(echo "$strippedName" | cut -c34-)
+
echo "$strippedName" | cut -c34-
fi
}
+1 -1
pkgs/tools/typesetting/tex/nix/animatedot.sh
···
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
+1 -1
pkgs/tools/typesetting/tex/nix/default.nix
···
if test -d $postscript; then
input=$(ls $postscript/*.ps)
else
-
input=$(stripHash $postscript; echo $strippedName)
+
input=$(stripHash $postscript)
ln -s $postscript $input
fi
+1 -1
pkgs/tools/typesetting/tex/nix/dot2pdf.sh
···
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
+1 -1
pkgs/tools/typesetting/tex/nix/dot2ps.sh
···
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
}
+1 -1
pkgs/tools/typesetting/tex/nix/lhs2tex.sh
···
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"
}
+2 -2
pkgs/tools/typesetting/tex/nix/run-latex.sh
···
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/\..*//')