ansible: fix ci-instances playbook for Incus
[lttng-ci.git] / scripts / lttng-modules / param-build.sh
index cf3689d5b615bb013ec532f718c608467d2885b5..310e22b1e5cf7c1beff22fb6943d13e43bb2598e 100644 (file)
@@ -27,6 +27,10 @@ mgitrepo=${mgitrepo:-}
 make_args=()
 
 DEBUG=${DEBUG:-}
+FAIL_ON_WARNINGS="${FAIL_ON_WARNINGS:-}"
+if [[ "${FAIL_ON_WARNINGS}" == "false" ]] ; then
+    FAIL_ON_WARNINGS=''
+fi
 
 # Derive arch from label if it isn't set
 if [ -z "${arch:-}" ] ; then
@@ -83,9 +87,10 @@ print_header() {
 git_clone_modules_sources() {
     mkdir -p "$MODULES_GIT_DIR"
 
-    # If the version starts with "refs/", checkout the specific git ref, otherwise treat it
-    # as a branch name.
-    if [ "${mversion:0:5}" = "refs/" ]; then
+    # If the version starts with "refs/" or looks like a commit hash,
+    # checkout the specific git ref, otherwise treat it as a branch name.
+    pattern="^[0-9a-f]{40}$"
+    if [ "${mversion:0:5}" = "refs/" ] || [[ "${mversion}" =~ $pattern ]]; then
         git clone --no-tags --depth=1 "${mgitrepo}" "$MODULES_GIT_DIR"
         (cd "$MODULES_GIT_DIR" && git fetch origin "${mversion}" && git checkout FETCH_HEAD)
     else
@@ -810,7 +815,7 @@ build_linux_kernel() {
     scripts/config --disable CONFIG_MICREL_PHY
 
 
-    # IGBVF won't build with recent gcc on 2.6.38.x
+    # IGBVF won't build with recent gcc on 2.6.38.2
     if { vergte "$kversion" "2.6.37" && verlt "$kversion" "2.6.38"; }; then
       scripts/config --disable CONFIG_IGBVF
     fi
@@ -832,6 +837,12 @@ build_linux_kernel() {
     scripts/config --enable CONFIG_EVENT_TRACING
     scripts/config --enable CONFIG_KRETPROBES
 
+    # Starting in linux 6.9-rc1, TRIM_UNUSED_SYMS seems to be true
+    # for out build configurations. In earlier versions the default
+    # was set depending on the value of `COMPILE_TEST`.
+    # See upstream commit d2d5cba5d92c4ed23caa86228a1bc31b07e90fe9.
+    scripts/config --disable CONFIG_TRIM_UNUSED_KSYMS
+
     if [ -n "${DEBUG}" ] ; then
         cat .config
     fi
@@ -1000,13 +1011,18 @@ build_modules() {
 
     kversion=$(make -C "$LINUX_HDROBJ_DIR" -s kernelversion)
 
-    # Try to catch some compatibility problems by turning some
-    # warnings into errors.
-    #export KCFLAGS="$KCFLAGS -Wall -Werror"
-
     # Enter lttng-modules source dir
     cd "${MODULES_GIT_DIR}"
 
+    # Try to catch some compatibility problems by turning some
+    # warnings into errors, but only on -rc kernels.
+    pattern="rc[0-9]+$"
+    if [[ "${kversion}" =~ ${pattern} ]] || [[ -n "${FAIL_ON_WARNINGS:-}" ]] ; then
+        export KCFLAGS="${KCFLAGS} -Wall -Werror"
+        # Without the verbose build, the warnings aren't visible.
+        export V=1
+    fi
+
     # kernels 3.10 to 3.10.13 and 3.11 to 3.11.2 introduce a deadlock in the
     # timekeeping subsystem. We want those build to fail.
     if { vergte "$kversion" "3.10" && verlte "$kversion" "3.10.13"; } || \
This page took 0.0232 seconds and 4 git commands to generate.