diff options
author | Kerin Millar <kfm@plushkava.net> | 2023-06-26 10:03:56 +0200 |
---|---|---|
committer | Florian Schmaus <flow@gentoo.org> | 2023-06-27 17:02:55 +0200 |
commit | 028a9bb68a31af8a43d2c1ce49fbbf3735a978e9 (patch) | |
tree | a710d3774ed9337b89fb4549ada381a686323000 | |
parent | app-portage/pycargoebuild: Bump to 0.8 (diff) | |
download | gentoo-028a9bb68a31af8a43d2c1ce49fbbf3735a978e9.tar.gz gentoo-028a9bb68a31af8a43d2c1ce49fbbf3735a978e9.tar.bz2 gentoo-028a9bb68a31af8a43d2c1ce49fbbf3735a978e9.zip |
sys-fs/ncdu: refrain from using compgen to locate zig
The availability of the compgen builtin depends on whether bash was
compiled with --enable-readline. As such, it is sensible to avoid it in
scripts intended for non-interactive shells.
Though it would have been straightforward to mimic the behaviour of
compgen -c, let's just search ${BROOT}/usr/bin instead. From what I can
gather, both dev-lang/zig and dev-lang/zig-bin install a (versioned)
symlink to /usr/bin, with there being no apparent need to search
elsewhere.
While at it, address an error of logic whereby ZIG_VER was defined as
the value of ver, rather than selected_ver.
Closes: https://bugs.gentoo.org/909163
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Florian Schmaus <flow@gentoo.org>
-rw-r--r-- | sys-fs/ncdu/ncdu-2.2.2-r1.ebuild | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/sys-fs/ncdu/ncdu-2.2.2-r1.ebuild b/sys-fs/ncdu/ncdu-2.2.2-r1.ebuild index 74c745fa8f11..fde041c1e0f4 100644 --- a/sys-fs/ncdu/ncdu-2.2.2-r1.ebuild +++ b/sys-fs/ncdu/ncdu-2.2.2-r1.ebuild @@ -49,21 +49,14 @@ zig-set_EZIG() { return fi - local candidates candidate selected selected_ver + local candidate selected selected_ver ver - candidates=$(compgen -c zig-) - - for candidate in ${candidates}; do - if [[ ! ${candidate} =~ zig(-bin)?-([.0-9]+) ]]; then + for candidate in "${BROOT}"/usr/bin/zig-*; do + if [[ ! -L ${candidate} || ${candidate} != */zig?(-bin)-+([0-9.]) ]]; then continue fi - local ver - if (( ${#BASH_REMATCH[@]} == 3 )); then - ver="${BASH_REMATCH[2]}" - else - ver="${BASH_REMATCH[1]}" - fi + ver=${candidate##*-} if [[ -n ${EZIG_EXACT_VER} ]]; then ver_test "${ver}" -ne "${EZIG_EXACT_VER}" && continue @@ -96,11 +89,11 @@ zig-set_EZIG() { done if [[ -z ${selected} ]]; then - die "Could not find (suitable) zig installation in PATH" + die "Could not find (suitable) zig installation in ${BROOT}/usr/bin" fi export EZIG="${selected}" - export EZIG_VER="${ver}" + export EZIG_VER="${selected_ver}" } # Invoke zig with the optionally provided arguments. |