From: Michael Jeanson Date: Wed, 30 Sep 2020 20:33:16 +0000 (-0400) Subject: jjb: Add env and os details printing to build jobs X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=51c9c62db1805a4cdd96be18df4082f1ac5d81c5;p=lttng-ci.git jjb: Add env and os details printing to build jobs Signed-off-by: Michael Jeanson --- diff --git a/jobs/babeltrace.yaml b/jobs/babeltrace.yaml index 065e640..a22237b 100644 --- a/jobs/babeltrace.yaml +++ b/jobs/babeltrace.yaml @@ -94,7 +94,9 @@ name: 'babeltrace_build_builders_defaults' builders: - shell: - !include-raw-escape: scripts/babeltrace/build.sh + !include-raw-escape: + - scripts/common/print.sh + - scripts/babeltrace/build.sh - babeltrace_build_builders_win: &babeltrace_build_builders_win name: 'babeltrace_build_builders_win' @@ -109,6 +111,7 @@ !include-raw-escape: - scripts/common/cygwin64-shebang - scripts/common/cygpath-prefix + - scripts/common/print.sh - scripts/babeltrace/build.sh - conditional-step: condition-kind: strings-match @@ -122,6 +125,7 @@ !include-raw-escape: - scripts/common/msys2-shebang - scripts/common/cygpath-prefix + - scripts/common/print.sh - scripts/babeltrace/build.sh - conditional-step: condition-kind: strings-match @@ -135,6 +139,7 @@ !include-raw-escape: - scripts/common/msys2-shebang - scripts/common/cygpath-prefix + - scripts/common/print.sh - scripts/babeltrace/build.sh @@ -598,7 +603,9 @@ make install - shell: - !include-raw-escape: scripts/babeltrace/build.sh + !include-raw-escape: + - scripts/common/print.sh + - scripts/babeltrace/build.sh - job-template: name: babeltrace_{version}_glib-2.28.6 diff --git a/jobs/librseq.yaml b/jobs/librseq.yaml index 001509c..e82a0ca 100644 --- a/jobs/librseq.yaml +++ b/jobs/librseq.yaml @@ -97,7 +97,9 @@ name: 'librseq_build_builders_defaults' builders: - shell: - !include-raw-escape: scripts/librseq/build.sh + !include-raw-escape: + - scripts/common/print.sh + - scripts/librseq/build.sh - librseq_build_publishers_defaults: &librseq_build_publishers_defaults name: 'librseq_build_publishers_defaults' diff --git a/jobs/liburcu.yaml b/jobs/liburcu.yaml index ec179c7..98e40b4 100644 --- a/jobs/liburcu.yaml +++ b/jobs/liburcu.yaml @@ -85,7 +85,9 @@ name: 'liburcu_build_builders_defaults' builders: - shell: - !include-raw-escape: scripts/liburcu/build.sh + !include-raw-escape: + - scripts/common/print.sh + - scripts/liburcu/build.sh - liburcu_build_builders_win: &liburcu_build_builders_win name: 'liburcu_build_builders_win' @@ -100,6 +102,7 @@ !include-raw-escape: - scripts/common/cygwin64-shebang - scripts/common/cygpath-prefix + - scripts/common/print.sh - scripts/liburcu/build.sh - liburcu_build_publishers_defaults: &liburcu_build_publishers_defaults diff --git a/jobs/lttng-tools.yaml b/jobs/lttng-tools.yaml index 28615f2..98f887f 100644 --- a/jobs/lttng-tools.yaml +++ b/jobs/lttng-tools.yaml @@ -304,7 +304,9 @@ - shell: !include-raw-escape: scripts/lttng-tools/clean_processes_coredump.sh - shell: - !include-raw-escape: scripts/lttng-tools/build.sh + !include-raw-escape: + - scripts/common/print.sh + - scripts/lttng-tools/build.sh - lttng-tools_build_builders_gerrit: <tng-tools_build_builders_gerrit name: 'lttng-tools_build_builders_gerrit' @@ -419,11 +421,14 @@ - shell: !include-raw-escape: - scripts/common/override-build-std.sh + - scripts/common/print.sh - scripts/lttng-ust/build.sh - shell: !include-raw-escape: scripts/lttng-tools/gerrit-install-deps.sh - shell: - !include-raw-escape: scripts/lttng-tools/build.sh + !include-raw-escape: + - scripts/common/print.sh + - scripts/lttng-tools/build.sh - lttng-tools_build_builders_win: <tng-tools_build_builders_win name: 'lttng-tools_build_builders_win' @@ -445,6 +450,7 @@ !include-raw-escape: - scripts/common/cygwin64-shebang - scripts/common/cygpath-prefix + - scripts/common/print.sh - scripts/lttng-tools/build.sh - conditional-step: condition-kind: strings-match @@ -458,6 +464,7 @@ !include-raw-escape: - scripts/common/msys2-shebang - scripts/common/cygpath-prefix + - scripts/common/print.sh - scripts/lttng-tools/build.sh - conditional-step: condition-kind: strings-match @@ -471,6 +478,7 @@ !include-raw-escape: - scripts/common/msys2-shebang - scripts/common/cygpath-prefix + - scripts/common/print.sh - scripts/lttng-tools/build.sh - lttng-tools_build_publishers_dev: <tng-tools_build_publishers_dev diff --git a/jobs/lttng-ust.yaml b/jobs/lttng-ust.yaml index 894769b..c8dbdb8 100644 --- a/jobs/lttng-ust.yaml +++ b/jobs/lttng-ust.yaml @@ -108,7 +108,9 @@ target: 'deps' do-not-fingerprint: true - shell: - !include-raw-escape: scripts/lttng-ust/build.sh + !include-raw-escape: + - scripts/common/print.sh + - scripts/lttng-ust/build.sh ## Templates diff --git a/scripts/babeltrace-benchmark/benchmark.sh b/scripts/babeltrace-benchmark/benchmark.sh index c9f579c..57a788f 100755 --- a/scripts/babeltrace-benchmark/benchmark.sh +++ b/scripts/babeltrace-benchmark/benchmark.sh @@ -1,6 +1,6 @@ -#!/bin/bash -exu +#!/bin/bash # -# Copyright (C) 2019 - Jonathan Rajotte-Julien +# Copyright (C) 2019 Jonathan Rajotte-Julien # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + SRC_DIR="$WORKSPACE/src/babeltrace" SCRIPT_DIR="$WORKSPACE/src/lttng-ci" RESULTS_DIR="$WORKSPACE/results" diff --git a/scripts/babeltrace/build.sh b/scripts/babeltrace/build.sh index b81adec..a9ad856 100755 --- a/scripts/babeltrace/build.sh +++ b/scripts/babeltrace/build.sh @@ -1,7 +1,7 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015 Jonathan Rajotte-Julien -# 2016-2019 Michael Jeanson +# Copyright (C) 2016-2020 Michael Jeanson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Version compare functions vercomp () { set +u @@ -69,6 +71,15 @@ verne() { [ "$res" -ne "0" ] } +failed_configure() { + # Assume we are in the configured build directory + echo "#################### BEGIN config.log ####################" + cat config.log + echo "#################### END config.log ####################" + exit 1 +} + + # Required variables WORKSPACE=${WORKSPACE:-} @@ -206,6 +217,10 @@ cygwin) ;; esac +# Print build env details +print_os || true +print_tooling || true + # Enter the source directory cd "$SRCDIR" @@ -288,7 +303,7 @@ oot) builddir=$(mktemp -d) cd "$builddir" - "$SRCDIR/configure" "${CONF_OPTS[@]}" + "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure ;; dist) @@ -296,7 +311,7 @@ dist) # Run configure and generate the tar file # in the source directory - ./configure + ./configure || failed_configure $MAKE dist # Create and enter a temporary build directory @@ -308,7 +323,7 @@ dist) $TAR xvf "$SRCDIR"/*.tar.* --strip 1 # Build in extracted source tree - ./configure "${CONF_OPTS[@]}" + ./configure "${CONF_OPTS[@]}" || failed_configure ;; oot-dist) @@ -319,7 +334,7 @@ oot-dist) cd "$builddir" # Run configure out of tree and generate the tar file - "$SRCDIR/configure" + "$SRCDIR/configure" || failed_configure $MAKE dist dist_srcdir="$(mktemp -d)" @@ -335,12 +350,12 @@ oot-dist) # Run configure from the extracted distribution tar, # out of the source tree - "$dist_srcdir/configure" "${CONF_OPTS[@]}" + "$dist_srcdir/configure" "${CONF_OPTS[@]}" || failed_configure ;; *) echo "Standard in-tree build" - ./configure "${CONF_OPTS[@]}" + ./configure "${CONF_OPTS[@]}" || failed_configure ;; esac diff --git a/scripts/babeltrace/pylint.sh b/scripts/babeltrace/pylint.sh index ffb45b9..839d862 100755 --- a/scripts/babeltrace/pylint.sh +++ b/scripts/babeltrace/pylint.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2019 Michael Jeanson # Copyright (C) 2019 Francis Deslauriers @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + set -o pipefail PYTHON3=python3 diff --git a/scripts/babeltrace/release.sh b/scripts/babeltrace/release.sh index 32306e1..beff097 100644 --- a/scripts/babeltrace/release.sh +++ b/scripts/babeltrace/release.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015 Jonathan Rajotte-Julien # Copyright (C) 2020 Michael Jeanson @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Version compare functions vercomp () { set +u diff --git a/scripts/barectf/build.sh b/scripts/barectf/build.sh index 39e0559..cd0c31c 100755 --- a/scripts/barectf/build.sh +++ b/scripts/barectf/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh -exu +#!/bin/sh # # Copyright (C) 2015-2020 Michael Jeanson # @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + SRCDIR="src/barectf" PYTHON3="python3" diff --git a/scripts/common/coverity.sh b/scripts/common/coverity.sh index b5ca369..a224f38 100755 --- a/scripts/common/coverity.sh +++ b/scripts/common/coverity.sh @@ -1,6 +1,6 @@ -#!/bin/bash -exu +#!/bin/bash # -# Copyright (C) 2019 Michael Jeanson +# Copyright (C) 2020 Michael Jeanson # Copyright (C) 2015 Jonathan Rajotte-Julien # # This program is free software: you can redistribute it and/or modify @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Required variables WORKSPACE=${WORKSPACE:-} diff --git a/scripts/common/override-build-std.sh b/scripts/common/override-build-std.sh index 003ee7a..658c01f 100755 --- a/scripts/common/override-build-std.sh +++ b/scripts/common/override-build-std.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2020 Jonathan Rajotte-Julien # @@ -18,5 +18,7 @@ # This file should be used as a jenkins job builder RAW import allowing the # override of the "build" variable on shell builder execution. +set -exu + # shellcheck disable=SC2034 build=std diff --git a/scripts/common/print.sh b/scripts/common/print.sh new file mode 100755 index 0000000..21c5e60 --- /dev/null +++ b/scripts/common/print.sh @@ -0,0 +1,162 @@ +#!/bin/bash +# +# Copyright (C) 2020 Michael Jeanson +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -exu + +COLOR_BLUE='\033[0;34m' +COLOR_NONE='\033[0m' # No Color + +print_blue() { + echo -e "${COLOR_BLUE}$1${COLOR_NONE}" +} + +print_os() { + set +ex + + print_blue "Operating System Details" + + if [ -f "/etc/os-release" ]; then + (. "/etc/os-release"; echo "Version: $NAME $VERSION") + elif [ -f "/etc/release" ]; then + echo "Version: $(head -n1 /etc/release)" + elif command -v sw_vers >/dev/null 2>&1; then + # For MacOS + echo "Version: $(sw_vers -productName) $(sw_vers -productVersion)" + fi + + echo -n "Kernel: " + uname -a + + set -ex +} + +print_pkgconfig_mod() { + local mod=$1 + if pkg-config --exists "${mod}"; then + print_blue "$mod version" + pkg-config --modversion "${mod}" + fi +} + +print_tooling() { + set +ex + + print_blue "Selected CC version" + ${CC:-cc} --version | head -n1 + + print_blue "Default gcc version" + gcc --version | head -n1 + gcc -dumpmachine + + if command -v clang >/dev/null 2>&1; then + print_blue "Default clang version" + clang --version + fi + + print_blue "git version" + git --version + + print_blue "bash version" + bash --version | head -n1 + + print_blue "make version" + ${MAKE:-make} --version | head -n1 + + if command -v cmake >/dev/null 2>&1; then + print_blue "cmake version" + cmake --version + fi + + print_blue "automake version" + automake --version | head -n1 + + print_blue "autoconf version" + autoconf --version | head -n1 + + print_blue "libtool version" + if libtool --version >/dev/null 2>&1; then + libtool --version | head -n1 + else + # Thanks Apple! + libtool -V + fi + + print_blue "bison version" + ${BISON:-bison} --version | head -n1 + + print_blue "flex version" + ${FLEX:-flex} --version + + print_blue "swig version" + swig -version | ${GREP:-grep} SWIG + + print_blue "tar version" + ${TAR:-tar} --version | head -n1 + + print_blue "Selected python version" + ${PYTHON} --version + + if command -v "${PYTHON2:-python2}" >/dev/null 2>&1; then + print_blue "python2 version" + ${PYTHON2:-python2} --version + fi + + if command -v "${PYTHON3:-python3}" >/dev/null 2>&1; then + print_blue "python3 version" + ${PYTHON3:-python3} --version + fi + + print_blue "java version" + java -version + + print_blue "javac version" + javac -version + + if command -v asciidoc >/dev/null 2>&1; then + print_blue "asciidoc version" + asciidoc --version + fi + + if command -v xmlto >/dev/null 2>&1; then + print_blue "xmlto version" + xmlto --version + fi + + if command -v openssl >/dev/null 2>&1; then + print_blue "openssl version" + openssl version + fi + + if command -v pkg-config >/dev/null 2>&1; then + print_blue "pkg-config version" + pkg-config --version + + #print_blue "pkg-config modules installed" + #pkg-config --list-all + + print_pkgconfig_mod glib-2.0 + print_pkgconfig_mod libdw + print_pkgconfig_mod libelf + print_pkgconfig_mod libxml-2.0 + print_pkgconfig_mod msgpack + print_pkgconfig_mod popt + print_pkgconfig_mod uuid + print_pkgconfig_mod zlib + fi + + set -ex +} diff --git a/scripts/common/scan-build.sh b/scripts/common/scan-build.sh index 7a703e1..5ef74c3 100755 --- a/scripts/common/scan-build.sh +++ b/scripts/common/scan-build.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015 Jonathan Rajotte-Julien # Copyright (C) 2019 Michael Jeanson @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Required variables WORKSPACE=${WORKSPACE:-} diff --git a/scripts/kernel/build.sh b/scripts/kernel/build.sh index 614f1d8..0134eda 100755 --- a/scripts/kernel/build.sh +++ b/scripts/kernel/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh -exu +#!/bin/sh # # Copyright (C) 2015 - Jonathan Rajotte-Julien # Michael Jeanson @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + #Check if ccache is present #if [ -d /usr/lib/ccache ]; then # echo "Using CCACHE" diff --git a/scripts/librseq/build.sh b/scripts/librseq/build.sh index 92865de..826cfa9 100755 --- a/scripts/librseq/build.sh +++ b/scripts/librseq/build.sh @@ -1,7 +1,7 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015 Jonathan Rajotte-Julien -# Copyright (C) 2019 Michael Jeanson +# Copyright (C) 2019-2020 Michael Jeanson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Version compare functions vercomp () { set +u @@ -69,6 +71,16 @@ verne() { [ "$res" -ne "0" ] } +failed_configure() { + # Assume we are in the configured build directory + echo "#################### BEGIN config.log ####################" + cat config.log + echo "#################### END config.log ####################" + + # End the build with failure + exit 1 +} + # Required variables WORKSPACE=${WORKSPACE:-} @@ -166,6 +178,10 @@ case "$arch" in ;; esac +# Print build env details +print_os || true +print_tooling || true + # Enter the source directory cd "$SRCDIR" @@ -208,7 +224,7 @@ oot) builddir=$(mktemp -d) cd "$builddir" - "$SRCDIR/configure" "${CONF_OPTS[@]}" + "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure ;; dist) @@ -216,7 +232,7 @@ dist) # Run configure and generate the tar file # in the source directory - ./configure + ./configure || failed_configure $MAKE dist # Create and enter a temporary build directory @@ -228,7 +244,7 @@ dist) $TAR xvf "$SRCDIR"/*.tar.* --strip 1 # Build in extracted source tree - ./configure "${CONF_OPTS[@]}" + ./configure "${CONF_OPTS[@]}" || failed_configure ;; oot-dist) @@ -239,7 +255,7 @@ oot-dist) cd "$builddir" # Run configure out of tree and generate the tar file - "$SRCDIR/configure" + "$SRCDIR/configure" || failed_configure $MAKE dist dist_srcdir="$(mktemp -d)" @@ -255,12 +271,12 @@ oot-dist) # Run configure from the extracted distribution tar, # out of the source tree - "$dist_srcdir/configure" "${CONF_OPTS[@]}" + "$dist_srcdir/configure" "${CONF_OPTS[@]}" || failed_configure ;; *) echo "Standard in-tree build" - ./configure "${CONF_OPTS[@]}" + ./configure "${CONF_OPTS[@]}" || failed_configure ;; esac diff --git a/scripts/liburcu/build.sh b/scripts/liburcu/build.sh index 76f8d3c..7924a06 100755 --- a/scripts/liburcu/build.sh +++ b/scripts/liburcu/build.sh @@ -1,7 +1,7 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015 Jonathan Rajotte-Julien -# 2016-2019 Michael Jeanson +# Copyright (C) 2016-2020 Michael Jeanson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Version compare functions vercomp () { set +u @@ -69,6 +71,16 @@ verne() { [ "$res" -ne "0" ] } +failed_configure() { + # Assume we are in the configured build directory + echo "#################### BEGIN config.log ####################" + cat config.log + echo "#################### END config.log ####################" + + # End the build with failure + exit 1 +} + # Required variables WORKSPACE=${WORKSPACE:-} @@ -197,6 +209,10 @@ macosx) ;; esac +# Print build env details +print_os || true +print_tooling || true + # Enter the source directory cd "$SRCDIR" @@ -257,7 +273,7 @@ oot) builddir=$(mktemp -d) cd "$builddir" - "$SRCDIR/configure" "${CONF_OPTS[@]}" + "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure ;; dist) @@ -265,7 +281,7 @@ dist) # Run configure and generate the tar file # in the source directory - ./configure + ./configure || failed_configure $MAKE dist # Create and enter a temporary build directory @@ -277,7 +293,7 @@ dist) $TAR xvf "$SRCDIR"/*.tar.* --strip 1 # Build in extracted source tree - ./configure "${CONF_OPTS[@]}" + ./configure "${CONF_OPTS[@]}" || failed_configure ;; oot-dist) @@ -288,7 +304,7 @@ oot-dist) cd "$builddir" # Run configure out of tree and generate the tar file - "$SRCDIR/configure" + "$SRCDIR/configure" || failed_configure $MAKE dist dist_srcdir="$(mktemp -d)" @@ -304,12 +320,12 @@ oot-dist) # Run configure from the extracted distribution tar, # out of the source tree - "$dist_srcdir/configure" "${CONF_OPTS[@]}" + "$dist_srcdir/configure" "${CONF_OPTS[@]}" || failed_configure ;; *) echo "Standard in-tree build" - ./configure "${CONF_OPTS[@]}" + ./configure "${CONF_OPTS[@]}" || failed_configure ;; esac diff --git a/scripts/lttng-analyses/build.sh b/scripts/lttng-analyses/build.sh index 8d193d9..de86ae8 100755 --- a/scripts/lttng-analyses/build.sh +++ b/scripts/lttng-analyses/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015 - Michael Jeanson # @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Has to be set in the environment #CODECOV_TOKEN="" diff --git a/scripts/lttng-analyses/pylint.sh b/scripts/lttng-analyses/pylint.sh index 4eb9693..426fcc4 100755 --- a/scripts/lttng-analyses/pylint.sh +++ b/scripts/lttng-analyses/pylint.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2020 Michael Jeanson # @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + SRCDIR="src/lttng-analyses" PYTHON3="python3" diff --git a/scripts/lttng-modules/build.sh b/scripts/lttng-modules/build.sh index a301c91..b52aead 100755 --- a/scripts/lttng-modules/build.sh +++ b/scripts/lttng-modules/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh -exu +#!/bin/sh # # Copyright (C) 2015 - Jonathan Rajotte-Julien # Michael Jeanson @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Kernel version compare functions verlte() { [ "$1" = "`printf '%s\n%s' $1 $2 | sort -V | head -n1`" ] diff --git a/scripts/lttng-modules/param-build.sh b/scripts/lttng-modules/param-build.sh index e8709d2..dbfa5ee 100644 --- a/scripts/lttng-modules/param-build.sh +++ b/scripts/lttng-modules/param-build.sh @@ -1,6 +1,6 @@ -#!/bin/bash -exu +#!/bin/bash # -# Copyright (C) 2016-2019 - Michael Jeanson +# Copyright (C) 2016-2019 Michael Jeanson # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Parameters arch=${arch:-} cross_arch=${cross_arch:-} diff --git a/scripts/lttng-scope/launch-wm.sh b/scripts/lttng-scope/launch-wm.sh index 72e4712..8a65f04 100644 --- a/scripts/lttng-scope/launch-wm.sh +++ b/scripts/lttng-scope/launch-wm.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015 - Alexandre Montplaisir # @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Required parameters #wm=${wm:-} wm="unity" diff --git a/scripts/lttng-tools/build.sh b/scripts/lttng-tools/build.sh index b44dd2c..394575c 100755 --- a/scripts/lttng-tools/build.sh +++ b/scripts/lttng-tools/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # shellcheck disable=SC2103 # # Copyright (C) 2016 Jonathan Rajotte-Julien @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Version compare functions vercomp () { set +u @@ -70,6 +72,16 @@ verne() { [ "$res" -ne "0" ] } +failed_configure() { + # Assume we are in the configured build directory + echo "#################### BEGIN config.log ####################" + cat config.log + echo "#################### END config.log ####################" + + # End the build with failure + exit 1 +} + # Required variables WORKSPACE=${WORKSPACE:-} @@ -269,6 +281,10 @@ if [ -d "$WORKSPACE/src/lttng-modules" ]; then depmod fi +# Print build env details +print_os || true +print_tooling || true + # Enter the source directory cd "$SRCDIR" @@ -350,7 +366,7 @@ oot) builddir=$(mktemp -d) cd "$builddir" - "$SRCDIR/configure" "${CONF_OPTS[@]}" + "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure ;; dist) @@ -358,7 +374,7 @@ dist) # Run configure and generate the tar file # in the source directory - ./configure "${DIST_CONF_OPTS[@]}" + ./configure "${DIST_CONF_OPTS[@]}" || failed_configure $MAKE dist # Create and enter a temporary build directory @@ -370,7 +386,7 @@ dist) $TAR xvf "$SRCDIR"/*.tar.* --strip 1 # Build in extracted source tree - ./configure "${CONF_OPTS[@]}" + ./configure "${CONF_OPTS[@]}" || failed_configure ;; oot-dist) @@ -381,7 +397,7 @@ oot-dist) cd "$builddir" # Run configure out of tree and generate the tar file - "$SRCDIR/configure" "${DIST_CONF_OPTS[@]}" + "$SRCDIR/configure" "${DIST_CONF_OPTS[@]}" || failed_configure $MAKE dist dist_srcdir="$(mktemp -d)" @@ -397,12 +413,12 @@ oot-dist) # Run configure from the extracted distribution tar, # out of the source tree - "$dist_srcdir/configure" "${CONF_OPTS[@]}" + "$dist_srcdir/configure" "${CONF_OPTS[@]}" || failed_configure ;; *) echo "Standard in-tree build" - ./configure "${CONF_OPTS[@]}" + ./configure "${CONF_OPTS[@]}" || failed_configure ;; esac diff --git a/scripts/lttng-tools/clean_processes_coredump.sh b/scripts/lttng-tools/clean_processes_coredump.sh index 91082fb..bf856a0 100755 --- a/scripts/lttng-tools/clean_processes_coredump.sh +++ b/scripts/lttng-tools/clean_processes_coredump.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2018 - Jonathan Rajotte-Julien # @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + PGREP=pgrep # Kill any LTTng-related process lttng_processes="$("$PGREP" -l 'lttng|gen-ust-.+')" || true diff --git a/scripts/lttng-tools/gerrit-depends-on.sh b/scripts/lttng-tools/gerrit-depends-on.sh index 7b47b93..b8bcd4e 100755 --- a/scripts/lttng-tools/gerrit-depends-on.sh +++ b/scripts/lttng-tools/gerrit-depends-on.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # shellcheck disable=SC2103 # # Copyright (C) 2020 Jonathan Rajotte-Julien @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + #Required variables GERRIT_NAME=${GERRIT_NAME:-} WORKSPACE=${WORKSPACE:-} diff --git a/scripts/lttng-tools/gerrit-install-deps.sh b/scripts/lttng-tools/gerrit-install-deps.sh index a04f82c..f43e4ec 100755 --- a/scripts/lttng-tools/gerrit-install-deps.sh +++ b/scripts/lttng-tools/gerrit-install-deps.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2020 Jonathan Rajotte-Julien # @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Required variables WORKSPACE=${WORKSPACE:-} diff --git a/scripts/lttng-tools/hang_processes.sh b/scripts/lttng-tools/hang_processes.sh index 34f8ef0..3e52a60 100755 --- a/scripts/lttng-tools/hang_processes.sh +++ b/scripts/lttng-tools/hang_processes.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2018 - Jonathan Rajotte-Julien # @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + PGREP=pgrep pids="" file_list=$(mktemp) diff --git a/scripts/lttng-tools/release.sh b/scripts/lttng-tools/release.sh index 0bd5c5c..de65b7a 100644 --- a/scripts/lttng-tools/release.sh +++ b/scripts/lttng-tools/release.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015 Jonathan Rajotte-Julien # Copyright (C) 2020 Michael Jeanson @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Version compare functions vercomp () { set +u diff --git a/scripts/lttng-ust-benchmarks/build.sh b/scripts/lttng-ust-benchmarks/build.sh index 10b1c05..a2799b9 100644 --- a/scripts/lttng-ust-benchmarks/build.sh +++ b/scripts/lttng-ust-benchmarks/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015, Jonathan Rajotte-Julien # 2016, Michael Jeanson @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + SRCDIR="$WORKSPACE/src/$PROJECT_NAME" # Create build directory diff --git a/scripts/lttng-ust-java-tests/start-sessiond.sh b/scripts/lttng-ust-java-tests/start-sessiond.sh index 7be6988..894b519 100755 --- a/scripts/lttng-ust-java-tests/start-sessiond.sh +++ b/scripts/lttng-ust-java-tests/start-sessiond.sh @@ -1,4 +1,6 @@ -#!/bin/bash -exu +#!/bin/bash + +set -exu # Start the lttng-sessiond lttng-sessiond -b -vvv 1>lttng-sessiond.log 2>&1 diff --git a/scripts/lttng-ust-java-tests/stop-sessiond.sh b/scripts/lttng-ust-java-tests/stop-sessiond.sh index 33ee3a3..de1e737 100755 --- a/scripts/lttng-ust-java-tests/stop-sessiond.sh +++ b/scripts/lttng-ust-java-tests/stop-sessiond.sh @@ -1,4 +1,6 @@ -#!/bin/bash -exu +#!/bin/bash + +set -exu # Kill the sessiond killall lttng-sessiond diff --git a/scripts/lttng-ust/build.sh b/scripts/lttng-ust/build.sh index 3b6a38d..6b6f341 100755 --- a/scripts/lttng-ust/build.sh +++ b/scripts/lttng-ust/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash -exu +#!/bin/bash # # Copyright (C) 2015 Jonathan Rajotte-Julien # 2016-2019 Michael Jeanson @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -exu + # Version compare functions vercomp () { set +u @@ -69,6 +71,16 @@ verne() { [ "$res" -ne "0" ] } +failed_configure() { + # Assume we are in the configured build directory + echo "#################### BEGIN config.log ####################" + cat config.log + echo "#################### END config.log ####################" + + # End the build with failure + exit 1 +} + # Required variables WORKSPACE=${WORKSPACE:-} @@ -173,6 +185,10 @@ case "$arch" in ;; esac +# Print build env details +print_os || true +print_tooling || true + # Enter the source directory cd "$SRCDIR" @@ -229,7 +245,7 @@ oot) builddir=$(mktemp -d) cd "$builddir" - "$SRCDIR/configure" "${CONF_OPTS[@]}" + "$SRCDIR/configure" "${CONF_OPTS[@]}" || failed_configure ;; dist) @@ -237,7 +253,7 @@ dist) # Run configure and generate the tar file # in the source directory - ./configure + ./configure || failed_configure $MAKE dist # Create and enter a temporary build directory @@ -249,7 +265,7 @@ dist) $TAR xvf "$SRCDIR"/*.tar.* --strip 1 # Build in extracted source tree - ./configure "${CONF_OPTS[@]}" + ./configure "${CONF_OPTS[@]}" || failed_configure ;; oot-dist) @@ -260,7 +276,7 @@ oot-dist) cd "$builddir" # Run configure out of tree and generate the tar file - "$SRCDIR/configure" + "$SRCDIR/configure" || failed_configure $MAKE dist dist_srcdir="$(mktemp -d)" @@ -276,12 +292,12 @@ oot-dist) # Run configure from the extracted distribution tar, # out of the source tree - "$dist_srcdir/configure" "${CONF_OPTS[@]}" + "$dist_srcdir/configure" "${CONF_OPTS[@]}" || failed_configure ;; *) echo "Standard in-tree build" - ./configure "${CONF_OPTS[@]}" + ./configure "${CONF_OPTS[@]}" || failed_configure ;; esac diff --git a/scripts/packaging/el7/add-efficios-repo.sh b/scripts/packaging/el7/add-efficios-repo.sh index d4eaf20..1200c04 100755 --- a/scripts/packaging/el7/add-efficios-repo.sh +++ b/scripts/packaging/el7/add-efficios-repo.sh @@ -1,4 +1,6 @@ -#/bin/sh -exu +#!/bin/sh + +set -exu yum -y install wget diff --git a/scripts/packaging/el7/install-lttng-packages.sh b/scripts/packaging/el7/install-lttng-packages.sh index 61a9b68..3ff08f0 100755 --- a/scripts/packaging/el7/install-lttng-packages.sh +++ b/scripts/packaging/el7/install-lttng-packages.sh @@ -1,4 +1,6 @@ -#!/bin/sh -exu +#!/bin/sh + +set -exu yum install -y kmod-lttng-modules lttng-tools babeltrace diff --git a/scripts/packaging/sles12/add-efficios-repo.sh b/scripts/packaging/sles12/add-efficios-repo.sh index 5949b89..0eb38f3 100755 --- a/scripts/packaging/sles12/add-efficios-repo.sh +++ b/scripts/packaging/sles12/add-efficios-repo.sh @@ -1,4 +1,6 @@ -#/bin/sh -exu +#!/bin/sh + +set -exu zypper --non-interactive addrepo https://packages.efficios.com/repo.files/EfficiOS-SLE12-x86-64.repo diff --git a/scripts/packaging/sles12/install-lttng-packages.sh b/scripts/packaging/sles12/install-lttng-packages.sh index 12ae5ad..fb83bf1 100755 --- a/scripts/packaging/sles12/install-lttng-packages.sh +++ b/scripts/packaging/sles12/install-lttng-packages.sh @@ -1,4 +1,6 @@ -#!/bin/sh -exu +#!/bin/sh + +set -exu zypper --non-interactive install lttng-modules-kmp-default lttng-tools babeltrace diff --git a/scripts/packaging/systemd-enable-and-start-relayd.sh b/scripts/packaging/systemd-enable-and-start-relayd.sh index 344bb53..782f4ac 100755 --- a/scripts/packaging/systemd-enable-and-start-relayd.sh +++ b/scripts/packaging/systemd-enable-and-start-relayd.sh @@ -1,4 +1,6 @@ -#!/bin/sh -exu +#!/bin/sh + +set -exu systemctl enable lttng-relayd diff --git a/scripts/packaging/systemd-enable-and-start-sessiond.sh b/scripts/packaging/systemd-enable-and-start-sessiond.sh index 3b56bcc..ffe5164 100755 --- a/scripts/packaging/systemd-enable-and-start-sessiond.sh +++ b/scripts/packaging/systemd-enable-and-start-sessiond.sh @@ -1,4 +1,6 @@ -#!/bin/sh -exu +#!/bin/sh + +set -exu systemctl enable lttng-sessiond diff --git a/scripts/packaging/test-run.sh b/scripts/packaging/test-run.sh index c4b9889..25d432e 100755 --- a/scripts/packaging/test-run.sh +++ b/scripts/packaging/test-run.sh @@ -1,4 +1,6 @@ -#!/bin/sh -exu +#!/bin/sh + +set -exu lttng create lttng enable-event -a -k