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.
wip/yesman
Profpatsch 8 years ago committed by Franz Pletz
parent 8417c3aae1
commit bef6bef0d2
No known key found for this signature in database
GPG Key ID: 846FDED7792617B4
  1. 9
      doc/stdenv.xml
  2. 8
      nixos/doc/manual/release-notes/rl-1703.xml
  3. 4
      nixos/modules/services/networking/ircd-hybrid/builder.sh
  4. 3
      pkgs/build-support/vm/default.nix
  5. 2
      pkgs/data/fonts/droid/default.nix
  6. 2
      pkgs/data/fonts/roboto-mono/default.nix
  7. 2
      pkgs/data/fonts/roboto-slab/default.nix
  8. 3
      pkgs/data/sgml+xml/schemas/xml-dtd/docbook-ebnf/builder.sh
  9. 2
      pkgs/stdenv/generic/setup.sh
  10. 2
      pkgs/tools/typesetting/tex/nix/animatedot.sh
  11. 2
      pkgs/tools/typesetting/tex/nix/default.nix
  12. 2
      pkgs/tools/typesetting/tex/nix/dot2pdf.sh
  13. 2
      pkgs/tools/typesetting/tex/nix/dot2ps.sh
  14. 2
      pkgs/tools/typesetting/tex/nix/lhs2tex.sh
  15. 4
      pkgs/tools/typesetting/tex/nix/run-latex.sh

@ -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>

@ -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>

@ -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

@ -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

@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
sourceRoot = "./";
unpackCmd = ''
ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
ttfName=$(basename $(stripHash $curSrc))
cp $curSrc ./$ttfName
'';

@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
sourceRoot = "./";
unpackCmd = ''
ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
ttfName=$(basename $(stripHash $curSrc))
cp $curSrc ./$ttfName
'';

@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
sourceRoot = "./";
unpackCmd = ''
ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
ttfName=$(basename $(stripHash $curSrc))
cp $curSrc ./$ttfName
'';

@ -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)

@ -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
}

@ -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

@ -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

@ -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

@ -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
}

@ -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"
}

@ -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/\..*//')

Loading…
Cancel
Save