diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-10-03 01:15:12 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-10-03 01:15:25 -0500 |
commit | a09956d203493e83bda58acc8684df7713494190 (patch) | |
tree | 31646ecd34ed9b7b00e8d7c2278443a837eb6b19 | |
parent | fd55bd852dbb0aee77615a16a29d6a5070db6584 (diff) |
add support for submodules in libreoffice
-rwxr-xr-x | bin/tinbuild2 | 36 | ||||
-rw-r--r-- | bin/tinbuild_internals.sh | 119 |
2 files changed, 100 insertions, 55 deletions
diff --git a/bin/tinbuild2 b/bin/tinbuild2 index 1da4268..5848003 100755 --- a/bin/tinbuild2 +++ b/bin/tinbuild2 @@ -3,6 +3,9 @@ # Copyright (C) 2011 Norbert Thiebaud # License: GPLv3 # +if [ -n "$debug" ] ; then +set -x +fi BIN_DIR=$(dirname "$0") @@ -234,29 +237,32 @@ sanity_check() while [ "${1}" != "" ]; do parm=${1%%=*} arg=${1#*=} - if [ "${arg}" = "$1" ] ; then + has_arg= + if [ "${1}" != "${parm?}" ] ; then + has_arg=1 + else arg="" fi - echo "parm=!${parm}!" - echo "arg=!${arg}!" +# echo "parm=!${parm}!" +# echo "arg=!${arg}!" case "${parm}" in -0) # avoid calling *_clean functions (incremental build) DO_NOT_CLEAN=1 ;; -a) # email to the branch's author for out-of-tinderbox branch buildbot - if [ -z "${arg}" ] ; then + if [ -z "${has_arg}" ] ; then shift; - parm="$1" + arg="$1" fi if [ -z "${arg}" ] ; then echo "Missing argument for option $parm" 1>&2 exit -1 else - BRANCH_AUTHOR="$parm" + BRANCH_AUTHOR="$arg" fi ;; -b) # to override the branch name to use - if [ -z "${arg}" ] ; then + if [ -z "${has_arg}" ] ; then shift; arg="$1" fi @@ -271,7 +277,7 @@ while [ "${1}" != "" ]; do sanity_check # do not return ;; -d) # wrap make in a watchdog - if [ -z "${arg}" ] ; then + if [ -z "${has_arg}" ] ; then shift; arg="$1" fi @@ -289,7 +295,7 @@ while [ "${1}" != "" ]; do FORCE_REBUILD=1 ;; -g) # gerit's ref to fetch. This imply a one time build, no memory - if [ -z "${arg}" ] ; then + if [ -z "${has_arg}" ] ; then shift; arg="$1" fi @@ -314,7 +320,7 @@ while [ "${1}" != "" ]; do KEEP_AUTOGEN="YES" ;; -m) # which email to wend and to whom - if [ -z "${arg}" ] ; then + if [ -z "${has_arg}" ] ; then shift; arg="$1" fi @@ -328,7 +334,7 @@ while [ "${1}" != "" ]; do --mode) # operating mode of the tinbuild # tb,prime,gerrit,tb-gerrit,gerrit-tb - if [ -z "${arg}" ] ; then + if [ -z "${has_arg}" ] ; then shift; arg="$1" fi @@ -343,7 +349,7 @@ while [ "${1}" != "" ]; do NICE="$NICE nice" ;; -p) # profile to use to deterine extra parameter (email mostly) and autogen arguments - if [ -z "${arg}" ] ; then + if [ -z "${has_arg}" ] ; then shift; arg="$1" fi @@ -355,7 +361,7 @@ while [ "${1}" != "" ]; do fi ;; -r) # whether to upload daily build. - if [ -z "${arg}" ] ; then + if [ -z "${has_arg}" ] ; then shift; arg="$1" fi @@ -368,7 +374,7 @@ while [ "${1}" != "" ]; do fi ;; -s) # where to stage the build in case of -z with upload - if [ -z "${arg}" ] ; then + if [ -z "${has_arg}" ] ; then shift; arg="$1" fi @@ -386,7 +392,7 @@ while [ "${1}" != "" ]; do V=1 ;; -w) # cool-down time after a build, in seconds - if [ -z "${arg}" ] ; then + if [ -z "${has_arg}" ] ; then shift; arg="$1" fi diff --git a/bin/tinbuild_internals.sh b/bin/tinbuild_internals.sh index 56868c8..b1038da 100644 --- a/bin/tinbuild_internals.sh +++ b/bin/tinbuild_internals.sh @@ -26,9 +26,9 @@ do_flock() { if [ "$LOCK" = "1" ] ; then if [ -n "${FLOCK}" -a -x "$FLOCK" ] ; then - [ $V ] && echo "locking..." + [ $V ] && echo "locking... $@" ${FLOCK} $@ - [ $V ] && echo "locked." + [ $V ] && echo "locked. $@" else echo "no flock implementation, please build it from buildbot/flock or use -e" 1>&2 exit 1; @@ -111,22 +111,34 @@ get_commits_since_last_good() local repo= local sha= - if [ -f "${METADATA_DIR?}/tb_${B}_last-success-git-heads.txt" ] ; then - for head in $(cat "${METADATA_DIR?}/tb_${B}_last-success-git-heads.txt") ; do - repo=$(echo ${head} | cut -d : -f 1) - sha=$(echo ${head} | cut -d : -f 2) - ( - if [ "${repo?}" != "bootstrap" -a "${repo}" != "core" ] ; then - cd clone/${repo?} - fi - if [ "${mode?}" = "people" ] ; then - git log '--pretty=tformat:%ce' ${sha?}..HEAD - else - echo "==== ${repo} ====" - git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /' - fi - ) - done + if [ -f .gitmodules ] ; then + head=$(head -n1 "${METADATA_DIR?}/tb_${B}_last-success-git-heads.txt") + repo=$(echo ${head} | cut -d : -f 1) + sha=$(echo ${head} | cut -d : -f 2) + if [ "${mode?}" = "people" ] ; then + git log '--pretty=tformat:%ce' ${sha?}..HEAD + else + echo "==== ${repo} ====" + git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /' + fi + else + if [ -f "${METADATA_DIR?}/tb_${B}_last-success-git-heads.txt" ] ; then + for head in $(cat "${METADATA_DIR?}/tb_${B}_last-success-git-heads.txt") ; do + repo=$(echo ${head} | cut -d : -f 1) + sha=$(echo ${head} | cut -d : -f 2) + ( + if [ "${repo?}" != "bootstrap" -a "${repo}" != "core" ] ; then + cd clone/${repo?} + fi + if [ "${mode?}" = "people" ] ; then + git log '--pretty=tformat:%ce' ${sha?}..HEAD + else + echo "==== ${repo} ====" + git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /' + fi + ) + done + fi fi } @@ -137,22 +149,34 @@ get_commits_since_last_bad() local repo= local sha= - if [ -f tb_${B}_last-failure-git-heads.txt ] ; then - for head in $(cat tb_${B}_last-failure-git-heads.txt) ; do - repo=$(echo ${head} | cut -d : -f 1) - sha=$(echo ${head} | cut -d : -f 2) - ( - if [ "${repo?}" != "bootstrap" -a "${repo}" != "core" ] ; then - cd clone/${repo?} - fi - if [ "${mode?}" = "people" ] ; then - git log '--pretty=tformat:%ce' ${sha?}..HEAD - else - echo "==== ${repo} ====" - git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /' - fi - ) - done + if [ -f .gitmodules ] ; then + head=$(head -n1 "${METADATA_DIR?}/tb_${B}_last-failure-git-heads.txt") + repo=$(echo ${head} | cut -d : -f 1) + sha=$(echo ${head} | cut -d : -f 2) + if [ "${mode?}" = "people" ] ; then + git log '--pretty=tformat:%ce' ${sha?}..HEAD + else + echo "==== ${repo} ====" + git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /' + fi + else + if [ -f tb_${B}_last-failure-git-heads.txt ] ; then + for head in $(cat "${METADATA_DIR?}/tb_${B}_last-failure-git-heads.txt") ; do + repo=$(echo ${head} | cut -d : -f 1) + sha=$(echo ${head} | cut -d : -f 2) + ( + if [ "${repo?}" != "bootstrap" -a "${repo}" != "core" ] ; then + cd clone/${repo?} + fi + if [ "${mode?}" = "people" ] ; then + git log '--pretty=tformat:%ce' ${sha?}..HEAD + else + echo "==== ${repo} ====" + git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /' + fi + ) + done + fi fi } @@ -313,8 +337,8 @@ report_fixed () local rough_time="$1" shift - local previous_success=$(cat tb_${B}_last-success-git-timestamp.txt) - local last_failure=$(cat tb_${B}_last-failure-git-timestamp.txt) + local previous_success="$(cat tb_${B}_last-success-git-timestamp.txt)" + local last_failure="$(cat tb_${B}_last-failure-git-timestamp.txt)" to_mail= if [ "$SEND_MAIL" = "owner" -o "$SEND_MAIL" = "debug" -o "$SEND_MAIL" = "author" ] ; then to_mail="${OWNER?}" @@ -375,7 +399,11 @@ EOF collect_current_heads() { [ $V ] && echo "collect_current_head" - ./g -1 rev-parse HEAD > "${METADATA_DIR?}/tb_${B}_current-git-heads.log" + if [ -f .gitmodules ] ; then + echo "core:$(git rev-parse HEAD)" > "${METADATA_DIR?}/tb_${B}_current-git-heads.log" + else + ./g -1 rev-parse HEAD > "${METADATA_DIR?}/tb_${B}_current-git-heads.log" + fi print_date > "${METADATA_DIR?}/tb_${B}_current-git-timestamp.log" } @@ -391,8 +419,8 @@ rotate_logs() cp -f "${METADATA_DIR?}/tb_${B}_current-git-heads.log" "${METADATA_DIR?}/tb_${B}_last-success-git-heads.txt" 2>/dev/null cp -f "${METADATA_DIR?}/tb_${B}_current-git-timestamp.log" "${METADATA_DIR?}/tb_${B}_last-success-git-timestamp.txt" 2>/dev/null elif [ "$retval" != "false_negative" ]; then - cp -f tb_${B}_current-git-heads.log tb_${B}_last-failure-git-heads.txt 2>/dev/null - cp -f tb_${B}_current-git-timestamp.log tb_${B}_last-failure-git-timestamp.txt 2>/dev/null + cp -f "${METADATA_DIR?}/tb_${B}_current-git-heads.log" "${METADATA_DIR?}/tb_${B}_last-failure-git-heads.txt" 2>/dev/null + cp -f "${METADATA_DIR?}/tb_${B}_current-git-timestamp.log" "${METADATA_DIR?}/tb_${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 @@ -421,6 +449,7 @@ check_for_commit() IS_NEW_COMMIT="no" fi fi + [ $V ] && echo "pulling from the repos -> new commit : ${IS_NEW_COMMIT?}" } check_for_gerrit() @@ -456,6 +485,7 @@ wait_for_commits() log_msgs "Waiting until there are changes in the repo..." show_once=0 fi + [ $V ] && echo "sleep 60" sleep 60 ;; yes) @@ -555,12 +585,14 @@ local oc="" fi fi ) 201> ${lock_file?}.bibisect + [ $V ] && echo "unlock ${lock_file?}.bibisect" # asynchhronously compact the bibisect repo, but still hold a lock to avoid try to mess with the reo while being compressed ( do_flock -x -n 201 #close the upper-level lock exec 200>&- bibisect_gc + [ $V ] && echo "unlock ${lock_file?}.bibisect" ) 201> ${lock_file?}.bibisect & } @@ -661,6 +693,7 @@ run_primer() fi ) 200>${lock_file?} retval=$? + [ $V ] && echo "unlock ${lock_file?}" return ${retval?} } @@ -707,6 +740,7 @@ run_gerrit_patch() fi ) 200>${lock_file?} retval=$? + [ $V ] && echo "unlock ${lock_file?}" return ${retval?} } @@ -750,10 +784,12 @@ run_gerrit_loop() fi ) 200>${lock_file?} retval=$? + [ $V ] && echo "unlock ${lock_file?}" if [ -f tb_${B}_stop -o "${retval?}" = "-1" ] ; then break fi if [ "$retval" = "3" ] ; then + [ $V ] && echo "sleep 60" sleep 60 retval="0" fi @@ -922,6 +958,7 @@ local retry_count if [ "${ret?}" == "2" ] ; then retval="false_negative" elif [ "$ret" == "3" ] ; then + [ $V ] && echo "sleep 60" sleep 60 retval="0" else @@ -1036,14 +1073,16 @@ run_tb_loop() fi ) 200>${lock_file?} - ret="$?" + [ $V ] && echo "unlock ${lock_file?}" + if [ -f tb_${B}_stop ] ; then break fi if [ "$ret" == "2" ] ; then retval="false_negative" elif [ "$ret" == "3" ] ; then + [ $V ] && echo "sleep 60" sleep 60 retval="0" else |