aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2024-07-23 17:05:51 +0100
committerSam James <sam@gentoo.org>2024-07-26 11:22:40 +0100
commitcc793fb5f0d7c39c904f9e209b804d8f762a96cd (patch)
treee55f9a97b11b1dcd21418c05ec3e8bff49864bd7
parentmake.globals: add bcachefs_effective.* and bcachefs.* to PORTAGE_XATTR_EXCLUDE (diff)
downloadportage-cc793fb5f0d7c39c904f9e209b804d8f762a96cd.tar.gz
portage-cc793fb5f0d7c39c904f9e209b804d8f762a96cd.tar.bz2
portage-cc793fb5f0d7c39c904f9e209b804d8f762a96cd.zip
Check whether xtrace is enabled sensibly
To write [[ ${-/x/} != $- ]] is horribly backwards and comparatively expensive. Implement the test - and its inverse - in a sensible fashion. Signed-off-by: Kerin Millar <kfm@plushkava.net> Signed-off-by: Sam James <sam@gentoo.org>
-rwxr-xr-xbin/ebuild.sh4
-rw-r--r--bin/install-qa-check.d/90cython-dep2
-rw-r--r--bin/install-qa-check.d/90gcc-warnings2
-rw-r--r--bin/phase-functions.sh6
4 files changed, 7 insertions, 7 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 8b1e0861a..a742397db 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -473,7 +473,7 @@ __try_source() {
if [[ -r ${1} && -f ${1} ]]; then
local debug_on=false
- if [[ "${PORTAGE_DEBUG}" == "1" ]] && [[ "${-/x/}" == "$-" ]]; then
+ if [[ ${PORTAGE_DEBUG} == 1 ]] && [[ $- != *x* ]]; then
debug_on=true
fi
@@ -628,7 +628,7 @@ if ! has "${EBUILD_PHASE}" clean cleanrm ; then
unset E_RESTRICT PROVIDES_EXCLUDE REQUIRES_EXCLUDE
unset PORTAGE_EXPLICIT_INHERIT
- if [[ ${PORTAGE_DEBUG} != 1 || ${-/x/} != $- ]] ; then
+ if [[ ${PORTAGE_DEBUG} != 1 || $- == *x* ]] ; then
source "${EBUILD}" || die "error sourcing ebuild"
else
set -x
diff --git a/bin/install-qa-check.d/90cython-dep b/bin/install-qa-check.d/90cython-dep
index 4932c0242..2458074c3 100644
--- a/bin/install-qa-check.d/90cython-dep
+++ b/bin/install-qa-check.d/90cython-dep
@@ -13,7 +13,7 @@ cython_dep_check() {
# In debug mode, the grep calls will produce false positives
# if they're shown in the trace.
local reset_debug=0
- if [[ ${-/x/} != $- ]] ; then
+ if [[ $- == *x* ]] ; then
set +x
reset_debug=1
fi
diff --git a/bin/install-qa-check.d/90gcc-warnings b/bin/install-qa-check.d/90gcc-warnings
index 1060618df..2e728268e 100644
--- a/bin/install-qa-check.d/90gcc-warnings
+++ b/bin/install-qa-check.d/90gcc-warnings
@@ -10,7 +10,7 @@ gcc_warn_check() {
# In debug mode, this variable definition and corresponding grep calls
# will produce false positives if they're shown in the trace.
local reset_debug=0
- if [[ ${-/x/} != $- ]] ; then
+ if [[ $- == *x* ]] ; then
set +x
reset_debug=1
fi
diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index d037cf677..2c3f2d389 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -1002,7 +1002,7 @@ __ebuild_main() {
ewarn "pkg_${1}() is not defined: '${EBUILD##*/}'"
fi
export SANDBOX_ON="0"
- if [[ "${PORTAGE_DEBUG}" != "1" || "${-/x/}" != "$-" ]]; then
+ if [[ ${PORTAGE_DEBUG} != 1 || $- == *x* ]]; then
__ebuild_phase_with_hooks pkg_${1}
else
set -x
@@ -1069,7 +1069,7 @@ __ebuild_main() {
;;
esac
- if [[ "${PORTAGE_DEBUG}" != "1" || "${-/x/}" != "$-" ]]; then
+ if [[ ${PORTAGE_DEBUG} != 1 || $- == *x* ]]; then
__dyn_${1}
else
set -x
@@ -1083,7 +1083,7 @@ __ebuild_main() {
# for example, awking and piping a file in /tmp requires a temp file to be created
# in /etc. If pkg_setup is in the sandbox, both our lilo and apache ebuilds break.
export SANDBOX_ON="0"
- if [[ "${PORTAGE_DEBUG}" != "1" || "${-/x/}" != "$-" ]]; then
+ if [[ ${PORTAGE_DEBUG} != 1 || $- == *x* ]]; then
__dyn_${1}
else
set -x