[Libreoffice-commits] buildbot.git: 11 commits - tb3/build-scripts tb3/Makefile tb3/replay-branch tb3/tb3-local-client tb3/tests

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Sat Jul 20 10:13:14 PDT 2013


 tb3/Makefile                         |    7 --
 tb3/build-scripts/dev-bibisect-build |   72 +++++++++++++++++++++++++++
 tb3/replay-branch                    |   14 ++---
 tb3/tb3-local-client                 |   93 +++++++++++++++++++++++++++++++++++
 tb3/tests/build-script.sh            |   11 ++++
 tb3/tests/tb3-local-client.py        |   67 +++++++++++++++++++++++++
 6 files changed, 252 insertions(+), 12 deletions(-)

New commits:
commit 9d3441d50c1b9b10a2508c60ada127b6e53ea0cf
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jul 20 19:00:43 2013 +0200

    disable dependency-tracking -- this does full builds anyway

diff --git a/tb3/build-scripts/dev-bibisect-build b/tb3/build-scripts/dev-bibisect-build
index 3f01c8e..8e7326f 100755
--- a/tb3/build-scripts/dev-bibisect-build
+++ b/tb3/build-scripts/dev-bibisect-build
@@ -44,7 +44,7 @@ echo
 
 echo "==== Configuring build ===="
 echo "configuring commit $COMMIT from repo $REPO in workdir $BUILDER_HOME on platform $PLATFORM as builder $BUILDER with script $0." > $BUILDER_HOME/artifactdir/autogen.log
-(cd $BUILDER_HOME/builddir && ./autogen.sh --with-external-tar=$BUILDER_HOME/tarballs --disable-linkoo --disable-option-checking) 2>&1 | tee --append $BUILDER_HOME/artifactdir/autogen.log
+(cd $BUILDER_HOME/builddir && ./autogen.sh --with-external-tar=$BUILDER_HOME/tarballs --disable-linkoo --disable-option-checking --disable-dependency-tracking) 2>&1 | tee --append $BUILDER_HOME/artifactdir/autogen.log
 echo
 echo
 
commit a1983dfefe3b0de5c649601481b5e8b0e153edbb
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jul 20 18:48:35 2013 +0200

    clear binrepo before repopulating

diff --git a/tb3/build-scripts/dev-bibisect-build b/tb3/build-scripts/dev-bibisect-build
index 69ef534..3f01c8e 100755
--- a/tb3/build-scripts/dev-bibisect-build
+++ b/tb3/build-scripts/dev-bibisect-build
@@ -27,6 +27,7 @@ export BINREPO_BRANCH=builder-$BUILDER
 export BINREPO_TAG=source-hash-$COMMIT
 (cd $BINREPO && git branch $BINREPO_BRANCH initial) || true
 git clone $BINREPO $BUILDER_HOME/artifactdir --branch $BINREPO_BRANCH
+(cd $BUILDER_HOME/artifactdir && git rm -r `git ls-tree --name-only HEAD`)
 git --git-dir=$REPO log -1 --pretty=format:"source-hash-%H%n%n" $COMMIT > $BUILDER_HOME/commitmsg
 git --git-dir=$REPO log -1 --pretty=fuller $COMMIT >> $BUILDER_HOME/commitmsg
 ccache -M$CCACHE_SIZE
commit 11b07643516d1ed8566531b89aa018a08a62f6e3
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jul 20 18:44:45 2013 +0200

    failing to tag shouldnt abort the build

diff --git a/tb3/build-scripts/dev-bibisect-build b/tb3/build-scripts/dev-bibisect-build
index ecb2330..69ef534 100755
--- a/tb3/build-scripts/dev-bibisect-build
+++ b/tb3/build-scripts/dev-bibisect-build
@@ -62,7 +62,7 @@ echo "==== Storing bibisect ===="
 echo archiving installation at $DEVINSTALLDIR ...
 git --git-dir=$BUILDER_HOME/artifactdir/.git --work-tree=$DEVINSTALLDIR add -A
 git --git-dir=$BUILDER_HOME/artifactdir/.git --work-tree=$DEVINSTALLDIR commit -F $BUILDER_HOME/commitmsg
-git --git-dir=$BUILDER_HOME/artifactdir/.git tag $BINREPO_TAG
+git --git-dir=$BUILDER_HOME/artifactdir/.git tag $BINREPO_TAG || true
 git --git-dir=$BUILDER_HOME/artifactdir/.git push origin $BINREPO_TAG:$BINREPO_TAG $BINREPO_BRANCH:$BINREPO_BRANCH
 echo done.
 echo
commit feb42e8d99017f7d15e64467407402b00021a679
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jul 20 16:34:34 2013 +0200

    tweak parms order

diff --git a/tb3/build-scripts/dev-bibisect-build b/tb3/build-scripts/dev-bibisect-build
index 21ce9b4..ecb2330 100755
--- a/tb3/build-scripts/dev-bibisect-build
+++ b/tb3/build-scripts/dev-bibisect-build
@@ -12,41 +12,45 @@ CCACHE_SIZE=10G
 
 
 echo "==== Setting up environment ===="
-echo "building commit $1 from repo $3 in workdir $2 on platform $4 as builder $5 with script $0."
 set -e
-export BUILDER_HOME=`readlink -f $2`
+COMMIT=$1
+REPO=$2
+PLATFORM=$3
+BUILDER=$4
+export BUILDER_HOME=`readlink -f $5`
+echo "building commit $COMMIT from repo $REPO in workdir $BUILDER_HOME on platform $PLATFORM as builder $BUILDER with script $0."
 cd $BUILDER_HOME
 rm -rf builddir artifactdir
 mkdir -p builddir tarballs ccache
 export CCACHE_DIR=$BUILDER_HOME/ccache
-export BINREPO_BRANCH=builder-$5
-export BINREPO_TAG=source-hash-$1
+export BINREPO_BRANCH=builder-$BUILDER
+export BINREPO_TAG=source-hash-$COMMIT
 (cd $BINREPO && git branch $BINREPO_BRANCH initial) || true
 git clone $BINREPO $BUILDER_HOME/artifactdir --branch $BINREPO_BRANCH
-git --git-dir=$3 log -1 --pretty=format:"source-hash-%H%n%n" $1 > $BUILDER_HOME/commitmsg
-git --git-dir=$3 log -1 --pretty=fuller $1 >> $BUILDER_HOME/commitmsg
+git --git-dir=$REPO log -1 --pretty=format:"source-hash-%H%n%n" $COMMIT > $BUILDER_HOME/commitmsg
+git --git-dir=$REPO log -1 --pretty=fuller $COMMIT >> $BUILDER_HOME/commitmsg
 ccache -M$CCACHE_SIZE
 echo
 echo
 
 echo "==== Unpacking source ===="
 echo Unpacking source ...
-(cd $3 && git archive --format tar $1)| tar --extract --directory $BUILDER_HOME/builddir
+(cd $REPO && git archive --format tar $COMMIT)| tar --extract --directory $BUILDER_HOME/builddir
 echo done.
 mkdir -p $BUILDER_HOME/builddir/.git
 echo
 echo
 
 echo "==== Configuring build ===="
-echo "configuring commit $1 from repo $3 in workdir $2 on platform $4 as builder $5 with script $0." > $BUILDER_HOME/artifactdir/autogen.log
+echo "configuring commit $COMMIT from repo $REPO in workdir $BUILDER_HOME on platform $PLATFORM as builder $BUILDER with script $0." > $BUILDER_HOME/artifactdir/autogen.log
 (cd $BUILDER_HOME/builddir && ./autogen.sh --with-external-tar=$BUILDER_HOME/tarballs --disable-linkoo --disable-option-checking) 2>&1 | tee --append $BUILDER_HOME/artifactdir/autogen.log
 echo
 echo
 
 echo "==== Building ===="
 ccache -s
-echo "building commit $1 from repo $3 in workdir $2 on platform $4 as builder $5 with script $0." > $BUILDER_HOME/artifactdir/make.log
-echo "dev-installing commit $1 from repo $3 in workdir $2 on platform $4 as builder $5 with script $0." > $BUILDER_HOME/artifactdir/dev-install.log
+echo "building commit $COMMIT from repo $REPO in workdir $BUILDER_HOME on platform $PLATFORM as builder $BUILDER with script $0." > $BUILDER_HOME/artifactdir/make.log
+echo "dev-installing commit $COMMIT from repo $REPO in workdir $BUILDER_HOME on platform $PLATFORM as builder $BUILDER with script $0." > $BUILDER_HOME/artifactdir/dev-install.log
 (cd $BUILDER_HOME/builddir; make || make) 2>&1 | tee --append $BUILDER_HOME/artifactdir/make.log
 (cd $BUILDER_HOME/builddir; make dev-install) 2>&1 | tee --append $BUILDER_HOME/artifactdir/dev-install.log
 ccache -s
diff --git a/tb3/tb3-local-client b/tb3/tb3-local-client
index 32548cb..9babafe 100755
--- a/tb3/tb3-local-client
+++ b/tb3/tb3-local-client
@@ -48,10 +48,10 @@ class LocalClient:
         command = sh.Command(self.args['script'])
         rc = command(
             proposal['commit'],
-            self.workdir,
             self.args['repo'],
             self.args['platform'],
             self.args['builder'],
+            self.workdir,
             _err=outfile,
             _out=outfile,
             _ok_code=range(256)).exit_code
diff --git a/tb3/tests/build-script.sh b/tb3/tests/build-script.sh
index 9ac89e4..32827c8 100755
--- a/tb3/tests/build-script.sh
+++ b/tb3/tests/build-script.sh
@@ -6,6 +6,6 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
-echo "building commit $1 from repo $3 in workdir $2 on platform $4 as builder $5."
+echo "building commit $1 from repo $2 on platform $3 as builder $4 in workdir $5."
 true
 # vim: set et sw=4 ts=4:
commit 03eb316b21ef4e61bd2521b5f2bd7604685b272b
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Jul 20 16:22:11 2013 +0200

    add example buildscript

diff --git a/tb3/build-scripts/dev-bibisect-build b/tb3/build-scripts/dev-bibisect-build
new file mode 100755
index 0000000..21ce9b4
--- /dev/null
+++ b/tb3/build-scripts/dev-bibisect-build
@@ -0,0 +1,67 @@
+#!/bin/bash
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+BINREPO=$HOME/binrepo
+CCACHE_SIZE=10G
+
+
+echo "==== Setting up environment ===="
+echo "building commit $1 from repo $3 in workdir $2 on platform $4 as builder $5 with script $0."
+set -e
+export BUILDER_HOME=`readlink -f $2`
+cd $BUILDER_HOME
+rm -rf builddir artifactdir
+mkdir -p builddir tarballs ccache
+export CCACHE_DIR=$BUILDER_HOME/ccache
+export BINREPO_BRANCH=builder-$5
+export BINREPO_TAG=source-hash-$1
+(cd $BINREPO && git branch $BINREPO_BRANCH initial) || true
+git clone $BINREPO $BUILDER_HOME/artifactdir --branch $BINREPO_BRANCH
+git --git-dir=$3 log -1 --pretty=format:"source-hash-%H%n%n" $1 > $BUILDER_HOME/commitmsg
+git --git-dir=$3 log -1 --pretty=fuller $1 >> $BUILDER_HOME/commitmsg
+ccache -M$CCACHE_SIZE
+echo
+echo
+
+echo "==== Unpacking source ===="
+echo Unpacking source ...
+(cd $3 && git archive --format tar $1)| tar --extract --directory $BUILDER_HOME/builddir
+echo done.
+mkdir -p $BUILDER_HOME/builddir/.git
+echo
+echo
+
+echo "==== Configuring build ===="
+echo "configuring commit $1 from repo $3 in workdir $2 on platform $4 as builder $5 with script $0." > $BUILDER_HOME/artifactdir/autogen.log
+(cd $BUILDER_HOME/builddir && ./autogen.sh --with-external-tar=$BUILDER_HOME/tarballs --disable-linkoo --disable-option-checking) 2>&1 | tee --append $BUILDER_HOME/artifactdir/autogen.log
+echo
+echo
+
+echo "==== Building ===="
+ccache -s
+echo "building commit $1 from repo $3 in workdir $2 on platform $4 as builder $5 with script $0." > $BUILDER_HOME/artifactdir/make.log
+echo "dev-installing commit $1 from repo $3 in workdir $2 on platform $4 as builder $5 with script $0." > $BUILDER_HOME/artifactdir/dev-install.log
+(cd $BUILDER_HOME/builddir; make || make) 2>&1 | tee --append $BUILDER_HOME/artifactdir/make.log
+(cd $BUILDER_HOME/builddir; make dev-install) 2>&1 | tee --append $BUILDER_HOME/artifactdir/dev-install.log
+ccache -s
+echo
+echo
+
+echo "==== Storing bibisect ===="
+`grep DEVINSTALLDIR $BUILDER_HOME/builddir/config_host.mk`
+echo archiving installation at $DEVINSTALLDIR ...
+git --git-dir=$BUILDER_HOME/artifactdir/.git --work-tree=$DEVINSTALLDIR add -A
+git --git-dir=$BUILDER_HOME/artifactdir/.git --work-tree=$DEVINSTALLDIR commit -F $BUILDER_HOME/commitmsg
+git --git-dir=$BUILDER_HOME/artifactdir/.git tag $BINREPO_TAG
+git --git-dir=$BUILDER_HOME/artifactdir/.git push origin $BINREPO_TAG:$BINREPO_TAG $BINREPO_BRANCH:$BINREPO_BRANCH
+echo done.
+echo
+echo
+
+# vim: set et sw=4 ts=4:
commit 49ef0430ac7bc50800d84030fdb326cfa5984b1d
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jul 19 20:39:06 2013 +0200

    missing test build script

diff --git a/tb3/tests/build-script.sh b/tb3/tests/build-script.sh
new file mode 100755
index 0000000..9ac89e4
--- /dev/null
+++ b/tb3/tests/build-script.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+echo "building commit $1 from repo $3 in workdir $2 on platform $4 as builder $5."
+true
+# vim: set et sw=4 ts=4:
commit 8d713bfee958aa1645edc248e03b2b6434e8ab40
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jul 19 19:59:00 2013 +0200

    check for build script parms

diff --git a/tb3/tb3-local-client b/tb3/tb3-local-client
index c949dcc..32548cb 100755
--- a/tb3/tb3-local-client
+++ b/tb3/tb3-local-client
@@ -50,6 +50,8 @@ class LocalClient:
             proposal['commit'],
             self.workdir,
             self.args['repo'],
+            self.args['platform'],
+            self.args['builder'],
             _err=outfile,
             _out=outfile,
             _ok_code=range(256)).exit_code
diff --git a/tb3/tests/tb3-local-client.py b/tb3/tests/tb3-local-client.py
index 1ac1dac..2ad3a59 100755
--- a/tb3/tests/tb3-local-client.py
+++ b/tb3/tests/tb3-local-client.py
@@ -7,9 +7,10 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
+import os
+import re
 import sh
 import sys
-import os
 import unittest
 import tempfile
 
@@ -56,7 +57,10 @@ class TestTb3LocalClient(unittest.TestCase):
         logfile = open(os.path.join(self.logdir, logfiles[0]), 'r')
         lines = [line for line in logfile]
         self.assertEqual(len(lines), 1)
-        self.assertEqual(lines[0], 'building\n')
+        self.assertNotEqual(re.search('building commit %s' % self.head, lines[0]), None)
+        self.assertNotEqual(re.search('from repo %s' % self.testdir, lines[0]), None)
+        self.assertNotEqual(re.search('on platform %s' % self.platform, lines[0]), None)
+        self.assertNotEqual(re.search('as builder %s' % self.builder, lines[0]), None)
 
 if __name__ == '__main__':
     unittest.main()
commit 49cc995b657cb5c0ec8a6348aac57e9a7f4d54f9
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jul 19 17:57:45 2013 +0200

    test artifacts

diff --git a/tb3/tests/tb3-local-client.py b/tb3/tests/tb3-local-client.py
index f7687cc..1ac1dac 100755
--- a/tb3/tests/tb3-local-client.py
+++ b/tb3/tests/tb3-local-client.py
@@ -52,6 +52,7 @@ class TestTb3LocalClient(unittest.TestCase):
         self.assertEqual(len(logdirs[0][1]), 0)
         logfiles = logdirs[0][2]
         self.assertEqual(len(logfiles), 1) # only one file in dir
+        self.assertEqual(state.artifactreference, logfiles[0])
         logfile = open(os.path.join(self.logdir, logfiles[0]), 'r')
         lines = [line for line in logfile]
         self.assertEqual(len(lines), 1)
commit f55a918e3b0bd4f39bcc0917d1e1d3c181468631
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jul 19 17:25:00 2013 +0200

    add logdir support

diff --git a/tb3/Makefile b/tb3/Makefile
index b03b70a..6f3b3a8 100644
--- a/tb3/Makefile
+++ b/tb3/Makefile
@@ -1,17 +1,14 @@
 define runtest
-./tests/tb3/$(1).py
+./tests/$(subst SLASH,/,$(1)).py
 endef
 
-test: test-repostate test-scheduler test-cli
+test: test-tb3SLASHrepostate test-tb3SLASHscheduler test-tb3-cli test-tb3-local-client
 	@true
 .PHONY: test
 
 test-%:
 	$(call runtest,$*)
 
-test-cli:
-	./tests/tb3-cli.py
-
 .PHONY: test-%
 
 # vim: set noet sw=4 ts=4:
diff --git a/tb3/tb3-local-client b/tb3/tb3-local-client
index a2698db..c949dcc 100755
--- a/tb3/tb3-local-client
+++ b/tb3/tb3-local-client
@@ -26,7 +26,7 @@ class LocalClient:
             branch=self.args['branch'],
             builder=self.args['builder'],
             format='json')
-        self.logdir = tempfile.mkdtemp()
+        self.logdir = self.args['logdir']
         self.workdir = tempfile.mkdtemp()
     def get_proposal(self):
         data = ''
@@ -41,19 +41,23 @@ class LocalClient:
         self.tb3(set_commit_running=proposal['commit'])
     def run_build(self, proposal):
         buildtime = int(time.time()*100)
+        if self.logdir:
+            outfile=os.path.join(self.logdir,'%s-%d.out' % (proposal['commit'], buildtime))
+        else:
+            outfile = '/dev/null'
         command = sh.Command(self.args['script'])
         rc = command(
             proposal['commit'],
             self.workdir,
             self.args['repo'],
-            _err=os.path.join(self.logdir,'%d.err' % buildtime),
-            _out=os.path.join(self.logdir, '%d.out' % buildtime),
+            _err=outfile,
+            _out=outfile,
             _ok_code=range(256)).exit_code
         if not rc:
-            return 'good'
-        return 'bad'
-    def report_result(self, proposal, res):
-        self.tb3(set_commit_finished=proposal['commit'], result=res)
+            return ('good', os.path.basename(outfile))
+        return ('bad', os.path.basename(outfile))
+    def report_result(self, proposal, result):
+        self.tb3(set_commit_finished=proposal['commit'], result=result[0], result_reference=result[1])
     def __one_run(self):
         time.sleep(self.args['interval'])
         proposal = self.get_proposal()
@@ -77,6 +81,7 @@ if __name__ == '__main__':
     parser.add_argument('--branch', help='branch for which coordination is requested', required=True)
     parser.add_argument('--builder', help='name of the build machine interacting with the coordinator', required=True)
     parser.add_argument('--script', help='path to the build script', required=True)
+    parser.add_argument('--logdir', help='path to the to store the logs', default=None)
     parser.add_argument('--estimated-duration', help='the estimated time to complete in minutes (default: 120)', type=float, default=120.0)
     parser.add_argument('--interval', help='the time to sleep between builds/polls in seconds (default: 1)', type=float, default=1.0)
     parser.add_argument('--count', help='the number of builds to try, 0 for unlimited builds  (default: unlimited)', type=int, default=0)
diff --git a/tb3/tests/tb3-local-client.py b/tb3/tests/tb3-local-client.py
index 4ab4abb..f7687cc 100755
--- a/tb3/tests/tb3-local-client.py
+++ b/tb3/tests/tb3-local-client.py
@@ -11,6 +11,7 @@ import sh
 import sys
 import os
 import unittest
+import tempfile
 
 sys.path.append('./tests')
 import helpers
@@ -24,6 +25,7 @@ class TestTb3LocalClient(unittest.TestCase):
         (self.branch, self.platform, self.builder) = ('master', 'linux', 'testbuilder')
         os.environ['PATH'] += ':.'
         (self.testdir, self.git) = helpers.createTestRepo()
+        self.logdir = tempfile.mkdtemp()
         self.tb3localclient = sh.Command.bake(sh.Command("tb3-local-client"),
             repo=self.testdir,
             branch=self.branch,
@@ -31,18 +33,29 @@ class TestTb3LocalClient(unittest.TestCase):
             builder=self.builder,
             tb3_master='./tb3',
             script='./tests/build-script.sh',
+            logdir=self.logdir,
             count=1)
         self.state = tb3.repostate.RepoState(self.platform, self.branch, self.testdir)
         self.history = tb3.repostate.RepoHistory(self.platform, self.testdir)
         self.head = self.state.get_head()
     def tearDown(self):
         sh.rm('-r', self.testdir)
-    def test_sync(self):
+    def test_runonce(self):
         self.tb3localclient()
         self.assertEqual(self.state.get_last_good(), self.head)
         state = self.history.get_commit_state(self.head)
         self.assertEqual(state.state, 'GOOD')
         self.assertEqual(state.builder, self.builder)
+        logdirs = [entry for entry in os.walk(self.logdir)]
+        self.assertEqual(len(logdirs), 1) # no subdirs
+        self.assertEqual(logdirs[0][0], self.logdir)
+        self.assertEqual(len(logdirs[0][1]), 0)
+        logfiles = logdirs[0][2]
+        self.assertEqual(len(logfiles), 1) # only one file in dir
+        logfile = open(os.path.join(self.logdir, logfiles[0]), 'r')
+        lines = [line for line in logfile]
+        self.assertEqual(len(lines), 1)
+        self.assertEqual(lines[0], 'building\n')
 
 if __name__ == '__main__':
     unittest.main()
commit 5ecc8d074230e7d43378d14b4d9cbef0274c0d7b
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Fri Jul 19 16:38:03 2013 +0200

    tb3 local client

diff --git a/tb3/tb3-local-client b/tb3/tb3-local-client
new file mode 100755
index 0000000..a2698db
--- /dev/null
+++ b/tb3/tb3-local-client
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+import argparse
+import json
+import os.path
+import sh
+import sys
+import tempfile
+import time
+
+sys.path.append('./dist-packages')
+
+class LocalClient:
+    def __init__(self, args):
+        self.args = args
+        self.tb3 = sh.Command.bake(
+            sh.Command(self.args['tb3_master']),
+            repo=self.args['repo'],
+            platform=self.args['platform'],
+            branch=self.args['branch'],
+            builder=self.args['builder'],
+            format='json')
+        self.logdir = tempfile.mkdtemp()
+        self.workdir = tempfile.mkdtemp()
+    def get_proposal(self):
+        data = ''
+        for line in self.tb3(show_proposals=True):
+            data+=line
+        proposals = json.loads(data)
+        if len(proposals)>0:
+            return proposals[0]
+        else:
+            return None
+    def report_start(self, proposal):
+        self.tb3(set_commit_running=proposal['commit'])
+    def run_build(self, proposal):
+        buildtime = int(time.time()*100)
+        command = sh.Command(self.args['script'])
+        rc = command(
+            proposal['commit'],
+            self.workdir,
+            self.args['repo'],
+            _err=os.path.join(self.logdir,'%d.err' % buildtime),
+            _out=os.path.join(self.logdir, '%d.out' % buildtime),
+            _ok_code=range(256)).exit_code
+        if not rc:
+            return 'good'
+        return 'bad'
+    def report_result(self, proposal, res):
+        self.tb3(set_commit_finished=proposal['commit'], result=res)
+    def __one_run(self):
+        time.sleep(self.args['interval'])
+        proposal = self.get_proposal()
+        if proposal:
+            self.report_start(proposal)
+            result = self.run_build(proposal)
+            self.report_result(proposal, result)
+    def execute(self):
+        if self.args['count']:
+            for x in range(self.args['count']):
+                self.__one_run()
+        else:
+            while True:
+                self.__one_run()
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser(description='local tinderbox runner')
+    parser.add_argument('--tb3-master', help='the path to the tb3 executable', required=True)
+    parser.add_argument('--repo', help='location of the LibreOffice core git repository', required=True)
+    parser.add_argument('--platform', help='platform for which coordination is requested', required=True)
+    parser.add_argument('--branch', help='branch for which coordination is requested', required=True)
+    parser.add_argument('--builder', help='name of the build machine interacting with the coordinator', required=True)
+    parser.add_argument('--script', help='path to the build script', required=True)
+    parser.add_argument('--estimated-duration', help='the estimated time to complete in minutes (default: 120)', type=float, default=120.0)
+    parser.add_argument('--interval', help='the time to sleep between builds/polls in seconds (default: 1)', type=float, default=1.0)
+    parser.add_argument('--count', help='the number of builds to try, 0 for unlimited builds  (default: unlimited)', type=int, default=0)
+    args = vars(parser.parse_args())
+    LocalClient(args).execute()
+    
+# vim: set et sw=4 ts=4:
diff --git a/tb3/tests/tb3-local-client.py b/tb3/tests/tb3-local-client.py
new file mode 100755
index 0000000..4ab4abb
--- /dev/null
+++ b/tb3/tests/tb3-local-client.py
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+import sh
+import sys
+import os
+import unittest
+
+sys.path.append('./tests')
+import helpers
+
+#only for setup
+sys.path.append('./dist-packages')
+import tb3.repostate
+
+class TestTb3LocalClient(unittest.TestCase):
+    def setUp(self):
+        (self.branch, self.platform, self.builder) = ('master', 'linux', 'testbuilder')
+        os.environ['PATH'] += ':.'
+        (self.testdir, self.git) = helpers.createTestRepo()
+        self.tb3localclient = sh.Command.bake(sh.Command("tb3-local-client"),
+            repo=self.testdir,
+            branch=self.branch,
+            platform=self.platform,
+            builder=self.builder,
+            tb3_master='./tb3',
+            script='./tests/build-script.sh',
+            count=1)
+        self.state = tb3.repostate.RepoState(self.platform, self.branch, self.testdir)
+        self.history = tb3.repostate.RepoHistory(self.platform, self.testdir)
+        self.head = self.state.get_head()
+    def tearDown(self):
+        sh.rm('-r', self.testdir)
+    def test_sync(self):
+        self.tb3localclient()
+        self.assertEqual(self.state.get_last_good(), self.head)
+        state = self.history.get_commit_state(self.head)
+        self.assertEqual(state.state, 'GOOD')
+        self.assertEqual(state.builder, self.builder)
+
+if __name__ == '__main__':
+    unittest.main()
+# vim: set et sw=4 ts=4:
commit d13d5d3a74446218ea381e1b5498f3e981f8bab3
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Jul 15 13:52:52 2013 +0200

    remove teutonic spelling

diff --git a/tb3/replay-branch b/tb3/replay-branch
index c8782f7..f891e11 100755
--- a/tb3/replay-branch
+++ b/tb3/replay-branch
@@ -15,10 +15,10 @@ class Syncer:
     def __init__(self, args):
         (   self.commit_count, self.from_branch,
             self.to_branch, self.count,
-            self.intervall, self.repo) = \
+            self.interval, self.repo) = \
         (   args['commit_count'], args['from_branch'],
             args['to_branch'], args['count'],
-            args['intervall'], args['repo'])
+            args['interval'], args['repo'])
         self.git = sh.git.bake(_cwd=self.repo)
         assert(len(self.git('rev-parse', show_cdup=True).strip()) == 0)
         assert(len(self.git.branch(self.to_branch, no_color=True, list=True)))
@@ -34,18 +34,18 @@ class Syncer:
             except IndexError:
                 commit = commits[0]
                 more_commits = False
-            #self.git.checkout(self.to_branch)
-            #self.git.pull(commit)
+            self.git.checkout(self.to_branch)
+            self.git.pull(commit)
         return more_commits
     def execute(self):
         if self.count > 0:
             for step in range(self.count):
                 if not self.sync(args):
                     break
-                time.sleep(self.intervall)
+                time.sleep(self.interval)
         else:
             while self.sync(args):
-                time.sleep(self.intervall)
+                time.sleep(self.interval)
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(description='branch replayer')
@@ -53,7 +53,7 @@ if __name__ == '__main__':
     parser.add_argument('--from-branch', help='the branch to replay from', required=True)
     parser.add_argument('--to-branch', help='the branch to replay to', default='master')
     parser.add_argument('--commit-count', help='the number of commits to pull in one sync (default: 1)', type=int, default=1)
-    parser.add_argument('--intervall', help='the time to wait between sync in seconds (default: 1)', type=float, default=1)
+    parser.add_argument('--interval', help='the time to wait between sync in seconds (default: 1)', type=float, default=1)
     parser.add_argument('--count', help='the number of syncs (0 is unlimited and default)', type=int, default=0)
     args = vars(parser.parse_args())
     Syncer(args).execute()


More information about the Libreoffice-commits mailing list