[Libreoffice-commits] 9 commits - tb/tb tb/tb_internals_Darwin.sh tb/tb_internals.sh tb/tb_phases.sh

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jan 18 17:39:58 PST 2013


 tb/tb                     |   31 ++++-
 tb/tb_internals.sh        |  238 +++++++++++++++++++++++++++++++++-------------
 tb/tb_internals_Darwin.sh |   37 +++++++
 tb/tb_phases.sh           |  117 +++++++++++++++++-----
 4 files changed, 327 insertions(+), 96 deletions(-)

New commits:
commit 7c5543081c8134a3edc81f3e047ac47b31b1e90f
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jan 18 19:39:09 2013 -0600

    tb: misc code fixup/typo

diff --git a/tb/tb_internals.sh b/tb/tb_internals.sh
index fb01ce5..7d1af8c 100644
--- a/tb/tb_internals.sh
+++ b/tb/tb_internals.sh
@@ -18,7 +18,7 @@
 # Exception: P : project name
 #            B : current branch name. gerrit_* are reserved branch names for gerrit works
 #            R : build result indicator ( 0=OK 1=KO 2=False positive )
-#            V : verbose messages (V=1 => verbose message V= => no verbose message, iow: [ $V ] && msgs_log ....
+#            V : verbose messages (V=1 => verbose message V= => no verbose message, iow: [ $V ] && log_msgs ....
 #         MAKE : environement variable is use if set to point to a gnu-make
 #                otherwise overriden to a gne-make found in the PATH
 #
@@ -140,7 +140,7 @@ check_branch_profile()
     local rb=
 
     if [ ! -d "${tb_PROFILE_DIR?}/${b?}" ] ; then
-        msgs_log "No branch specific config for branch '${b?}', using default from profile"
+        log_msgs "No branch specific config for branch '${b?}', using default from profile"
     fi
     if [ "${tb_MODE?}" = "dual" -o "${tb_MODE?}" = "tb" ] ; then
         rb=$(check_branch_profile_tb "$b")
@@ -157,7 +157,7 @@ check_branch_profile()
         rb=$(check_branch_profile_gerrit "${b?}")
         ret=$?
         if [ "${ret?}" = "0" ] ; then
-            if [ -z "${tb_GERRIT_BRANCHES}" ; then
+            if [ -z "${tb_GERRIT_BRANCHES}" ] ; then
                 tb_GERRIT_BRANCHES="${rb?}"
             else
                 tb_GERRIT_BRANCHES="${tb_GERRIT_BRANCHES?} ${rb?}"
@@ -348,7 +348,7 @@ check_for_commit()
                 r=1
             fi
         else
-            msgs_log "Git error while checking for commit on ${TB_GIT_REPO?} for branch ${b?}"
+            log_msgs "Git error while checking for commit on ${TB_GIT_REPO?} for branch ${b?}"
             printf "Git repo broken - error is:\n\n$err_msgs" > error_log.log
             report_error owner "$(print_date)" error_log.log
             exit -1
@@ -503,7 +503,7 @@ determine_make()
 #
 die()
 {
-    echo "[$(print_date) ${P?}] Error:" "$@" | tee -a ${tb_LOGFILE?}
+    echo "[$(print_date) ${P}:${B}] Error:" "$@" | tee -a ${tb_LOGFILE?}
     exit -1;
 }
 
@@ -647,7 +647,7 @@ load_profile()
 
 log_msgs()
 {
-    echo "[$(print_date) ${P?}]" "$@" | tee -a ${tb_LOGFILE?}
+    echo "[$(print_date) ${P?}:${B}]" "$@" | tee -a ${tb_LOGFILE?}
 }
 
 prepare_git_repo_for_gerrit()
@@ -922,13 +922,13 @@ local log_type="$1"
 local status="failed"
 local gzlog=
 
-    [ $V ] && echo "report to gerrit retval=${retval} log_type=${log_type}"
+    [ $V ] && echo "report to gerrit retval=${R} log_type=${log_type}"
     if [ "$log_type" = "short"  -a "${R?}" = "0" ] ; then
         gzlog="tinder.log.gz"
         (
-            echo "gerrit_task_ticket:$GERRIT_TASK_TICKET"
-            echo "gerrit_task_branch:$GERRIT_TASK_BRANCH"
-            echo "gerrit task_ref:$GERRIT_TASK_REF"
+            echo "gerrit_task_ticket:${GERRIT_TASK_TICKET?}"
+            echo "gerrit_task_branch:${GERRIT_TASK_BRANCH?}"
+            echo "gerrit task_ref:${GERRIT_TASK_REF?}"
             echo ""
             echo "Build: OK"
             echo ""
@@ -937,11 +937,11 @@ local gzlog=
     else
         gzlog="tinder.log.gz"
         (
-            echo "gerrit_task_ticket:$GERRIT_TASK_TICKET"
-            echo "gerrit_task_branch:$GERRIT_TASK_BRANCH"
-            echo "gerrit task_ref:$GERRIT_TASK_REF"
+            echo "gerrit_task_ticket:${GERRIT_TASK_TICKET?}"
+            echo "gerrit_task_branch:${GERRIT_TASK_BRANCH?}"
+            echo "gerrit task_ref:${GERRIT_TASK_REF?}"
             echo ""
-            if [ "${retval?}" = "0" ] ; then
+            if [ "${R?}" = "0" ] ; then
                 echo "Build: OK"
             else
                 echo "Build: FAIL"
@@ -952,12 +952,15 @@ local gzlog=
     fi
 
     if [ "${R?}" = "0" ] ; then
+        log_msgs "Report Success for gerrit ref ${GERRIT_TASK_TICKET?}"
         status="success"
     elif [ "${R?}" = "2" ] ; then
+        log_msgs "Report Cancellation for gerrit ref ${GERRIT_TASK_TICKET?}"
         status="canceled"
+    else
+        log_msgs "Report Failure for gerrit ref ${GERRIT_TASK_TICKET?}"
     fi
-    log_msgs "Report Success for gerrit ref '$GERRIT_TASK_TICKET'."
-    cat "${gzlog}" | ssh ${TB_GERRIT_HOST?} buildbot put --id ${TB_ID?} --ticket "${GERRIT_TASK_TICKET}" --status $status --log -
+    cat "${gzlog}" | ssh ${TB_GERRIT_HOST?} buildbot put --id ${TB_ID?} --ticket "${GERRIT_TASK_TICKET?}" --status $status --log -
 
 }
 
@@ -995,7 +998,7 @@ tinderbox: END
         (
             echo "$message_content"
             cat "${TB_METADATA_DIR?}/${P}_${B?}_current-git-timestamp.log"
-            for cm in $(cat ${TB_METADATA_DIR?}/${P?}_${B?}_current-git-head.log) ; do echo "TinderboxPrint: $(generate_cgit_link ${cm})" ; done
+            for cm in $(cat ${TB_METADATA_DIR?}/${P?}_${B?}_current-git-head.log) ; do echo "TinderboxPrint: $(generate_cgit_link "core:${cm}")" ; done
             cat tb_${B?}_autogen.log tb_${B?}_clean.log tb_${B?}_build.log tb_${B?}_tests.log 2>/dev/null
         ) | gzip -c > "${gzlog}"
         xtinder="X-Tinder: gzookie"
@@ -1023,6 +1026,15 @@ rotate_logs()
         cp -f "${TB_METADATA_DIR?}/${P}_${B?}_current-git-head.log" "${TB_METADATA_DIR?}/${P}_${B?}_last-failure-git-head.txt" 2>/dev/null
         cp -f "${TB_METADATA_DIR?}/${P}_${B?}_current-git-timestamp.log" "${TB_METADATA_DIR?}/${P}_${B?}_last-failure-git-timestamp.txt" 2>/dev/null
     fi
+    for f in tb_${B}*.log ; do
+        mv -f ${f} prev-${f} 2>/dev/null
+    done
+    pushd "${TB_METADATA_DIR?}" > /dev/null
+    for f in ${P?}_${B}*.log ; do
+        mv -f ${f} prev-${f} 2>/dev/null
+    done
+    popd > /dev/null
+
 }
 
 rotate_branches()
@@ -1070,7 +1082,9 @@ local s=0
                 s=${TB_POST_BUILD_DELAY?}
                 ;;
             wait)
-                log_msgs "Nothing to do. waiting ${TB_POLL_DELAY?} seconds."
+                if [ "${s?}" != "${TB_POLL_DELAY?}" ] ; then
+                    log_msgs "Nothing to do. waiting ${TB_POLL_DELAY?} seconds."
+                fi
                 s=${TB_POLL_DELAY?}
                 ;;
             *)
@@ -1098,6 +1112,7 @@ run_one_gerrit()
 {
     R=0
     (
+        log_msgs "Starting tb build gerrit ref:${GERRIT_TASK_TICKET?}"
         # source branch-level configuration
         source_branch_level_config "${B?}" "gerrit"
 
@@ -1137,6 +1152,7 @@ run_one_tb()
 {
     R=0
     (
+        log_msgs "Starting tb build for sha:$(cat "${TB_METADATA_DIR?}/${P}_${B?}_current-git-head.log")"
         source_branch_level_config "${B?}" "${tb_BUILD_TYPE?}"
         if [ -z "$TB_BUILD_DIR" ] ; then
             TB_BUILD_DIR="${TB_GIT_DIR?}"
@@ -1170,6 +1186,7 @@ run_one_tb()
             if [ "$R" = "0" ] ; then
                 report_to_tinderbox "$last_checkout_date" "success" "yes"
                 phase_list=
+                log_msgs "Successful tb build for sha:$(cat "${TB_METADATA_DIR?}/${P}_${B?}_current-git-head.log")"
             elif [ "$R" = "2" ] ; then
                 if [ "${tb_ONE_SHOT?}" != "1" ] ; then
                     report_to_tinderbox "${last_checkout_date?}" "fold" "no"
@@ -1178,9 +1195,11 @@ run_one_tb()
                     # false negative does not need a full clean build, let's just redo make and after
                 retry_count=$((retry_count - 1))
                 if [ "$retry_count" = "0" ] ; then
+                    log_msgs "False Negative Failed tb build for sha:$(cat "${TB_METADATA_DIR?}/${P}_${B?}_current-git-head.log")"
                     phase_list=""
                     R=2
                 else
+                    log_msgs "False Negative Retry tb build for sha:$(cat "${TB_METADATA_DIR?}/${P}_${B?}_current-git-head.log")"
                     phase_list="make test push"
                     R=0
                 fi
@@ -1195,13 +1214,15 @@ run_one_tb()
                 report_error committer "$last_checkout_date" report_error.log
                 report_to_tinderbox "${last_checkout_date?}" "build_failed" "yes"
                 phase_list=""
+                log_msgs "Failed tb build for sha:$(cat "${TB_METADATA_DIR?}/${P}_${B?}_current-git-head.log")"
             fi
         done
+        rotate_logs
         popd > /dev/null
         exit $R
     )
     R="$?"
-    rotate_logs
+
 }
 
 #
@@ -1319,7 +1340,7 @@ select_next_tb_task()
             r="$?"
             if [ ${r?} = 0 ] ; then
                 B="${b?}"
-                rotate_branches ${tb_TB_BRANCHES?}
+                tb_TB_BRANCHES=$(rotate_branches ${tb_TB_BRANCHES?})
                 tb_BUILD_TYPE="tb"
                 break
             fi
@@ -1341,7 +1362,7 @@ send_mail_msg()
         smtp_auth="-xu ${TB_SMTP_USER?} -xp ${TB_SMTP_PASSWORD?}"
     fi
 
-    log_msgs "send mail to ${to?} with subject \"${subject?}\""
+    [ $V ] && log_msgs "send mail to ${to?} with subject \"${subject?}\""
     [ $V ] && quiet=""
     if [ -n "${log}" ] ; then
         ${tb_BIN_DIR?}/tb_send_email $quiet -f "${TB_OWNER?}" -s "${TB_SMTP_HOST?}" $smtp_auth -t "${to?}" -bcc "${bcc?}" -u "${subject?}" -o "message-header=${headers?}" -a "${log?}"
@@ -1390,7 +1411,7 @@ setup_profile_defaults()
         if [ ! -f "${TB_LOGFILE?}" ] ; then
             touch "${TB_LOGFILE?}" || die "Creating ${TB_LOGFILE?}"
         fi
-        tb_LOGFILE="$TB_LOGFILES"
+        tb_LOGFILE="${TB_LOGFILE?}"
     fi
 
     if [ -z "{TB_METADATA_DIR}" ] ; then
@@ -1509,10 +1530,7 @@ local rc
                 echo "Warning: missing SMTPUSER (can work, depends on your smtp server)" 1>&2
             fi
             if [ -n "${TB_SMTP_USER}" -a -z "${TB_SMTP_PASSWORD}" ] ; then
-                die "TB_SMTP_PASSWRD is required with TB_SMTP_USER set"
-            fi
-            if [ "$rc" != "0" ] ; then
-                exit 1
+                die "TB_SMTP_PASSWORD is required with TB_SMTP_USER set"
             fi
             ;;
         none)
diff --git a/tb/tb_phases.sh b/tb/tb_phases.sh
index d7cc588..41eb445 100644
--- a/tb/tb_phases.sh
+++ b/tb/tb_phases.sh
@@ -22,7 +22,7 @@ pre_autogen()
 canonical_do_autogen()
 {
     if [ "${R}" = "0" ] ; then
-        if ! ${TB_NICE} ./autogen.sh >tb_${B}_autogen.log 2>&1 ; then
+        if ! ${TB_NICE} ./autogen.sh > "tb_${B}_autogen.log" 2>&1 ; then
             tb_REPORT_LOG=tb_${B}_autogen.log
             tb_REPORT_MSGS="autogen/configure failed - error is:"
             R=1
@@ -32,11 +32,12 @@ canonical_do_autogen()
 
 do_autogen()
 {
-    canonical_autogen
+    canonical_do_autogen
 }
 
 canoncial_post_autogen()
 {
+    return
 }
 
 canonical_pre_clean()
@@ -56,7 +57,7 @@ canonical_do_clean()
     if [ "${R}" = "0" ] ; then
         if ! ${TB_NICE} ${TB_WATCHDOG} ${MAKE?} -sr clean > "tb_${B?}_clean.log" 2>&1 ; then
             tb_REPORT_LOG="tb_${B?}_clean.log"
-            tb_REPORT_MSGS"cleaning up failed - error is:"
+            tb_REPORT_MSGS="cleaning up failed - error is:"
             R=1
         fi
     fi
@@ -69,6 +70,7 @@ do_clean()
 
 canonical_post_clean()
 {
+    return
 }
 
 canonical_do_make()
@@ -79,7 +81,7 @@ local extra_buildid=""
 
     tb_OPT_DIR=""
     if [ "${tb_BUILD_TYPE?}" = "tb" ] ; then
-        current_timestamp=$(sed -e "s/ /_/" "${TB_METADATA_DIR?}/tb_${B}_current-git-timestamp.log")
+        current_timestamp=$(sed -e "s/ /_/" "${TB_METADATA_DIR?}/${P?}_${B}_current-git-timestamp.log")
         extra_buildid="TinderBox: ${TB_NAME?}, Branch:${B}, Time: $current_timestamp"
     fi
     if [ "${R}" = "0" ] ; then
@@ -135,6 +137,7 @@ post_make()
 
 canonical_pre_test()
 {
+    return
 }
 
 canonical_do_test()
@@ -157,10 +160,12 @@ do_test()
 
 canonical_post_test()
 {
+    return
 }
 
 canonical_pre_push()
 {
+    return
 }
 
 canonical_do_push()
@@ -191,6 +196,7 @@ do_push()
 
 canonical_post_push()
 {
+    return
 }
 
 tb_call()
commit e40e614bf997048cca0d6f4fc424171296ca0d60
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jan 18 19:37:42 2013 -0600

    tb: try to gues the tinderbox-server branch name to use

diff --git a/tb/tb_internals.sh b/tb/tb_internals.sh
index b3225d9..fb01ce5 100644
--- a/tb/tb_internals.sh
+++ b/tb/tb_internals.sh
@@ -233,10 +233,13 @@ check_branch_profile_tb()
 
     source_branch_level_config "${b?}" "tb"
 
-    if [ -z "${TB_TINDERBOX_BRANCH}" ; then
+    if [ -z "${TB_TINDERBOX_BRANCH}" ] ; then
+        TB_TINDERBOX_BRANCH=$(determine_default_tinderbox_branch "${b?}")
         # FIXME: determine if we can derive that value
         # from ${b}
-        die "Missing TB_TINDERBOX_BRANCH to associate a BRANCH name on the tiderbox server to the branch ${b?}"
+        if [ -z "${TB_TINDERBOX_BRANCH}" ] ; then
+            die "Missing TB_TINDERBOX_BRANCH to associate a BRANCH name on the tiderbox server to the branch ${b?}"
+        fi
     fi
 
     if [ "${TB_BIBISECT}" == "1" ] ; then
@@ -444,6 +447,29 @@ deliver_to_bibisect()
     [ $V ] && echo "unlock ${lock_file?}.bibisect"
 }
 
+
+determine_default_tinderbox_branch()
+{
+    local b="$1"
+
+    case "$b" in
+        master)
+            echo 'MASTER'
+            ;;
+        libreoffice-3-4)
+            echo "${b?}"
+            ;;
+        libreoffice-3-5)
+            echo "${b?}"
+            ;;
+        libreoffice-3-6)
+            echo "${b?}"
+            ;;
+        libreoffice-4-0)
+            echo "${b?}"
+            ;;
+    esac
+}
 #
 # Find a gnu make
 #
@@ -1425,6 +1451,10 @@ source_branch_level_config()
     if [ -f "${tb_PROFILE_DIR?}/branches/${b?}/config_${t?}" ] ; then
         source "${tb_PROFILE_DIR?}/branches/${b?}/config_${t?}"
     fi
+    # we have verified the branch before so that should work
+    if [ -z "${TB_TINDERBOX_BRANCH}" ] ; then
+        TB_TINDERBOX_BRANCH=$(determine_default_tinderbox_branch "${b?}")
+    fi
 }
 
 #
commit fb4bfe229fe8697578c320cf2e80c3703dca4239
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jan 18 19:36:52 2013 -0600

    tb: get the absolute path for Bin_dir

diff --git a/tb/tb b/tb/tb
index b44df7c..0777718 100755
--- a/tb/tb
+++ b/tb/tb
@@ -15,7 +15,11 @@ if [ -n "$debug" ] ; then
     set -x
 fi
 
+# get the abolute path to the directory containing the main script
 tb_BIN_DIR=$(dirname "$0")
+pushd ${tb_BIN_DIR} > /dev/null
+tb_BIN_DIR=$(pwd)
+popd > /dev/nukk
 
 source "${tb_BIN_DIR?}/tb_internals.sh"
 
commit de52932c9349459e1f5ae418062261ab1f0328d7
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jan 18 04:09:43 2013 -0600

    tb: Update Documentation

diff --git a/tb/tb b/tb/tb
index 1946808..b44df7c 100755
--- a/tb/tb
+++ b/tb/tb
@@ -5,6 +5,12 @@
 #    License: GPLv3
 #
 
+#
+# ATTENTION Developers: see tb_internal.sh for information
+# about design, naming conventions etc...
+#
+
+# run debug=1 tb ... to debug
 if [ -n "$debug" ] ; then
     set -x
 fi
@@ -108,6 +114,9 @@ In other words: B prevail over P, which prevail over G.
 
 The following variables can be specified in tb's configuration files.
 
+CCACHE_DIR=<path> This is to override the normal ccache environment variable.
+                  This allow to have a per profile, or even better, a per branche
+                  cache.
 TB_BIBISECT_DIR=<path> Location of a git bibisect repository
                        This is a tb-mode only paramter. This is ingored in gerrit mode
                        This is a tb-mode only paramter. This is ingored in gerrit mode
@@ -135,6 +144,9 @@ TB_BRANCH_REMOTE_REFSPEC=<ref> Name of the branch on the remote repo.
                                This is a tb-mode only paramter. This is ingored in gerrit mode
 TB_BUILD_DIR=<path> Directory to use a a build directory. If specified, it must exist.
                     Default to TB_GIT_DIR.
+TB_CCACHE_SIZE=<size> When CCACHE is specified at a profile or branche level
+                      if TB_CCACHE_SIZE as a value it is used to run
+                      ccache -M <size> to insure that the cache has the appropriate size
 TB_DEFAULT_MODE=[gerrit|gerrit-tb|tb-gerrit|tb] Default mode of operation.
                                                 This is a G or P level parameter
                                                 The command line --mode= override both level.
@@ -146,6 +158,13 @@ TB_GIT_DIR=<path> Location of the libreoffice core git repo to use for a build.
                   This parameter is mandatory.
 TB_ID=<integer> Id of the tinderbox. see http://wiki/documentfoundation.org/Development/Tinderbox
                 for information on how to acquire such an ID.
+TB_INCREMENTAL=[0|1] Indicate that one want to do incremental build, iow skip the clean phase
+                     This apply only to tb build, as tb build are normally progressive
+                     in time, whereas gerrit build can be all over the place...
+                     This only make sens if each branch that is meant to be built incrementally
+                     has it's own build directory (which for now also mean its own git repo
+                     at least until gbuildification is complete and the source tree is finaly
+                     treated as a read-only zone.
 TB_LOGFILE=<path> File where tb will log message about it's operation.
                   The file does not have to exist, but the path containing the file must.
                   This is only for message issued by tb itself.. this does no relate to build
diff --git a/tb/tb_internals.sh b/tb/tb_internals.sh
index fa5b220..b3225d9 100644
--- a/tb/tb_internals.sh
+++ b/tb/tb_internals.sh
@@ -4,8 +4,8 @@
 #    Copyright (C) 2011-2013 Norbert Thiebaud
 #    License: GPLv3
 #
-
-# Naming convention
+#
+# Naming convention/Namespace
 #
 # lowercase variable: local variable. must be declared as 'local'
 #
@@ -17,11 +17,47 @@
 #
 # Exception: P : project name
 #            B : current branch name. gerrit_* are reserved branch names for gerrit works
-#            R : build result indicator
-#            V : verbose messages
+#            R : build result indicator ( 0=OK 1=KO 2=False positive )
+#            V : verbose messages (V=1 => verbose message V= => no verbose message, iow: [ $V ] && msgs_log ....
 #         MAKE : environement variable is use if set to point to a gnu-make
 #                otherwise overriden to a gne-make found in the PATH
 #
+# profile_* reserved for functions specific to .../<profile_name>/phases.sh
+# branches_* reserved for functions specific to .../<branch_name>/phases.sh
+# canonical_* reserverved for phase implementation in tb_phases.sh
+# canonical_[pre|do|post]_<phase> is garanteed to exist, even if it is a no-op function.
+#
+# The rational for these namespace is to allow lower-level overload to still call
+# the implementation at higher level.
+#
+# for instance if a branche phase.sh want derefine the TMPDIR and clean it up
+# in the pre-clean phase, but still want to do what-ever the tb_phase.sh normally do
+# it can implement
+# pre_clean()
+# {
+#    do what I need to do
+#    canonical_pre_clean() to invoke the defautl impelmentation
+# }
+#
+# similarely at the profile level one can override pre-clean in this fashion:
+#
+# profile_pre_clean()
+# {
+#     profile override implementation fo pre-clean()
+# }
+#
+# pre_clean()
+# {
+#     profile_pre_clean()
+# }
+#
+# that way a branch's phase.sh can invoke profile_pre_clean in it's own implemenation of pre_clean()
+#
+# ATTENTION: do not abuse this scheme by having defferent level invoking different phase
+# at higher level... so a branch's pre_clean() for instance shall not invoke canonical_do_clean()
+# or any other phase than *_pre_clean()
+# Obviously profile level phase.sh shall not invoke any branche_* functions.
+#
 # Configuration files layout
 #
 #  ~/.tb/config
@@ -44,40 +80,8 @@
 # Note: config are accumulated from high to low.
 #       autogen are 'lowest level prime'.
 
-
 # XRef :
 #
-# TB_BIBISECT_DIR :
-# TB_BIBISECT_GC :
-# TB_BIBISECT_PUSH :
-# TB_BIBISECT :
-# TB_BRANCHES :
-# TB_BRANCH_LOCAL_REFSPEC :
-# TB_BRANCH_REMOTE_REFSPEC :
-# TB_BUILD_DIR :
-# TB_CONFIG_DIR :
-# TB_DEFAULT_MODE:-tb :
-# TB_DO_TESTS :
-# TB_GERRIT_BRANCH :
-# TB_GERRIT_HOST :
-# TB_GIT_DIR :
-# TB_ID :
-# TB_LOGFILE :
-# TB_MATADATA_DIR :
-# TB_METADATA_DIR :
-# TB_NAME :
-# TB_NICE_CPU :
-# TB_NICE_IO :
-# TB_OWNER :
-# TB_POLL_DELAY :
-# TB_PROFILE_DIR :
-# TB_PROFILE :
-# TB_SMTP_HOST :
-# TB_SMTP_PASSWORD :
-# TB_SMTP_USER :
-# TB_TINDERBOX_BRANCH :
-# TB_WATCHDOG :
-
 # tb_BIN_DIR :
 # tb_BRANCHES :
 # tb_BRANCH_AUTHOR :
@@ -1490,6 +1494,13 @@ local rc
 
 }
 
+# Do we have timeout? If yes, guard git pull with that - which has a
+# tendency to hang forever, when connection is flaky
+if which timeout > /dev/null 2>&1 ; then
+	# std coreutils - timeout is two hours
+	tb_TIMEOUT="$(which timeout) 2h"
+fi
+
 ################
 # ATTENTION:
 # Nothing below this point can be overriden at the platform-level
commit 07af2dbd6a981d7f7e36f34ff2de287b1835f939
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jan 18 04:09:31 2013 -0600

    tb: pass the list of candidates branches to builbot get command

diff --git a/tb/tb_internals.sh b/tb/tb_internals.sh
index 6e8aed9..fa5b220 100644
--- a/tb/tb_internals.sh
+++ b/tb/tb_internals.sh
@@ -1212,7 +1212,7 @@ select_next_gerrit_task()
     GERRIT_TASK_BRANCH=""
     GERRIT_TASK_REF=""
     GERRIT_TASK_FEATURE=""
-    result=$(ssh ${TB_GERRIT_HOST?} buildbot get -p core --id ${TB_ID?} -a ${tb_GERRIT_PLATFORM?} --format BASH)
+    result=$(ssh ${TB_GERRIT_HOST?} buildbot get -p core --id ${TB_ID?} -a ${tb_GERRIT_PLATFORM?} --format BASH ${tb_GERRIT_BRANCHES?})
     [ $V ] && echo "Get task result:${result}"
 
     has_task=$(echo "$result" | grep "^GERRIT_TASK_")
commit 884c6fecbaa6ded25c5994e4ecac2e11c1ca627c
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jan 18 04:09:00 2013 -0600

    tb: missing Darwin specific parts, and 'timeout' support

diff --git a/tb/tb_internals.sh b/tb/tb_internals.sh
index 068d4d5..6e8aed9 100644
--- a/tb/tb_internals.sh
+++ b/tb/tb_internals.sh
@@ -314,7 +314,7 @@ check_for_commit()
 
     pushd "${TB_GIT_DIR?}" > /dev/null || die "Cannot cd to git repo ${TB_GIT_DIR?} for tb-branche ${b?}"
 
-    err_msgs="$( $timeout git fetch 2>&1)"
+    err_msgs="$( $tb_TIMEOUT git fetch 2>&1)"
     if [ "$?" -ne "0" ] ; then
         printf "Git repo broken - error is:\n\n$err_msgs" > error_log.log
         report_error owner "$(print_date)" error_log.log
diff --git a/tb/tb_internals_Darwin.sh b/tb/tb_internals_Darwin.sh
new file mode 100644
index 0000000..64cb469
--- /dev/null
+++ b/tb/tb_internals_Darwin.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+#
+#
+#    Copyright (C) 2011-2013 Norbert Thiebaud
+#    License: GPLv3+
+#
+# Mac specific override
+#
+
+# Do we have timeout? If yes, guard git pull with that - which has a
+# tendency to hang forever, when connection is flaky
+if which gtimeout > /dev/null 2>&1 ; then
+    # MacPorts/self-built - timeout is two hours
+    tb_TIMEOUT="$(which gtimeout) 2h"
+fi
+
+epoch_from_utc()
+{
+    date -juf '%Y-%m-%d %H:%M:%S' "$1 $2" '+%s'
+}
+
+epoch_to_utc()
+{
+    date -juf '%s' $1
+}
+
+print_date()
+{
+    date -u '+%Y-%m-%d %H:%M:%S'
+}
+
+deliver_lo_to_bibisect()
+{
+    rm -fr ${ARTIFACTDIR?}/opt
+    mkdir ${ARTIFACTDIR?}/opt
+    cp -fR ${optdir}/LibreOffice.app ${ARTIFACTDIR?}/opt/
+}
commit 879596443b58dce0ab18b051745d6b5428c031e4
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jan 18 04:04:07 2013 -0600

    tb: size CCACHE_DIR when specified on a per profile or per branch

diff --git a/tb/tb_internals.sh b/tb/tb_internals.sh
index ee24fe0..068d4d5 100644
--- a/tb/tb_internals.sh
+++ b/tb/tb_internals.sh
@@ -195,8 +195,21 @@ check_branch_profile_gerrit()
 {
     local b="$1"
 
+    # unset higher level CCACHE_DIR setting
+    unset CCACHE_DIR
+
     source_branch_level_config "${b?}" "gerrit"
 
+    # if CCACHE_DIR is set it has been set by the branch's profile
+    # if TB_CCACHE_SIZE is set make sure the cache is as big as specified
+    # note: no need to restore the old CCACHE value
+    # since check_branches is run in a sub-shell
+    if [ -n "${CCACHE_DIR}" ] ; then
+        if [ -n "${TB_CCACHE_SIZE}" ] ; then
+            ccache -M "${TB_CCACHE_SIZE?}" > /dev/null
+        fi
+    fi
+
     # if we did not die yet... we are good for this branch: print it
     echo "${b?}"
 
@@ -211,6 +224,9 @@ check_branch_profile_tb()
     local b="$1"
     local sha=
 
+    # unset higher level CCACHE_DIR setting
+    unset CCACHE_DIR
+
     source_branch_level_config "${b?}" "tb"
 
     if [ -z "${TB_TINDERBOX_BRANCH}" ; then
@@ -233,6 +249,16 @@ check_branch_profile_tb()
         fi
     fi
 
+    # if CCACHE_DIR is set it has been set by the branch's profile
+    # if TB_CCACHE_SIZE is set make sure the cache is as big as specified
+    # note: no need to restore the old CCACHE value
+    # since check_branches is run in a sub-shell
+    if [ -n "${CCACHE_DIR}" ] ; then
+        if [ -n "${TB_CCACHE_SIZE}" ] ; then
+            ccache -M "${TB_CCACHE_SIZE?}" > /dev/null
+        fi
+    fi
+
     # if we did not die yet... we are good for this branch: print it
     echo "${b?}"
 }
@@ -544,7 +570,7 @@ load_profile()
     local p=$1
     local rc=0
     local config_file=
-
+    local old_ccache_dir=
 
     if [ -z "$p" ] ; then
         die "A profile is needed to run: use -p or configure one"
@@ -553,6 +579,12 @@ load_profile()
         if [ ! -d "${tb_PROFILE_DIR}" ] ; then
             die "You need to configure the profile ${p} to use it"
         fi
+
+        #save the current CCACHE_DIR setting
+        if [ -n "${CCACHE_DIR}" ] ; then
+            old_ccache_dir="${CCACHE_DIR?}"
+            unset CCACHE_DIR
+        fi
         config_file="${tb_PROFILE_DIR?}/config"
         if [ -f "${config_file?}" ] ; then
             source "${config_file?}"
@@ -565,6 +597,21 @@ load_profile()
         if [ -f "${tb_PROFILE_DIR?}/phases.sh" ] ; then
             source "${tb_PROFILE_DIR?}/phases.sh"
         fi
+
+        # if we have a CCACHE_DIR here, it has been set by
+        # the profile. if we also haev a TB_CCACHE_SIZE
+        # make sure the cache is as big as indicated
+        # if CCACHE_DIR is not set, restaure the potential
+        # previous value
+        if [ -n "${CCACHE_DIR}" ] ; then
+            if [ -n "${TB_CCACHE_SIZE}" ] ; then
+                ccache -M "${TB_CCACHE_SIZE?}" > /dev/null
+            fi
+        else
+            if [ -n "${old_ccache_dir}" ] ; then
+                CCACHE="${old_ccache_dir?}"
+            fi
+        fi
     fi
 }
 
commit 989a54666dc2112cb219dc0848b1de7e11dd08c4
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jan 18 04:03:01 2013 -0600

    tb: allow to call default phase implementation in override function

diff --git a/tb/tb_phases.sh b/tb/tb_phases.sh
index 1c8e24c..d7cc588 100644
--- a/tb/tb_phases.sh
+++ b/tb/tb_phases.sh
@@ -5,7 +5,7 @@
 #    License: GPLv3
 #
 
-pre_autogen()
+canonical_pre_autogen()
 {
     if [ "${R}" = "0" ] ; then
         if [ ! -f autogen.lastrun -o "${tb_KEEP_AUTOGEN}" != "YES" ] ; then
@@ -14,7 +14,12 @@ pre_autogen()
     fi
 }
 
-do_autogen()
+pre_autogen()
+{
+    canonical_pre_autogen
+}
+
+canonical_do_autogen()
 {
     if [ "${R}" = "0" ] ; then
         if ! ${TB_NICE} ./autogen.sh >tb_${B}_autogen.log 2>&1 ; then
@@ -25,14 +30,28 @@ do_autogen()
     fi
 }
 
-pre_clean()
+do_autogen()
+{
+    canonical_autogen
+}
+
+canoncial_post_autogen()
+{
+}
+
+canonical_pre_clean()
 {
     if [ "${R}" = "0" ] ; then
         true # log files to clean, if any
     fi
 }
 
-do_clean()
+pre_clean()
+{
+    canonical_pre_clean
+}
+
+canonical_do_clean()
 {
     if [ "${R}" = "0" ] ; then
         if ! ${TB_NICE} ${TB_WATCHDOG} ${MAKE?} -sr clean > "tb_${B?}_clean.log" 2>&1 ; then
@@ -43,7 +62,16 @@ do_clean()
     fi
 }
 
-do_make()
+do_clean()
+{
+    canonical_do_clean
+}
+
+canonical_post_clean()
+{
+}
+
+canonical_do_make()
 {
 local current_timestamp=
 local optdir=""
@@ -74,21 +102,12 @@ local extra_buildid=""
     fi
 }
 
-
-do_test()
+do_make()
 {
-    if [ "${R}" = "0" ] ; then
-        if [ "${TB_DO_TESTS}" = "1" ] ; then
-            if ! ${TB_NICE_CPU} ${TB_NICE_IO} ${TB_WATCHDOG} ${MAKE?} -sr check > "tb_${B?}_tests.log" 2>&1 ; then
-                tb_REPORT_LOG="tb_${B?}_tests.log"
-                tb_REPORT_MSGS="check failed - error is:"
-                R=1
-            fi
-        fi
-    fi
+    canonical_do_make
 }
 
-post_make()
+canonical_post_make()
 {
     if [ "${tb_BUILD_TYPE?}" = "tb" ] ; then
         if [ "${R}" != "0" ] ; then
@@ -109,7 +128,42 @@ post_make()
     fi
 }
 
-do_push()
+post_make()
+{
+    canonical_post_make
+}
+
+canonical_pre_test()
+{
+}
+
+canonical_do_test()
+{
+    if [ "${R}" = "0" ] ; then
+        if [ "${TB_DO_TESTS}" = "1" ] ; then
+            if ! ${TB_NICE} ${TB_WATCHDOG} ${MAKE?} -sr check > "tb_${B?}_tests.log" 2>&1 ; then
+                tb_REPORT_LOG="tb_${B?}_tests.log"
+                tb_REPORT_MSGS="check failed - error is:"
+                R=1
+            fi
+        fi
+    fi
+}
+
+do_test()
+{
+    canonical_do_test
+}
+
+canonical_post_test()
+{
+}
+
+canonical_pre_push()
+{
+}
+
+canonical_do_push()
 {
     [ $V ] && echo "Push: phase starting"
 
@@ -130,6 +184,15 @@ do_push()
     return 0;
 }
 
+do_push()
+{
+    canonical_do_push
+}
+
+canonical_post_push()
+{
+}
+
 tb_call()
 {
     [ $V ] && declare -F "$1" > /dev/null && echo "call $1"
commit 17dbd4b8ff8102667d0fb84dd53635a70ba158c9
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Fri Jan 18 04:01:38 2013 -0600

    consolitate io and cpu nicesness

diff --git a/tb/tb b/tb/tb
index 33fcfb5..1946808 100755
--- a/tb/tb
+++ b/tb/tb
@@ -164,6 +164,8 @@ TB_NAME=<name> Name of the tinderbox. see http://wiki/documentfoundation.org/Dev
                for naming conventions.
                This is G or P-level parameter only
                This paramter is mandatory.
+TB_NICE=<prefix> Value to prepend to expensive command like MAKE to nice it
+                 for eacmpel TB_NICE="nice ionice -c3"
 TB_OWNER=<email> Email of the owner/operator of the tinderbox
                  This is G or P-level parameter only
                  This paramter is mandatory.
@@ -271,9 +273,6 @@ while [ "${1}" != "" ]; do
             do_help
             exit
             ;;
-        -i)  # be gentle on i/o
-            TB_NICE_IO="ionice -c3"
-            ;;
         -k)  # do not override the local autogen.lastrun if present
             tb_KEEP_AUTOGEN="1"
             ;;
@@ -326,9 +325,6 @@ while [ "${1}" != "" ]; do
                     ;;
             esac
             ;;
-        -n)  # build 'nicely' :-)
-            TB_NICE_CPU="nice"
-            ;;
         -p)  # profile to use to deterine extra parameter (email mostly) and autogen arguments
             if [ -z "${has_arg}" ] ; then
                 shift;
diff --git a/tb/tb_phases.sh b/tb/tb_phases.sh
index ed8a938..1c8e24c 100644
--- a/tb/tb_phases.sh
+++ b/tb/tb_phases.sh
@@ -17,7 +17,7 @@ pre_autogen()
 do_autogen()
 {
     if [ "${R}" = "0" ] ; then
-        if ! ${TB_NICE_CPU} ${TB_NICE_IO} ./autogen.sh >tb_${B}_autogen.log 2>&1 ; then
+        if ! ${TB_NICE} ./autogen.sh >tb_${B}_autogen.log 2>&1 ; then
             tb_REPORT_LOG=tb_${B}_autogen.log
             tb_REPORT_MSGS="autogen/configure failed - error is:"
             R=1
@@ -35,7 +35,7 @@ pre_clean()
 do_clean()
 {
     if [ "${R}" = "0" ] ; then
-        if ! ${TB_NICE_CPU} ${TB_NICE_IO} ${TB_WATCHDOG} ${MAKE?} -sr clean > "tb_${B?}_clean.log" 2>&1 ; then
+        if ! ${TB_NICE} ${TB_WATCHDOG} ${MAKE?} -sr clean > "tb_${B?}_clean.log" 2>&1 ; then
             tb_REPORT_LOG="tb_${B?}_clean.log"
             tb_REPORT_MSGS"cleaning up failed - error is:"
             R=1
@@ -55,14 +55,14 @@ local extra_buildid=""
         extra_buildid="TinderBox: ${TB_NAME?}, Branch:${B}, Time: $current_timestamp"
     fi
     if [ "${R}" = "0" ] ; then
-        if ! ${TB_NICE_CPU} ${TB_NICE_IO} ${TB_WATCHDOG} ${MAKE?} EXTRA_BUILDID="$extra_buildid" -sr > "tb_${B?}_build.log" 2>&1 ; then
+        if ! ${TB_NICE} ${TB_WATCHDOG} ${MAKE?} EXTRA_BUILDID="$extra_buildid" -sr > "tb_${B?}_build.log" 2>&1 ; then
             tb_REPORT_LOG="tb_${B?}_build.log"
             tb_REPORT_MSGS="build failed - error is:"
             R=1
         else
             # if we want to populate bibisect we need to 'install'
             if [ "${tb_BUILD_TYPE?}" = "tb" -a ${TB_BIBISECT} != "0" ] ; then
-                if ! ${TB_NICE_CPU} ${TB_NICE_IO} ${TB_WATCHDOG} ${MAKE?} EXTRA_BUILDID="${extra_buildid}" -sr install-tb >>"tb_${B?}_build.log" 2>&1 ; then
+                if ! ${TB_NICE} ${TB_WATCHDOG} ${MAKE?} EXTRA_BUILDID="${extra_buildid}" -sr install-tb >>"tb_${B?}_build.log" 2>&1 ; then
                     tb_REPORT_LOG="tb_${B}_build.log"
                     tb_REPORT_MSGS="build failed - error is:"
                     R=1


More information about the Libreoffice-commits mailing list