[MERGED] libosmocore[master]: fixups for recent "Cleanup jenkins build scripts"

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Tue Oct 24 15:31:07 UTC 2017


Neels Hofmeyr has submitted this change and it was merged.

Change subject: fixups for recent "Cleanup jenkins build scripts"
......................................................................


fixups for recent "Cleanup jenkins build scripts"

Change I24e500e132f5c8e8133d35548cb7b4e4552331d0 was merged, but IMHO needs
improvement. Fix these:

- clean the git source tree before each build step, in common prep_build().
- fix indenting inside the build() macros.
- change build() arg to be build_dir, to absorb cleanup steps into build().
- in jenkins.sh, use $ENABLE_SANITIZE as global env, not passed as arg.
- in jenkins.sh, don't do 'make distcheck' twice. It is not necessary to do it
  from source tree as well as separately from source tree, since distcheck
  already moves to a different build dir.

Change-Id: I09d306350602f21943d5bd45f7388c83ede9b524
---
M contrib/jenkins-arm.sh
M contrib/jenkins.sh
M contrib/jenkins_common.sh
3 files changed, 43 insertions(+), 22 deletions(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/contrib/jenkins-arm.sh b/contrib/jenkins-arm.sh
index e0c75fa..ef116b1 100755
--- a/contrib/jenkins-arm.sh
+++ b/contrib/jenkins-arm.sh
@@ -2,8 +2,13 @@
 
 . $(dirname "$0")/jenkins_common.sh
 
+src_dir="$PWD"
 build() {
-    $1 --enable-static \
+    build_dir="$1"
+
+    prep_build "$src_dir" "$build_dir"
+
+    "$src_dir"/configure --enable-static \
 	--prefix=/usr/local/arm-none-eabi \
 	--host=arm-none-eabi \
 	--enable-embedded \
@@ -11,15 +16,11 @@
 	--disable-shared \
 	CFLAGS="-Os -ffunction-sections -fdata-sections -nostartfiles -nodefaultlibs -Werror"
 
-$MAKE $PARALLEL_MAKE \
-	|| cat-testlogs.sh
+    $MAKE $PARALLEL_MAKE \
+        || cat-testlogs.sh
 }
 
 # verify build in dir other than source tree
-mkdir -p builddir
-cd builddir
-build ../configure
-
-cd ..
-build ./configure
-
+build builddir
+# verify build in source tree
+build .
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index c397d52..d731504 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -9,19 +9,23 @@
         ENABLE_SANITIZE=""
 fi
 
+src_dir="$PWD"
 build() {
-    $1 --enable-static $2 CFLAGS="-Werror" CPPFLAGS="-Werror"
-$MAKE $PARALLEL_MAKE check \
-  || cat-testlogs.sh
-$MAKE distcheck \
-  || cat-testlogs.sh
+    build_dir="$1"
+
+    prep_build "$src_dir" "$build_dir"
+
+    "$src_dir"/configure --enable-static $ENABLE_SANITIZE CFLAGS="-Werror" CPPFLAGS="-Werror"
+    $MAKE $PARALLEL_MAKE check \
+        || cat-testlogs.sh
 }
 
 # verify build in dir other than source tree
-mkdir -p builddir
-cd builddir
-build ../configure $ENABLE_SANITIZE
+build builddir
+# verify build in source tree
+build .
 
-cd ..
-build ./configure $ENABLE_SANITIZE
-
+# do distcheck only once, which is fine from built source tree, since distcheck
+# is well separated from the source tree state.
+$MAKE distcheck \
+    || cat-testlogs.sh
diff --git a/contrib/jenkins_common.sh b/contrib/jenkins_common.sh
index e52a96a..6cfa334 100644
--- a/contrib/jenkins_common.sh
+++ b/contrib/jenkins_common.sh
@@ -4,4 +4,20 @@
 
 verify_value_string_arrays_are_terminated.py $(find . -name "*.[hc]")
 
-autoreconf --install --force
+prep_build() {
+    _src_dir="$1"
+    _build_dir="$2"
+
+    cd "$_src_dir"
+
+    # a failed 'make distcheck' may leave files without write permissions
+    chmod -R a+w .
+    git clean -dxf
+    # make absolutely sure no src files have modifications
+    git checkout -f HEAD
+
+    autoreconf --install --force
+
+    mkdir -p "$_build_dir"
+    cd "$_build_dir"
+}

-- 
To view, visit https://gerrit.osmocom.org/4383
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I09d306350602f21943d5bd45f7388c83ede9b524
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list