commit: a243e326cfe29ddd42097a49bf37fe2e9d97cf84
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Jun 19 22:36:34 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jun 20 05:45:35 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a243e326
emerge-webrsync: simplify the tests for emerge and portageq
Presently, emerge-webrsync tries to locate the emerge and portageq
binaries by capturing the output of type -P then testing whether the
output was empty. Simplify these tests by acting upon the exit status of
the type builtin itself.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/emerge-webrsync | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
index 17e46767ca..ffe8096906 100755
--- a/bin/emerge-webrsync
+++ b/bin/emerge-webrsync
@@ -606,10 +606,12 @@ do_latest_snapshot() {
# Use emerge and portageq from the same directory/prefix as the current script,
# so that we don't have to rely on PATH including the current EPREFIX.
-emerge=$(PATH="${BASH_SOURCE[0]%/*}:${PATH}" type -P emerge)
-[[ -n ${emerge} ]] || die "could not find 'emerge'; aborting"
-portageq=$(PATH="${BASH_SOURCE[0]%/*}:${PATH}" type -P portageq)
-[[ -n ${portageq} ]] || die "could not find 'portageq'; aborting"
+if ! emerge=$(PATH=${BASH_SOURCE%/*}:${PATH} type -P emerge); then
+ die "could not find 'emerge'; aborting"
+fi
+if ! portageq=$(PATH=${BASH_SOURCE%/*}:${PATH} type -P portageq); then
+ die "could not find 'portageq'; aborting"
+fi
eval "$("${portageq}" envvar -v DISTDIR EPREFIX FEATURES \
FETCHCOMMAND GENTOO_MIRRORS \