overlays.rust: fix fromManifest postBuild realpath for rust-src build

When building rust-src like in
```
nix build --impure -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/tags/23.05.tar.gz --argstr PWD $PWD --expr '{ PWD }:(import <nixpkgs> { overlays = (builtins.getFlake PWD).overlays.rust ];}).latest.rustChannels.stable.rust-src' -L --out-link rust-src-stable
```
after fixing the previous error the build failed since commit f6fe8508b0 with an error like
```
realpath: missing operand
```
because, bash shopt nullglob is enabled during build which leads to a
non-existing glob matching pattern to be a null string and therefore
the check with `ls $out/lib/librustc_driver-*.so` lists the whole
directory and succeeds.
```
bash -c 'shopt -s nullglob; if ls $PWD/rust-o*.nixxxxxxxxxxx &> /dev/null ; then echo yes ; else echo no ; fi'
yes
```

This commit changes the check to compare the null string resulting
from glob pattern match with nullglob enabled against another null
string.
This commit is contained in:
Christian Albrecht 2023-07-27 23:27:55 +02:00 коммит произвёл Nicolas B. Pierron
Родитель cadfc54b24
Коммит db89c8707e
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -297,7 +297,7 @@ let
# Here we copy the librustc_driver-*.so to our derivation.
# The SYSROOT is determined based on the path of this library.
if ls $out/lib/librustc_driver-*.so &> /dev/null; then
if test "" != $out/lib/librustc_driver-*.so &> /dev/null; then
RUSTC_DRIVER_PATH=$(realpath -e $out/lib/librustc_driver-*.so)
rm $out/lib/librustc_driver-*.so
cp $RUSTC_DRIVER_PATH $out/lib/