diff options
author | Eli Schwartz <eschwartz93@gmail.com> | 2024-05-29 19:34:59 -0400 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-05-30 00:46:07 +0100 |
commit | 7aa3a581c47230c4df31588134acd090b67cc984 (patch) | |
tree | 657963f8ccb67d3cac73ce0c930efa2152e580d8 /sci-libs | |
parent | app-portage/kuroneko: enable py3.13 (diff) | |
download | gentoo-7aa3a581c47230c4df31588134acd090b67cc984.tar.gz gentoo-7aa3a581c47230c4df31588134acd090b67cc984.tar.bz2 gentoo-7aa3a581c47230c4df31588134acd090b67cc984.zip |
sci-libs/netcdf: fix bad bash scripting leading to failed tests
If USE=-mpi, a file in src_test is NOT sedded to fix a bug in the file,
because the file does not exist. But this condition was incorrectly
coded.
In bash:
```
cmd1 && cmd2 || cmd3
```
is a code smell. If either of the first two commands fails, the third
command is run -- in this case, die. In other words, the first two
commands were *supposed* to be "only run cmd2 if it makes sense to".
Instead, if it "doesn't make sense to" run cmd2, the die was triggered.
A more general solution is to spec the build format to require all
commands to pass without manually `die`ing (leading to the use of &&
ceasing in general), but that is not how portage works. Either way, the
solution is using `if` as intended.
ref. https://mywiki.wooledge.org/BashGuide/TestsAndConditionals
Closes: https://bugs.gentoo.org/933136
Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sci-libs')
-rw-r--r-- | sci-libs/netcdf/netcdf-4.9.2-r1.ebuild | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sci-libs/netcdf/netcdf-4.9.2-r1.ebuild b/sci-libs/netcdf/netcdf-4.9.2-r1.ebuild index 458001188497..a751713a52c2 100644 --- a/sci-libs/netcdf/netcdf-4.9.2-r1.ebuild +++ b/sci-libs/netcdf/netcdf-4.9.2-r1.ebuild @@ -89,8 +89,9 @@ src_configure() { } src_test() { - [[ -f "${BUILD_DIR}/nc_test4/run_par_test.sh" ]] && \ - sed -e 's/mpiexec/mpiexec --use-hwthread-cpus/g' -i "${BUILD_DIR}/nc_test4/run_par_test.sh" || die + if [[ -f "${BUILD_DIR}/nc_test4/run_par_test.sh" ]]; then + sed -e 's/mpiexec/mpiexec --use-hwthread-cpus/g' -i "${BUILD_DIR}/nc_test4/run_par_test.sh" || die + fi cmake_src_test } |