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.
This commit is contained in:
parent
8417c3aae1
commit
bef6bef0d2
@ -1231,13 +1231,12 @@ echo @foo@
|
|||||||
<term><function>stripHash</function>
|
<term><function>stripHash</function>
|
||||||
<replaceable>path</replaceable></term>
|
<replaceable>path</replaceable></term>
|
||||||
<listitem><para>Strips the directory and hash part of a store
|
<listitem><para>Strips the directory and hash part of a store
|
||||||
path, storing the name part in the environment variable
|
path, outputting the name part to <literal>stdout</literal>.
|
||||||
<literal>strippedName</literal>. For example:
|
For example:
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
|
|
||||||
# prints coreutils-8.24
|
# prints coreutils-8.24
|
||||||
echo $strippedName
|
stripHash "/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
If you wish to store the result in another variable, then the
|
If you wish to store the result in another variable, then the
|
||||||
@ -1245,7 +1244,7 @@ echo $strippedName
|
|||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
|
name="/nix/store/9s9r019176g7cvn2nvcw41gsp862y6b4-coreutils-8.24"
|
||||||
someVar=$(stripHash $name; echo $strippedName)
|
someVar=$(stripHash $name)
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
|
@ -50,6 +50,14 @@ following incompatible changes:</para>
|
|||||||
which prevents ptracing non-child processes.
|
which prevents ptracing non-child processes.
|
||||||
This means you will not be able to attach gdb to an existing process,
|
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).
|
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>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
@ -12,7 +12,7 @@ for i in $scripts; do
|
|||||||
if test "$(echo $i | cut -c1-2)" = "=>"; then
|
if test "$(echo $i | cut -c1-2)" = "=>"; then
|
||||||
subDir=$(echo $i | cut -c3-)
|
subDir=$(echo $i | cut -c3-)
|
||||||
else
|
else
|
||||||
dst=$out/$subDir/$((stripHash $i; echo $strippedName) | sed 's/\.in//')
|
dst=$out/$subDir/$(stripHash $i | sed 's/\.in//')
|
||||||
doSub $i $dst
|
doSub $i $dst
|
||||||
chmod +x $dst # !!!
|
chmod +x $dst # !!!
|
||||||
fi
|
fi
|
||||||
@ -23,7 +23,7 @@ for i in $substFiles; do
|
|||||||
if test "$(echo $i | cut -c1-2)" = "=>"; then
|
if test "$(echo $i | cut -c1-2)" = "=>"; then
|
||||||
subDir=$(echo $i | cut -c3-)
|
subDir=$(echo $i | cut -c3-)
|
||||||
else
|
else
|
||||||
dst=$out/$subDir/$((stripHash $i; echo $strippedName) | sed 's/\.in//')
|
dst=$out/$subDir/$(stripHash $i | sed 's/\.in//')
|
||||||
doSub $i $dst
|
doSub $i $dst
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -537,8 +537,7 @@ rec {
|
|||||||
|
|
||||||
# Hacky: RPM looks for <basename>.spec inside the tarball, so
|
# Hacky: RPM looks for <basename>.spec inside the tarball, so
|
||||||
# strip off the hash.
|
# strip off the hash.
|
||||||
stripHash "$src"
|
srcName="$(stripHash "$src")"
|
||||||
srcName="$strippedName"
|
|
||||||
cp "$src" "$srcName" # `ln' doesn't work always work: RPM requires that the file is owned by root
|
cp "$src" "$srcName" # `ln' doesn't work always work: RPM requires that the file is owned by root
|
||||||
|
|
||||||
export HOME=/tmp/home
|
export HOME=/tmp/home
|
||||||
|
@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
|
|||||||
sourceRoot = "./";
|
sourceRoot = "./";
|
||||||
|
|
||||||
unpackCmd = ''
|
unpackCmd = ''
|
||||||
ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
|
ttfName=$(basename $(stripHash $curSrc))
|
||||||
cp $curSrc ./$ttfName
|
cp $curSrc ./$ttfName
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
|
|||||||
sourceRoot = "./";
|
sourceRoot = "./";
|
||||||
|
|
||||||
unpackCmd = ''
|
unpackCmd = ''
|
||||||
ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
|
ttfName=$(basename $(stripHash $curSrc))
|
||||||
cp $curSrc ./$ttfName
|
cp $curSrc ./$ttfName
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
|
|||||||
sourceRoot = "./";
|
sourceRoot = "./";
|
||||||
|
|
||||||
unpackCmd = ''
|
unpackCmd = ''
|
||||||
ttfName=$(basename $(stripHash $curSrc; echo $strippedName))
|
ttfName=$(basename $(stripHash $curSrc))
|
||||||
cp $curSrc ./$ttfName
|
cp $curSrc ./$ttfName
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -3,5 +3,4 @@ source $stdenv/setup
|
|||||||
mkdir -p $out/xml/dtd/docbook-ebnf
|
mkdir -p $out/xml/dtd/docbook-ebnf
|
||||||
cd $out/xml/dtd/docbook-ebnf
|
cd $out/xml/dtd/docbook-ebnf
|
||||||
cp -p $dtd dbebnf.dtd
|
cp -p $dtd dbebnf.dtd
|
||||||
stripHash $catalog
|
cp -p $catalog $(stripHash $catalog)
|
||||||
cp -p $catalog $strippedName
|
|
||||||
|
@ -495,7 +495,7 @@ dumpVars() {
|
|||||||
stripHash() {
|
stripHash() {
|
||||||
strippedName=$(basename $1);
|
strippedName=$(basename $1);
|
||||||
if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then
|
if echo "$strippedName" | grep -q '^[a-z0-9]\{32\}-'; then
|
||||||
strippedName=$(echo "$strippedName" | cut -c34-)
|
echo "$strippedName" | cut -c34-
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,6 @@ mkdir -p $out
|
|||||||
|
|
||||||
for ((i = 1; i <= $nrFrames; i++)); do
|
for ((i = 1; i <= $nrFrames; i++)); do
|
||||||
echo "producing frame $i...";
|
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
|
cpp -DFRAME=$i < $dotGraph > $targetName
|
||||||
done
|
done
|
||||||
|
@ -185,7 +185,7 @@ rec {
|
|||||||
if test -d $postscript; then
|
if test -d $postscript; then
|
||||||
input=$(ls $postscript/*.ps)
|
input=$(ls $postscript/*.ps)
|
||||||
else
|
else
|
||||||
input=$(stripHash $postscript; echo $strippedName)
|
input=$(stripHash $postscript)
|
||||||
ln -s $postscript $input
|
ln -s $postscript $input
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ mkdir -p $out
|
|||||||
|
|
||||||
dot2pdf() {
|
dot2pdf() {
|
||||||
sourceFile=$1
|
sourceFile=$1
|
||||||
targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).pdf
|
targetName=$out/$(basename $(stripHash $sourceFile) .dot).pdf
|
||||||
echo "converting $sourceFile to $targetName..."
|
echo "converting $sourceFile to $targetName..."
|
||||||
export FONTCONFIG_FILE=$fontsConf
|
export FONTCONFIG_FILE=$fontsConf
|
||||||
dot -Tpdf $sourceFile > $targetName
|
dot -Tpdf $sourceFile > $targetName
|
||||||
|
@ -4,7 +4,7 @@ mkdir -p $out
|
|||||||
|
|
||||||
dot2ps() {
|
dot2ps() {
|
||||||
sourceFile=$1
|
sourceFile=$1
|
||||||
targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .dot).ps
|
targetName=$out/$(basename $(stripHash $sourceFile) .dot).ps
|
||||||
echo "converting $sourceFile to $targetName..."
|
echo "converting $sourceFile to $targetName..."
|
||||||
dot -Tps $sourceFile > $targetName
|
dot -Tps $sourceFile > $targetName
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ cd $startDir
|
|||||||
|
|
||||||
lhstex() {
|
lhstex() {
|
||||||
sourceFile=$1
|
sourceFile=$1
|
||||||
targetName=$out/$(basename $(stripHash $sourceFile; echo $strippedName) .lhs).tex
|
targetName=$out/$(basename $(stripHash $sourceFile) .lhs).tex
|
||||||
echo "converting $sourceFile to $targetName..."
|
echo "converting $sourceFile to $targetName..."
|
||||||
lhs2TeX -o "$targetName" $flags "$sourceFile"
|
lhs2TeX -o "$targetName" $flags "$sourceFile"
|
||||||
}
|
}
|
||||||
|
@ -16,11 +16,11 @@ for i in $extraFiles; do
|
|||||||
if test -d $i; then
|
if test -d $i; then
|
||||||
ln -s $i/* .
|
ln -s $i/* .
|
||||||
else
|
else
|
||||||
ln -s $i $(stripHash $i; echo $strippedName)
|
ln -s $i $(stripHash $i)
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
rootName=$(basename $(stripHash "$rootFile"; echo $strippedName))
|
rootName=$(basename $(stripHash "$rootFile"))
|
||||||
|
|
||||||
rootNameBase=$(echo "$rootName" | sed 's/\..*//')
|
rootNameBase=$(echo "$rootName" | sed 's/\..*//')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user