From 8b4e8c709ce69883c3874b97b063de21da9de3d2 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Wed, 9 Sep 2015 16:19:04 +0200 Subject: reproducible: refactor --- bin/jenkins_master_wrapper.sh | 1 + bin/reproducible_common.sh | 9 +++++++-- bin/reproducible_info.sh | 5 ++++- bin/reproducible_nodes_info.sh | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) (limited to 'bin') diff --git a/bin/jenkins_master_wrapper.sh b/bin/jenkins_master_wrapper.sh index 6f472efe..77c90026 100755 --- a/bin/jenkins_master_wrapper.sh +++ b/bin/jenkins_master_wrapper.sh @@ -3,6 +3,7 @@ set -u set -e +# these nodes also need to be listed in bin/reproducible_common.sh where they define $BUILD_NODES case "$NODE_NAME" in bpi0-armhf-rb.debian.net) exec ssh -p 2222 $NODE_NAME "$JOB_NAME" diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh index 0d13a6f7..e939a4fc 100755 --- a/bin/reproducible_common.sh +++ b/bin/reproducible_common.sh @@ -42,12 +42,17 @@ JENKINS_URL=${JENKINS_URL:0:-1} SUITES="testing unstable experimental" # architectures being tested ARCHS="armhf amd64" -# number of cores to be used -NUM_CPU=$(grep -c '^processor' /proc/cpuinfo) + +# define build nodes in use +BUILD_NODES="bpi0-armhf-rb.debian.net hb0-armhf-rb.debian.net wbq0-armhf-rb.debian.net cbxi4pro0-armhf-rb.debian.net profitbricks-build1-amd64.debian.net profitbricks-build2-amd64.debian.net" # these also needs to be defined in bin/jenkins_master_wrapper.sh +BUILD_ENV_VARS="ARCH NUM_CPU CPU_MODEL DATETIME" # these also needs to be defined in bin/reproducible_info.sh # existing usertags USERTAGS="toolchain infrastructure timestamps fileordering buildpath username hostname uname randomness buildinfo cpu signatures environment umask ftbfs locale" +# number of cores to be used +NUM_CPU=$(grep -c '^processor' /proc/cpuinfo) + # we only need them for html creation but we cannot declare them in a function declare -A SPOKENTARGET diff --git a/bin/reproducible_info.sh b/bin/reproducible_info.sh index e6d0bb54..3b66e6e5 100755 --- a/bin/reproducible_info.sh +++ b/bin/reproducible_info.sh @@ -4,12 +4,15 @@ # released under the GPLv=2 set -e +# common code defining BUILD_ENV_VARS +. /srv/jenkins/bin/reproducible_common.sh +# these variables also need to be in bin/reproducible_common.sh where they define $BUILD_ENV_VARS (see right below) ARCH=$(dpkg --print-architecture) NUM_CPU=$(grep -c '^processor' /proc/cpuinfo) CPU_MODEL=$(cat /proc/cpuinfo |grep "model name"|head -1|cut -d ":" -f2|xargs echo) DATETIME=$(date +'%Y-%m-%d %H:%M %Z') -for i in ARCH NUM_CPU CPU_MODEL DATETIME ; do +for i in $BUILD_ENV_VARS ; do echo "$i=${!i}" done diff --git a/bin/reproducible_nodes_info.sh b/bin/reproducible_nodes_info.sh index 7283f05b..fd5baafd 100755 --- a/bin/reproducible_nodes_info.sh +++ b/bin/reproducible_nodes_info.sh @@ -15,13 +15,13 @@ mkdir -p $TARGET_DIR TMPFILE_SRC=$(mktemp) TMPFILE_NODE=$(mktemp) -for NODE in bpi0-armhf-rb.debian.net hb0-armhf-rb.debian.net wbq0-armhf-rb.debian.net cbxi4pro0-armhf-rb.debian.net profitbricks-build1-amd64.debian.net profitbricks-build2-amd64.debian.net ; do +for NODE in $BUILD_NODES ; do # call jenkins_master_wrapper.sh so we only need to track different ssh ports in one place # jenkins_master_wrapper.sh needs NODE_NAME and JOB_NAME export NODE_NAME=$NODE export JOB_NAME=/srv/jenkins/bin/reproducible_info.sh /srv/jenkins/bin/jenkins_master_wrapper.sh > $TMPFILE_SRC - for KEY in ARCH NUM_CPU CPU_MODEL DATETIME ; do + for KEY in $BUILD_ENV_VARS ; do VALUE=$(egrep "^$KEY=" $TMPFILE_SRC | cut -d "=" -f2-) if [ ! -z "$VALUE" ] ; then echo "$KEY=$VALUE" >> $TMPFILE_NODE -- cgit v1.2.3-54-g00ecf