Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 2f595d576661aa059c0ca1a9d9450578808a12d5 Mon Sep 17 00:00:00 2001
- From: Tor Lillqvist <tml@iki.fi>
- Date: Sun, 3 Mar 2013 12:08:44 +0200
- Subject: [PATCH] Add --srcdir support hack
- ---
- bin/tinbuild2 | 24 ++++++++++-----
- bin/tinbuild_internals.sh | 76 +++++++++++++++++++++++------------------------
- bin/tinbuild_phases.sh | 2 +-
- 3 files changed, 55 insertions(+), 47 deletions(-)
- diff --git a/bin/tinbuild2 b/bin/tinbuild2
- index 57d2a6c..322985e 100755
- --- a/bin/tinbuild2
- +++ b/bin/tinbuild2
- @@ -25,6 +25,7 @@ WATCHDOG=
- GERRIT_REF=
- DO_NOT_CLEAN=
- GERRIT_HOST="logerrit"
- +SRCDIR="."
- # load the internal functions. note that
- # tinderbuild_internals_<uname>.sh is sourced at the tail
- @@ -151,14 +152,9 @@ load_profile()
- sanity_check()
- {
- - g=$(git rev-parse --git-dir 2> /dev/null)
- + g=$((cd $SRCDIR && git rev-parse --git-dir) 2> /dev/null)
- if [ "$g" != ".git" ] ; then
- - echo "Error: The current working directory must be the root git repo"
- - exit 1
- - fi
- -
- - if [ ! -f configure.in -a ! -f configure.ac ] ; then
- - echo "Error: The current working directory must be the root git repo"
- + echo "Error: $SRCDIR must be the root git repo"
- exit 1
- fi
- @@ -385,6 +381,18 @@ while [ "${1}" != "" ]; do
- STAGE_DIR="${arg}"
- fi
- ;;
- + --srcdir)
- + if [ -z "${has_arg}" ] ; then
- + shift;
- + arg="$1"
- + fi
- + if [ -z "${arg}" ] ; then
- + echo "Missing argument for option $parm" 1>&2
- + exit -1
- + else
- + SRCDIR="${arg}"
- + fi
- + ;;
- -t) # whether to run tests after the build
- DO_TESTS=1
- ;;
- @@ -512,7 +520,7 @@ if [ -n "$BRANCH" ] ; then
- TINDER_BRANCH="$BRANCH"
- B="$BRANCH"
- else
- - B=`git branch | grep '^\*' | sed 's/^..//' | sed 's/\//_/g'`
- + B=`(cd $SRCDIR && git branch) | grep '^\*' | sed 's/^..//' | sed 's/\//_/g'`
- TINDER_BRANCH=
- case "$B" in
- diff --git a/bin/tinbuild_internals.sh b/bin/tinbuild_internals.sh
- index d0b7db5..214e38f 100644
- --- a/bin/tinbuild_internals.sh
- +++ b/bin/tinbuild_internals.sh
- @@ -111,15 +111,15 @@ get_commits_since_last_good()
- local repo=
- local sha=
- - if [ -f .gitmodules ] ; then
- + if [ -f $SRCDIR/.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
- + (cd $SRCDIR && git log '--pretty=tformat:%ce' ${sha?}..HEAD)
- else
- echo "==== ${repo} ===="
- - git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /'
- + (cd $SRCDIR && git log '--pretty=tformat:%h %s' ${sha?}..HEAD) | sed 's/^/ /'
- fi
- else
- if [ -f "${METADATA_DIR?}/tb_${B}_last-success-git-heads.txt" ] ; then
- @@ -131,10 +131,10 @@ get_commits_since_last_good()
- cd clone/${repo?}
- fi
- if [ "${mode?}" = "people" ] ; then
- - git log '--pretty=tformat:%ce' ${sha?}..HEAD
- + (cd $SRCDIR && git log '--pretty=tformat:%ce' ${sha?}..HEAD)
- else
- echo "==== ${repo} ===="
- - git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /'
- + (cd $SRCDIR && git log '--pretty=tformat:%h %s' ${sha?}..HEAD) | sed 's/^/ /'
- fi
- )
- done
- @@ -154,10 +154,10 @@ get_commits_since_last_bad()
- 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
- + (cd $SRCDIR && git log '--pretty=tformat:%ce' ${sha?}..HEAD)
- else
- echo "==== ${repo} ===="
- - git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /'
- + (cd $SRCDIR && git log '--pretty=tformat:%h %s' ${sha?}..HEAD) | sed 's/^/ /'
- fi
- else
- if [ -f tb_${B}_last-failure-git-heads.txt ] ; then
- @@ -169,10 +169,10 @@ get_commits_since_last_bad()
- cd clone/${repo?}
- fi
- if [ "${mode?}" = "people" ] ; then
- - git log '--pretty=tformat:%ce' ${sha?}..HEAD
- + (cd $SRCDIR && git log '--pretty=tformat:%ce' ${sha?}..HEAD)
- else
- echo "==== ${repo} ===="
- - git log '--pretty=tformat:%h %s' ${sha?}..HEAD | sed 's/^/ /'
- + (cd $SRCDIR && git log '--pretty=tformat:%h %s' ${sha?}..HEAD) | sed 's/^/ /'
- fi
- )
- done
- @@ -399,10 +399,10 @@ EOF
- collect_current_heads()
- {
- [ $V ] && echo "collect_current_head"
- - if [ -f .gitmodules ] ; then
- - echo "core:$(git rev-parse HEAD)" > "${METADATA_DIR?}/tb_${B}_current-git-heads.log"
- + if [ -f $SRCDIR/.gitmodules ] ; then
- + echo "core:$( (cd $SRCDIR && 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"
- + (cd $SRCDIR && ./g -1 rev-parse HEAD) > "${METADATA_DIR?}/tb_${B}_current-git-heads.log"
- fi
- print_date > "${METADATA_DIR?}/tb_${B}_current-git-timestamp.log"
- }
- @@ -435,7 +435,7 @@ rotate_logs()
- check_for_commit()
- {
- [ $V ] && echo "pulling from the repos"
- - err_msgs="$( $timeout ./g pull -r 2>&1)"
- + err_msgs="$( (cd $SRCDIR && $timeout ./g pull -r 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
- @@ -505,7 +505,7 @@ find_dev_install_location()
- position_bibisect_branch()
- {
- pushd ${ARTIFACTDIR?} > /dev/null
- - git checkout -q ${B?}
- + (cd $SRCDIR && git checkout -q ${B?})
- if [ "$?" -ne "0" ] ; then
- echo "Error could not position the bibisect repository to the branch $B" 1>&2
- exit 1;
- @@ -525,10 +525,10 @@ bibisect_post()
- {
- pushd ${ARTIFACTDIR?} > /dev/null
- if [ "${BIBISECT_GC}" = "Y" ] ; then
- - git gc
- + (cd $SRCDIR && git gc)
- fi
- if [ "${BIBISECT_PUSH}" = "Y" ] ; then
- - git push
- + (cd $SRCDIR && git push)
- fi
- popd > /dev/null
- }
- @@ -547,15 +547,15 @@ deliver_to_bibisect()
- # note: this function will exit if something is wrong
- # avoid delivering the same build twice to bibisect
- - cc=$(git rev-list -1 HEAD)
- + cc=$( (cd $SRCDIR && git rev-list -1 HEAD) )
- if [ -f ${ARTIFACTDIR?}/commit.hash ] ; then
- oc="$(cat ${ARTIFACTDIR?}/commit.hash)"
- fi
- if [ "${cc}" != "${oc}" ] ; then
- deliver_lo_to_bibisect
- - git log -1 --pretty=format:"source-hash-%H%n%n" $BUILDCOMMIT > ${ARTIFACTDIR?}/commitmsg
- - git log -1 --pretty=fuller $BUILDCOMMIT >> ${ARTIFACTDIR?}/commitmsg
- + (cd $SRCDIR && git log -1 --pretty=format:"source-hash-%H%n%n" $BUILDCOMMIT) > ${ARTIFACTDIR?}/commitmsg
- + (cd $SRCDIR && git log -1 --pretty=fuller $BUILDCOMMIT) >> ${ARTIFACTDIR?}/commitmsg
- [ $V ] && echo "Bibisect: Include interesting logs/other data"
- # Include the autogen log.
- @@ -565,7 +565,7 @@ deliver_to_bibisect()
- cp tb_${B?}_build.log ${ARTIFACTDIR?}
- # Make it easy to grab the commit id.
- - git rev-list -1 HEAD > ${ARTIFACTDIR?}/commit.hash
- + (cd $SRCDIR && git rev-list -1 HEAD) > ${ARTIFACTDIR?}/commit.hash
- # Commit build to the local repo and push to the remote.
- [ $V ] && echo "Bibisect: Committing to local bibisect repo"
- @@ -691,14 +691,14 @@ local status="failed"
- fetch_gerrit()
- {
- - GERRIT_PREV_B=`git branch | grep '^\*' | sed 's/^..//' | sed 's/\//_/g'`
- + GERRIT_PREV_B=`(cd $SRCDIR && git branch) | grep '^\*' | sed 's/^..//' | sed 's/\//_/g'`
- [ $V ] && echo "fetching gerrit path from ssh://${GERRIT_HOST?}/core ${GERRIT_TASK_REF}"
- - git fetch -q ssh://${GERRIT_HOST?}/core ${GERRIT_TASK_REF}
- + (cd $SRCDIR && git fetch -q ssh://${GERRIT_HOST?}/core ${GERRIT_TASK_REF})
- if [ "$?" != "0" ] ; then
- retval="3"
- else
- - git checkout -q FETCH_HEAD || die "fatal error checking out gerrit ref"
- - git submodule -q update
- + (cd $SRCDIR && git checkout -q FETCH_HEAD) || die "fatal error checking out gerrit ref"
- + (cd $SRCDIR && git submodule -q update)
- [ $V ] && echo "fetched gerrit path from ssh://${GERRIT_HOST?}/core ${GERRIT_TASK_REF}"
- retval="0"
- fi
- @@ -759,28 +759,28 @@ run_gerrit_patch()
- (
- do_flock -x 200
- - GERRIT_PREV_B=`git branch | grep '^\*' | sed 's/^..//' | sed 's/\//_/g'`
- + GERRIT_PREV_B=`(cd $SRCDIR && git branch) | grep '^\*' | sed 's/^..//' | sed 's/\//_/g'`
- [ $V ] && echo "git fetch ssh://${GERRIT_HOST?}/core $GERRIT_REF"
- - git fetch ssh://${GERRIT_HOST?}/core $GERRIT_REF && git checkout FETCH_HEAD || die "Error setting up the ref";
- + (cd $SRCDIR && git fetch ssh://${GERRIT_HOST?}/core $GERRIT_REF && git checkout FETCH_HEAD) || die "Error setting up the ref";
- - echo "ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Starting Build on ${TINDER_NAME}\" $(git rev-parse HEAD)"
- - ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Starting Build on ${TINDER_NAME}\" $(git rev-parse HEAD) || die "error reviewing in"
- + echo "ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Starting Build on ${TINDER_NAME}\" $( (cd $SRCDIR && git rev-parse HEAD) )"
- + ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Starting Build on ${TINDER_NAME}\" $( (cd $SRCDIR && git rev-parse HEAD) ) || die "error reviewing in"
- retval="0"
- PHASE_LIST="autogen clean make test push"
- do_build "gerrit"
- if [ "${retval}" = "0" ] ; then
- - echo "ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Successful build of $(git rev-parse HEAD) on tinderbox: $TINDER_NAME\" --verified +1 $(git rev-parse HEAD)"
- - ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Successful build of $(git rev-parse HEAD) on tinderbox: $TINDER_NAME\" --verified +1 $(git rev-parse HEAD)
- + echo "ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Successful build of $( (cd $SRCDIR && git rev-parse HEAD) ) on tinderbox: $TINDER_NAME\" --verified +1 $( (cd $SRCDIR && git rev-parse HEAD) )"
- + ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Successful build of $( (cd $SRCDIR && git rev-parse HEAD) ) on tinderbox: $TINDER_NAME\" --verified +1 $( (cd $SRCDIR && git rev-parse HEAD) )
- else
- - echo "ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Failed build of $(git rev-parse HEAD) on tinderbox: $TINDER_NAME\" --verified -1 $(git rev-parse HEAD)"
- - ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Failed build of $(git rev-parse HEAD) on tinderbox: $TINDER_NAME\" --verified -1 $(git rev-parse HEAD) || die "error reviewing out"
- + echo "ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Failed build of $( (cd $SRCDIR && git rev-parse HEAD) ) on tinderbox: $TINDER_NAME\" --verified -1 $( (cd $SRCDIR && git rev-parse HEAD) )"
- + ssh ${GERRIT_HOST?} gerrit review --project core --force-message -m \"Failed build of $( (cd $SRCDIR && git rev-parse HEAD) ) on tinderbox: $TINDER_NAME\" --verified -1 $( (cd $SRCDIR && git rev-parse HEAD) ) || die "error reviewing out"
- fi
- if [ -n "$GERRIT_PREV_B" ] ; then
- - git checkout "$GERRIT_PREV_B"
- - git submodule update
- + (cd $SRCDIR && git checkout "$GERRIT_PREV_B")
- + (cd $SRCDIR && git submodule update)
- fi
- if [ "$retval" = "0" ] ; then
- exit 0
- @@ -818,8 +818,8 @@ run_gerrit_loop()
- report_gerrit
- fi
- if [ -n "$GERRIT_PREV_B" ] ; then
- - git checkout "$GERRIT_PREV_B"
- - git submodule update
- + (cd $SRCDIR && git checkout "$GERRIT_PREV_B")
- + (cd $SRCDIR && git submodule update)
- fi
- if [ "$retval" = "0" ] ; then
- exit 0
- @@ -994,8 +994,8 @@ run_tb_gerrit_loop()
- done
- fi
- if [ -n "$GERRIT_PREV_B" ] ; then
- - git checkout -q "$GERRIT_PREV_B"
- - git submodule -q update
- + (cd $SRCDIR && git checkout -q "$GERRIT_PREV_B")
- + (cd $SRCDIR && git submodule -q update)
- fi
- if [ "${retval?}" = "0" ] ; then
- exit 0
- diff --git a/bin/tinbuild_phases.sh b/bin/tinbuild_phases.sh
- index 38a652c..87e1958 100644
- --- a/bin/tinbuild_phases.sh
- +++ b/bin/tinbuild_phases.sh
- @@ -18,7 +18,7 @@ pre_autogen()
- do_autogen()
- {
- if [ "${retval}" = "0" ] ; then
- - if ! $NICE ./autogen.sh ${DISTRO_CONFIG:+ --with-distro=${DISTRO_CONFIG}} >tb_${B}_autogen.log 2>&1 ; then
- + if ! $NICE $SRCDIR/autogen.sh ${DISTRO_CONFIG:+ --with-distro=${DISTRO_CONFIG}} >tb_${B}_autogen.log 2>&1 ; then
- report_log=tb_${B}_autogen.log
- report_msgs="autogen/configure failed - error is:"
- retval=1
- --
- 1.7.12.4 (Apple Git-37)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement