Skip to content

Commit bd319e4

Browse files
authored
Merge pull request #2109 from larsewi/noice
Reduced noise in detect-environment
2 parents a4107dd + 415733c commit bd319e4

1 file changed

Lines changed: 11 additions & 30 deletions

File tree

build-scripts/detect-environment

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ detect_cross_target() {
3030
export CROSS_TARGET
3131
;;
3232
esac
33-
34-
if [ -n "$CROSS_TARGET" ]; then
35-
log_debug "Detected cross target $CROSS_TARGET"
36-
else
37-
log_debug "No cross target detected"
38-
fi
3933
}
4034

4135
# This function exports operating system specific variables:
@@ -112,7 +106,6 @@ detect_os() {
112106
OS_VERSION_MAJOR="${OS_VERSION%%.*}"
113107
fi
114108

115-
log_debug "Detected OS $OS $OS_VERSION"
116109
export OS OS_VERSION OS_VERSION_MAJOR
117110
}
118111

@@ -274,8 +267,6 @@ detect_packaging() {
274267
;;
275268
esac
276269

277-
log_debug "Detected dependency packaging $DEP_PACKAGING"
278-
log_debug "Detected packaging $PACKAGING"
279270
export DEP_PACKAGING PACKAGING
280271
}
281272

@@ -334,7 +325,6 @@ detect_arch() {
334325
;;
335326
esac
336327

337-
log_debug "Detected architecture $ARCH"
338328
export ARCH
339329
}
340330

@@ -346,9 +336,8 @@ detect_tools() {
346336
# various dependencies have various requirements
347337
MAKE=$(func_whereis gmake make)
348338

349-
if $MAKE -v | grep GNU; then
339+
if $MAKE -v | grep -q GNU; then
350340
export MAKE
351-
log_debug "Detected make path $MAKE"
352341
else
353342
log_error "GNU Make not found"
354343
exit 42
@@ -360,12 +349,10 @@ detect_tools() {
360349
# systems. We use it to kill processes that can mess with the build process.
361350
FUSER=$(func_whereis fuser)
362351
export FUSER
363-
log_debug "Detected fuser path $FUSER"
364352

365353
# We use patch to apply patches to the dependencies.
366354
PATCH=$(func_whereis gpatch patch)
367355
export PATCH
368-
log_debug "Detected patch path $PATCH"
369356
}
370357

371358
# This function appends the -j/--jobs option to the MAKEFLAGS environment
@@ -375,19 +362,15 @@ detect_tools() {
375362
detect_cores() {
376363
case "$OS_FAMILY" in
377364
aix)
378-
log_debug "Detected OS family is aix"
379365
NUM_CORES="$(lscfg | grep -c proc)"
380366
;;
381367
solaris)
382-
log_debug "Detected OS family is solaris"
383368
NUM_CORES="$(psrinfo | wc -l)"
384369
;;
385370
linux)
386-
log_debug "Detected OS family is linux"
387371
NUM_CORES="$(grep -c '^processor' /proc/cpuinfo)"
388372
;;
389373
hpux)
390-
log_debug "Detected OS family is hpux"
391374
NUM_CORES="$(ioscan -k -C processor | grep -c processor)"
392375
;;
393376
*)
@@ -397,7 +380,6 @@ detect_cores() {
397380
esac
398381

399382
# Make number of jobs one higher than core count, to account for I/O, network, etc.
400-
log_debug "Detected amount of CPU cores is $NUM_CORES"
401383
MAKEFLAGS="${MAKEFLAGS:--j$((NUM_CORES + 1))}"
402384
export MAKEFLAGS
403385
}
@@ -425,15 +407,14 @@ detect_environment
425407

426408
# Print the environment variables so that the log can be used to debug problems
427409
# stemming from wrong environment.
428-
echo
429-
echo
430-
echo "==================== Current environment ========================"
431-
# Print only what changed in the environment after sourcing this script
432-
# - Lines staring with + are kept (these are things added to env)
433-
# - Lines staring with +++ is filtered out (removes the "new file" header)
434-
# - The + character is removed
435-
env | sort | diff -u env_before - | grep '^\+' | grep -v '^+++' | sed 's/+//'
410+
env_diff="$(env | sort | diff env_before - | grep '^>' | sed 's/^> //')"
436411
unlink env_before
437-
echo "================================================================="
438-
echo
439-
echo
412+
if [ -n "$env_diff" ]; then
413+
echo
414+
echo
415+
echo "======= Changes to environment after sourcing this script ======="
416+
echo "$env_diff"
417+
echo "================================================================="
418+
echo
419+
echo
420+
fi

0 commit comments

Comments
 (0)