From 90af99025807995e79d586d3f4ad5479a6f82eec Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Wed, 11 Feb 2026 14:13:30 +0100 Subject: [PATCH 1/4] Reduced noise when printing current environment The -u option enables unified diff which makes it look a little nicer. It uses +/- instead of . However, -u is not supported on HP-UX which causes the following output to be printed instead: ``` 21:28:47 ==================== Current environment ======================== 21:28:47 diff: illegal option -- u 21:28:47 usage: diff [ -C n ] [ -S name ] [ -bcefhilnrstw ] dir1 dir2 21:28:47 diff [-C n ] [ -bcefhintw ] file1 file2 21:28:47 diff [ -D string ] [ -biw ] file1 file2 21:28:47 ================================================================= ``` I also changed the output to only be printed if there is an actual change in the environment. This way, we won't print the environment every time this script is sourced. Ticket: ENT-12619 Signed-off-by: Lars Erik Wik --- build-scripts/detect-environment | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/build-scripts/detect-environment b/build-scripts/detect-environment index 5dd6d3299..920069f4d 100644 --- a/build-scripts/detect-environment +++ b/build-scripts/detect-environment @@ -425,15 +425,14 @@ detect_environment # Print the environment variables so that the log can be used to debug problems # stemming from wrong environment. -echo -echo -echo "==================== Current environment ========================" -# Print only what changed in the environment after sourcing this script -# - Lines staring with + are kept (these are things added to env) -# - Lines staring with +++ is filtered out (removes the "new file" header) -# - The + character is removed -env | sort | diff -u env_before - | grep '^\+' | grep -v '^+++' | sed 's/+//' +env_diff="$(env | sort | diff env_before - | grep '^>' | sed 's/^> //')" unlink env_before -echo "=================================================================" -echo -echo +if [ -n "$env_diff" ]; then + echo + echo + echo "==================== Current environment ========================" + echo "$env_diff" + echo "=================================================================" + echo + echo +fi From adeacfd35ef9e02641a22cd49d8f2a679eddbdde Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Wed, 11 Feb 2026 14:34:50 +0100 Subject: [PATCH 2/4] Removed debug log messages from detect-environment This script is sourced many times and causes a lot of noise. All these log messages are redunant, in that the same information is printed in the end of the file. Ticket: ENT-12619 Signed-off-by: Lars Erik Wik --- build-scripts/detect-environment | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/build-scripts/detect-environment b/build-scripts/detect-environment index 920069f4d..de7c31303 100644 --- a/build-scripts/detect-environment +++ b/build-scripts/detect-environment @@ -30,12 +30,6 @@ detect_cross_target() { export CROSS_TARGET ;; esac - - if [ -n "$CROSS_TARGET" ]; then - log_debug "Detected cross target $CROSS_TARGET" - else - log_debug "No cross target detected" - fi } # This function exports operating system specific variables: @@ -112,7 +106,6 @@ detect_os() { OS_VERSION_MAJOR="${OS_VERSION%%.*}" fi - log_debug "Detected OS $OS $OS_VERSION" export OS OS_VERSION OS_VERSION_MAJOR } @@ -274,8 +267,6 @@ detect_packaging() { ;; esac - log_debug "Detected dependency packaging $DEP_PACKAGING" - log_debug "Detected packaging $PACKAGING" export DEP_PACKAGING PACKAGING } @@ -334,7 +325,6 @@ detect_arch() { ;; esac - log_debug "Detected architecture $ARCH" export ARCH } @@ -348,7 +338,6 @@ detect_tools() { if $MAKE -v | grep GNU; then export MAKE - log_debug "Detected make path $MAKE" else log_error "GNU Make not found" exit 42 @@ -360,12 +349,10 @@ detect_tools() { # systems. We use it to kill processes that can mess with the build process. FUSER=$(func_whereis fuser) export FUSER - log_debug "Detected fuser path $FUSER" # We use patch to apply patches to the dependencies. PATCH=$(func_whereis gpatch patch) export PATCH - log_debug "Detected patch path $PATCH" } # This function appends the -j/--jobs option to the MAKEFLAGS environment @@ -375,19 +362,15 @@ detect_tools() { detect_cores() { case "$OS_FAMILY" in aix) - log_debug "Detected OS family is aix" NUM_CORES="$(lscfg | grep -c proc)" ;; solaris) - log_debug "Detected OS family is solaris" NUM_CORES="$(psrinfo | wc -l)" ;; linux) - log_debug "Detected OS family is linux" NUM_CORES="$(grep -c '^processor' /proc/cpuinfo)" ;; hpux) - log_debug "Detected OS family is hpux" NUM_CORES="$(ioscan -k -C processor | grep -c processor)" ;; *) @@ -397,7 +380,6 @@ detect_cores() { esac # Make number of jobs one higher than core count, to account for I/O, network, etc. - log_debug "Detected amount of CPU cores is $NUM_CORES" MAKEFLAGS="${MAKEFLAGS:--j$((NUM_CORES + 1))}" export MAKEFLAGS } From 84ad894ef1613122950801a5503d03d750374c97 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Wed, 11 Feb 2026 14:40:01 +0100 Subject: [PATCH 3/4] Reduce noise by using -q when grepping for GNU in make Ticket: ENT-12619 Signed-off-by: Lars Erik Wik --- build-scripts/detect-environment | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-scripts/detect-environment b/build-scripts/detect-environment index de7c31303..d70f74b3b 100644 --- a/build-scripts/detect-environment +++ b/build-scripts/detect-environment @@ -336,7 +336,7 @@ detect_tools() { # various dependencies have various requirements MAKE=$(func_whereis gmake make) - if $MAKE -v | grep GNU; then + if $MAKE -v | grep -q GNU; then export MAKE else log_error "GNU Make not found" From 415733c70f1b37eb0e3daa7d42421c365470dfea Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Fri, 13 Feb 2026 09:44:49 +0100 Subject: [PATCH 4/4] Now prints "Changes to environment after sourcing this script" Signed-off-by: Lars Erik Wik --- build-scripts/detect-environment | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-scripts/detect-environment b/build-scripts/detect-environment index d70f74b3b..2cf5ea695 100644 --- a/build-scripts/detect-environment +++ b/build-scripts/detect-environment @@ -412,7 +412,7 @@ unlink env_before if [ -n "$env_diff" ]; then echo echo - echo "==================== Current environment ========================" + echo "======= Changes to environment after sourcing this script =======" echo "$env_diff" echo "=================================================================" echo