From 31f06d13a8c5f1bf8c3dc675088756e98172c61b Mon Sep 17 00:00:00 2001 From: Sye van der Veen Date: Thu, 23 Jan 2014 13:45:21 -0500 Subject: Updated msvs/msvc settings for Express (for Desktop) versions of Visual Studio from 2008-2013 --- src/engine/SCons/Tool/MSCommon/vc.py | 7 +++- src/engine/SCons/Tool/MSCommon/vs.py | 73 +++++++++++++----------------------- src/engine/SCons/Tool/msvc.xml | 24 ++++++++++-- 3 files changed, 53 insertions(+), 51 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index c970118..09223e8 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -131,9 +131,14 @@ def get_host_target(env): return (host, target,req_target_platform) -_VCVER = ["11.0", "11.0Exp", "10.0", "10.0Exp", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"] +# If you update this, update SupportedVSList in Tool/MSCommon/vs.py, and the +# MSVC_VERSION documentation in Tool/msvc.xml. +# TODO Visual C 12.0 +_VCVER = ["12.0Exp", "11.0", "11.0Exp", "10.0", "10.0Exp", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"] _VCVER_TO_PRODUCT_DIR = { + '12.0Exp' : [ + r'Microsoft\VCExpress\12.0\Setup\VC\ProductDir'], '11.0': [ r'Microsoft\VisualStudio\11.0\Setup\VC\ProductDir'], '11.0Exp' : [ diff --git a/src/engine/SCons/Tool/MSCommon/vs.py b/src/engine/SCons/Tool/MSCommon/vs.py index d5bf2c3..b413913 100644 --- a/src/engine/SCons/Tool/MSCommon/vs.py +++ b/src/engine/SCons/Tool/MSCommon/vs.py @@ -199,102 +199,87 @@ class VisualStudio(object): # good money for in preference to whatever Microsoft makes available # for free. # -# If you update this list, update the documentation in Tool/msvs.xml. +# If you update this list, update _VCVER and _VCVER_TO_PRODUCT_DIR in +# Tool/MSCommon/vc.py, and the MSVC_VERSION documentation in Tool/msvc.xml. SupportedVSList = [ - # Visual Studio 2010 - # TODO: find the settings, perhaps from someone with a CTP copy? - #VisualStudio('TBD', - # hkey_root=r'TBD', - # common_tools_var='TBD', - # executable_path=r'TBD', - # default_dirname='TBD', - #), - - # Visual Studio 11 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. + # TODO Visual Studio 2013 + + # Visual C++ 2013 Express Edition (for Desktop) + VisualStudio('12.0Exp', + vc_version='12.0', + sdk_version='8.1A', + hkeys=[r'Microsoft\VisualStudio\12.0\Setup\VS\ProductDir'], + common_tools_var='VS120COMNTOOLS', + executable_path=r'Common7\IDE\WDExpress.exe', + batch_file_path=r'Common7\Tools\vsvars32.bat', + supported_arch=['x86', 'amd64'], + ), + + # Visual Studio 2012 VisualStudio('11.0', - sdk_version='6.1', + sdk_version='8.0A', hkeys=[r'Microsoft\VisualStudio\11.0\Setup\VS\ProductDir'], common_tools_var='VS110COMNTOOLS', executable_path=r'Common7\IDE\devenv.com', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 11', supported_arch=['x86', 'amd64'], ), - # Visual C++ 11 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. + # Visual C++ 2012 Express Edition (for Desktop) VisualStudio('11.0Exp', vc_version='11.0', - sdk_version='6.1', - hkeys=[r'Microsoft\VCExpress\11.0\Setup\VS\ProductDir'], + sdk_version='8.0A', + hkeys=[r'Microsoft\VisualStudio\11.0\Setup\VS\ProductDir'], common_tools_var='VS110COMNTOOLS', - executable_path=r'Common7\IDE\VCExpress.exe', + executable_path=r'Common7\IDE\WDExpress.exe', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 11', - supported_arch=['x86'], + supported_arch=['x86', 'amd64'], ), # Visual Studio 2010 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. VisualStudio('10.0', - sdk_version='6.1', + sdk_version='7.0A', hkeys=[r'Microsoft\VisualStudio\10.0\Setup\VS\ProductDir'], common_tools_var='VS100COMNTOOLS', executable_path=r'Common7\IDE\devenv.com', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 10', supported_arch=['x86', 'amd64'], ), # Visual C++ 2010 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. VisualStudio('10.0Exp', vc_version='10.0', - sdk_version='6.1', + sdk_version='7.0A', hkeys=[r'Microsoft\VCExpress\10.0\Setup\VS\ProductDir'], common_tools_var='VS100COMNTOOLS', executable_path=r'Common7\IDE\VCExpress.exe', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 10', supported_arch=['x86'], ), # Visual Studio 2008 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. VisualStudio('9.0', - sdk_version='6.1', + sdk_version='6.0A', hkeys=[r'Microsoft\VisualStudio\9.0\Setup\VS\ProductDir'], common_tools_var='VS90COMNTOOLS', executable_path=r'Common7\IDE\devenv.com', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 9', supported_arch=['x86', 'amd64'], ), # Visual C++ 2008 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. VisualStudio('9.0Exp', vc_version='9.0', - sdk_version='6.1', + sdk_version='6.0A', hkeys=[r'Microsoft\VCExpress\9.0\Setup\VS\ProductDir'], common_tools_var='VS90COMNTOOLS', executable_path=r'Common7\IDE\VCExpress.exe', batch_file_path=r'Common7\Tools\vsvars32.bat', - default_dirname='Microsoft Visual Studio 9', supported_arch=['x86'], ), # Visual Studio 2005 - # The batch file we look for is in the VC directory, - # so the devenv.com executable is up in ..\..\Common7\IDE. VisualStudio('8.0', sdk_version='6.0A', hkeys=[r'Microsoft\VisualStudio\8.0\Setup\VS\ProductDir'], @@ -306,8 +291,6 @@ SupportedVSList = [ ), # Visual C++ 2005 Express Edition - # The batch file we look for is in the VC directory, - # so the VCExpress.exe executable is up in ..\..\Common7\IDE. VisualStudio('8.0Exp', vc_version='8.0Exp', sdk_version='6.0A', @@ -320,8 +303,6 @@ SupportedVSList = [ ), # Visual Studio .NET 2003 - # The batch file we look for is in the Common7\Tools directory, - # so the devenv.com executable is next door in ..\IDE. VisualStudio('7.1', sdk_version='6.0', hkeys=[r'Microsoft\VisualStudio\7.1\Setup\VS\ProductDir'], @@ -333,8 +314,6 @@ SupportedVSList = [ ), # Visual Studio .NET - # The batch file we look for is in the Common7\Tools directory, - # so the devenv.com executable is next door in ..\IDE. VisualStudio('7.0', sdk_version='2003R2', hkeys=[r'Microsoft\VisualStudio\7.0\Setup\VS\ProductDir'], diff --git a/src/engine/SCons/Tool/msvc.xml b/src/engine/SCons/Tool/msvc.xml index 8b66e34..e5a3a05 100644 --- a/src/engine/SCons/Tool/msvc.xml +++ b/src/engine/SCons/Tool/msvc.xml @@ -347,9 +347,27 @@ If &cv-MSVC_VERSION; is not set, SCons will (by default) select the latest version of Visual C/C++ installed on your system. If the specified version isn't installed, tool initialization will fail. This variable must be passed as an argument to the Environment() -constructor; setting it later has no effect. Set it to an unexpected -value (e.g. "XXX") to see the valid values on your system. +constructor; setting it later has no effect. + + +Valid values for Windows are +12.0Exp, +11.0, +11.0Exp, +10.0, +10.0Exp, +9.0, +9.0Exp, +8.0, +8.0Exp, +7.1, +7.0, +and 6.0. +Versions ending in Exp refer to "Express" or +"Express for Desktop" editions. + + @@ -421,4 +439,4 @@ For example, if you want to compile 64-bit binaries, you would set - \ No newline at end of file + -- cgit v0.12 From 864b97c8e206ac024eb3307ceaea5a5844e89971 Mon Sep 17 00:00:00 2001 From: Sye van der Veen Date: Fri, 24 Jan 2014 12:56:30 -0500 Subject: Fix TestCmd to use ctypes when PyWin32 is not installed, and respect os.environ.get('python_executable') in ActionTests --- QMTest/TestCmd.py | 31 +++++++++++++++++++++++++++++-- src/engine/SCons/ActionTests.py | 5 ++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py index 38e9cd3..b51d90f 100644 --- a/QMTest/TestCmd.py +++ b/QMTest/TestCmd.py @@ -672,8 +672,35 @@ except AttributeError: PIPE = subprocess.PIPE if subprocess.mswindows: - from win32file import ReadFile, WriteFile - from win32pipe import PeekNamedPipe + try: + from win32file import ReadFile, WriteFile + from win32pipe import PeekNamedPipe + except ImportError: + # If PyWin32 is not available, try ctypes instead + # XXX These replicate _just_enough_ PyWin32 behaviour for our purposes + import ctypes; from ctypes.wintypes import DWORD + def ReadFile(hFile, bufSize, ol=None): + assert ol is None + lpBuffer = ctypes.create_string_buffer(bufSize) + bytesRead = DWORD() + bErr = ctypes.windll.kernel32.ReadFile( + hFile, lpBuffer, bufSize, ctypes.byref(bytesRead), ol) + if not bErr: raise ctypes.WinError() + return (0, ctypes.string_at(lpBuffer, bytesRead.value)) + def WriteFile(hFile, data, ol=None): + assert ol is None + bytesWritten = DWORD() + bErr = ctypes.windll.kernel32.WriteFile( + hFile, data, len(data), ctypes.byref(bytesWritten), ol) + if not bErr: raise ctypes.WinError() + return (0, bytesWritten.value) + def PeekNamedPipe(hPipe, size): + assert size == 0 + bytesAvail = DWORD() + bErr = ctypes.windll.kernel32.PeekNamedPipe( + hPipe, None, size, None, ctypes.byref(bytesAvail), None) + if not bErr: raise ctypes.WinError() + return ("", bytesAvail.value, None) import msvcrt else: import select diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index 13c3b6c..3e900d7 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -185,9 +185,8 @@ class DummyNode(object): if os.name == 'java': python = os.path.join(sys.prefix, 'jython') else: - python = sys.executable - -_python_ = '"' + python + '"' + python = os.environ.get('python_executable', sys.executable) +_python_ = test.escape(python) _null = SCons.Action._null -- cgit v0.12 From 7d8383e96a0b591ec1865998bab2197cb2708616 Mon Sep 17 00:00:00 2001 From: Sye van der Veen Date: Wed, 29 Jan 2014 20:55:38 -0500 Subject: Fixed an error when trying to cross-compile from x86 to amd64 in MSVS: missing entry in the _HOST_TARGET_ARCH_TO_BAT_ARCH dict --- src/engine/SCons/Tool/MSCommon/vc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 09223e8..6a801ad 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -89,6 +89,7 @@ _ARCH_TO_CANONICAL = { _HOST_TARGET_ARCH_TO_BAT_ARCH = { ("x86", "x86"): "x86", ("x86", "amd64"): "x86_amd64", + ("x86", "x86_amd64"): "x86_amd64", ("amd64", "x86_amd64"): "x86_amd64", # This is present in (at least) VS2012 express ("amd64", "amd64"): "amd64", ("amd64", "x86"): "x86", -- cgit v0.12 From 77d48a533dc194436935aaf0d673bef40983b919 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 02:08:12 +0300 Subject: Add Ansible playbook to setup buildbot instance more easily --- testing/README.md | 5 +++++ testing/buildbot.yml | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 testing/README.md create mode 100644 testing/buildbot.yml diff --git a/testing/README.md b/testing/README.md new file mode 100644 index 0000000..9da8ff8 --- /dev/null +++ b/testing/README.md @@ -0,0 +1,5 @@ +Here lie various files related to SCons that +can not find the place in other directories: + + buildbot.yml - Ansible playbook to set up + buildbot for running tests diff --git a/testing/buildbot.yml b/testing/buildbot.yml new file mode 100644 index 0000000..8590215 --- /dev/null +++ b/testing/buildbot.yml @@ -0,0 +1,20 @@ +# Ansible playbook to setup buildbot instance +# http://scons.org/wiki/InstallingBuildbotSlaves +--- +# host is overridable with --extra-vars 'host=address' +- hosts: "{{ host | default('localhost') }}" + vars: + - botuser: scons2 + - hgrc: /home/{{ botuser }}/.hgrc + + tasks: + # --- install requirements --- + - name: ubuntu/debian - make sure mercurial is installed + apt: pkg=mercurial + + - name: create .hgrc if necessary + command: touch {{ hgrc }} creates={{ hgrc }} + - name: enable mercurial purge extension + ini_file: dest={{ hgrc }} backup=yes + section=extensions option=hgext.purge + value= -- cgit v0.12 From d2b747cb8a4338e9d14bcaf9d3778737e5741d1a Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 05:27:35 +0300 Subject: buildbot.yml: Set .hgrc owner as botuser --- testing/buildbot.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index 8590215..9ae341a 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -1,5 +1,10 @@ # Ansible playbook to setup buildbot instance # http://scons.org/wiki/InstallingBuildbotSlaves +# +# Send questions to: +# +# anatoly techtonik +# --- # host is overridable with --extra-vars 'host=address' - hosts: "{{ host | default('localhost') }}" @@ -13,7 +18,7 @@ apt: pkg=mercurial - name: create .hgrc if necessary - command: touch {{ hgrc }} creates={{ hgrc }} + file: path={{ hgrc }} owner={{ botuser }} state=touch - name: enable mercurial purge extension ini_file: dest={{ hgrc }} backup=yes section=extensions option=hgext.purge -- cgit v0.12 From c9b8c43646d06d8a0fb3b20d0416cdde615e7109 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 06:21:03 +0300 Subject: buildbot.yml: Touch .hgrc only if necessary --- testing/buildbot.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index 9ae341a..b912bc8 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -18,7 +18,10 @@ apt: pkg=mercurial - name: create .hgrc if necessary - file: path={{ hgrc }} owner={{ botuser }} state=touch + stat: path={{ hgrc }} + register: st + - file: path={{ hgrc }} owner={{ botuser }} state=touch + when: not st.stat.exists - name: enable mercurial purge extension ini_file: dest={{ hgrc }} backup=yes section=extensions option=hgext.purge -- cgit v0.12 From da4468b8f5dbb4e3a3f09c1d757636f6576356ea Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 06:35:44 +0300 Subject: buildbot.yml: python-virtualenv is needed --- testing/buildbot.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index b912bc8..d64182a 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -15,7 +15,10 @@ tasks: # --- install requirements --- - name: ubuntu/debian - make sure mercurial is installed - apt: pkg=mercurial + apt: pkg={{ item }} + with_items: + - mercurial + - python-virtualenv - name: create .hgrc if necessary stat: path={{ hgrc }} -- cgit v0.12 From 7d77766255048a05a2f67a0eaa2dfc354ac9e64b Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 07:11:30 +0300 Subject: buildbot.yml: Change bot user to 'scons' and explain how to override --- testing/buildbot.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index d64182a..0bf2856 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -9,7 +9,8 @@ # host is overridable with --extra-vars 'host=address' - hosts: "{{ host | default('localhost') }}" vars: - - botuser: scons2 + # botuser can be overridden with -e 'botuser=scons2' + - botuser: scons - hgrc: /home/{{ botuser }}/.hgrc tasks: -- cgit v0.12 From 12753c7775b659aca390b6bc48cf2cb117b8a2c0 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 07:12:12 +0300 Subject: buildbot.yml: Create virtualenv --- testing/buildbot.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index 0bf2856..38986e8 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -12,6 +12,7 @@ # botuser can be overridden with -e 'botuser=scons2' - botuser: scons - hgrc: /home/{{ botuser }}/.hgrc + - venv: /home/{{ botuser }}/buildbot-virtualenv tasks: # --- install requirements --- @@ -21,6 +22,7 @@ - mercurial - python-virtualenv + # --- enable mercurial purge extension --- - name: create .hgrc if necessary stat: path={{ hgrc }} register: st @@ -30,3 +32,8 @@ ini_file: dest={{ hgrc }} backup=yes section=extensions option=hgext.purge value= + + # --- setup virtualenv for buildbot --- + - name: setup buildbot-virtualenv + command: /usr/bin/virtualenv {{ venv }} + creates={{ venv }}/bin -- cgit v0.12 From 01020250a853d6922066f09b48b616041824df94 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 07:15:20 +0300 Subject: buildbot: Explain how to run and add hosts file --- testing/README.md | 2 ++ testing/buildbot.hosts | 1 + testing/buildbot.yml | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 testing/buildbot.hosts diff --git a/testing/README.md b/testing/README.md index 9da8ff8..bb81ce2 100644 --- a/testing/README.md +++ b/testing/README.md @@ -3,3 +3,5 @@ can not find the place in other directories: buildbot.yml - Ansible playbook to set up buildbot for running tests + + buildbot.hosts - Ansible inventory file diff --git a/testing/buildbot.hosts b/testing/buildbot.hosts new file mode 100644 index 0000000..05614f6 --- /dev/null +++ b/testing/buildbot.hosts @@ -0,0 +1 @@ +localhost ansible_connection=local \ No newline at end of file diff --git a/testing/buildbot.yml b/testing/buildbot.yml index 38986e8..9c85e71 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -1,7 +1,9 @@ # Ansible playbook to setup buildbot instance # http://scons.org/wiki/InstallingBuildbotSlaves # -# Send questions to: +# ansible-playbook -i buildbot.hosts buildbot.yml -e 'botuser=scons' +# +# Tested with Ansible 1.5.0. Send questions to: # # anatoly techtonik # -- cgit v0.12 From 72b6c82bb4cb2efeb2dd51023c365e0f6a3037a4 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 07:19:51 +0300 Subject: buildbot: Keep virtualenv isolated from system packages --- testing/buildbot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index 9c85e71..c5bc3da 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -37,5 +37,5 @@ # --- setup virtualenv for buildbot --- - name: setup buildbot-virtualenv - command: /usr/bin/virtualenv {{ venv }} + command: /usr/bin/virtualenv --no-site-packages {{ venv }} creates={{ venv }}/bin -- cgit v0.12 From fa29d885681ed0ebdc3723525a18129fefcdc56a Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 07:30:03 +0300 Subject: buildbot: pip module is a better way to install buildbot-slave in virtualenv --- testing/buildbot.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index c5bc3da..d68cc59 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -35,7 +35,6 @@ section=extensions option=hgext.purge value= - # --- setup virtualenv for buildbot --- - - name: setup buildbot-virtualenv - command: /usr/bin/virtualenv --no-site-packages {{ venv }} - creates={{ venv }}/bin + # --- install buildbot --- + - name: install buildbot-slave in virtualenv + pip: name=buildbot-slave virtualenv={{ venv }} -- cgit v0.12 From c99a4df5e53877ef52450229f39c8454f9315b8b Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 08:14:52 +0300 Subject: buildbot: Create buildbot workdir, and do not backup bot .hgrc --- testing/buildbot.hosts | 2 +- testing/buildbot.yml | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/testing/buildbot.hosts b/testing/buildbot.hosts index 05614f6..3e0be7d 100644 --- a/testing/buildbot.hosts +++ b/testing/buildbot.hosts @@ -1 +1 @@ -localhost ansible_connection=local \ No newline at end of file +localhost ansible_connection=local builder=xxx pass=xxx \ No newline at end of file diff --git a/testing/buildbot.yml b/testing/buildbot.yml index d68cc59..ee82343 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -1,9 +1,16 @@ -# Ansible playbook to setup buildbot instance -# http://scons.org/wiki/InstallingBuildbotSlaves +# Ansible playbook to setup buildbot instance. +# Edit buildbot.hosts to set builder and pass variables. +# Then exec: +# +# ansible-playbook -i buildbot.hosts buildbot.yml # -# ansible-playbook -i buildbot.hosts buildbot.yml -e 'botuser=scons' +# botuser can be overridden from command line: # -# Tested with Ansible 1.5.0. Send questions to: +# ansible-playbook -i hosts buildbot.yml -e 'botuser=sconsy' +# +# Tested with Ansible 1.5.0, based on +# http://scons.org/wiki/InstallingBuildbotSlaves +# Send questions to: # # anatoly techtonik # @@ -15,6 +22,7 @@ - botuser: scons - hgrc: /home/{{ botuser }}/.hgrc - venv: /home/{{ botuser }}/buildbot-virtualenv + - work: /home/{{ botuser }}/buildbot-workdir tasks: # --- install requirements --- @@ -31,10 +39,14 @@ - file: path={{ hgrc }} owner={{ botuser }} state=touch when: not st.stat.exists - name: enable mercurial purge extension - ini_file: dest={{ hgrc }} backup=yes + ini_file: dest={{ hgrc }} section=extensions option=hgext.purge value= - # --- install buildbot --- - name: install buildbot-slave in virtualenv - pip: name=buildbot-slave virtualenv={{ venv }} + pip: name=buildbot-slave virtualenv={{ venv }} + + - name: create buildbot environment + command: "{{ venv }}/bin/buildslave create-slave --relocatable + {{ work }} buildbot.scons.org:9989 {{ builder }} {{ pass }} + creates={{ work }}" -- cgit v0.12 From e45d4cba687fa8fd6b4780b5dabce6c3584dc9c9 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 08:19:39 +0300 Subject: buildbot: No need to create relocatable workdir --- testing/buildbot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index ee82343..b92bdd7 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -47,6 +47,6 @@ pip: name=buildbot-slave virtualenv={{ venv }} - name: create buildbot environment - command: "{{ venv }}/bin/buildslave create-slave --relocatable + command: "{{ venv }}/bin/buildslave create-slave {{ work }} buildbot.scons.org:9989 {{ builder }} {{ pass }} creates={{ work }}" -- cgit v0.12 From 0cd1d5363c1cbc14349783393cd21940faa605c3 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 08:24:59 +0300 Subject: buildbot: Create workdir under botuser --- testing/buildbot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index b92bdd7..3364668 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -50,3 +50,5 @@ command: "{{ venv }}/bin/buildslave create-slave {{ work }} buildbot.scons.org:9989 {{ builder }} {{ pass }} creates={{ work }}" + sudo: yes + sudo_user: "{{ botuser }}" -- cgit v0.12 From a3fcf694f19ab8e53ed4e028180bb88db993adf2 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 08:51:19 +0300 Subject: buildbot: Set contact details of the buildbot owner --- testing/buildbot.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index 3364668..65f5d6f 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -24,6 +24,12 @@ - venv: /home/{{ botuser }}/buildbot-virtualenv - work: /home/{{ botuser }}/buildbot-workdir + vars_prompt: + - name: maintainer + prompt: contact details of the builbot owner + default: name + private: no + tasks: # --- install requirements --- - name: ubuntu/debian - make sure mercurial is installed @@ -52,3 +58,6 @@ creates={{ work }}" sudo: yes sudo_user: "{{ botuser }}" + + - name: set contact details of the buildbot owner + copy: dest="{{ work }}/info/admin" content="{{ maintainer }}" -- cgit v0.12 From 26c06d7fa3a726cc0f388e5ae3df86691f5c759c Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 09:42:05 +0300 Subject: buildbot: Update host details --- testing/buildbot.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index 65f5d6f..14ba76a 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -61,3 +61,10 @@ - name: set contact details of the buildbot owner copy: dest="{{ work }}/info/admin" content="{{ maintainer }}" + + - name: update host information + copy: dest="{{ work }}/info/host" + content="{{ansible_lsb.description}} + {{'\n'}}{{ansible_machine}} + {{'\n'}}{{ansible_memtotal_mb}}MB RAM + {{'\n'}}Python {{ansible_python_version}}" -- cgit v0.12 From 146973d7411197499b09d09a64c7874a4cb752eb Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 5 Mar 2014 09:53:00 +0300 Subject: buildbot: (re)start automatically after setup --- testing/buildbot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/testing/buildbot.yml b/testing/buildbot.yml index 14ba76a..81c2143 100644 --- a/testing/buildbot.yml +++ b/testing/buildbot.yml @@ -61,6 +61,8 @@ - name: set contact details of the buildbot owner copy: dest="{{ work }}/info/admin" content="{{ maintainer }}" + notify: + - restart buildbot - name: update host information copy: dest="{{ work }}/info/host" @@ -68,3 +70,11 @@ {{'\n'}}{{ansible_machine}} {{'\n'}}{{ansible_memtotal_mb}}MB RAM {{'\n'}}Python {{ansible_python_version}}" + notify: + - restart buildbot + + handlers: + - name: restart buildbot + command: "{{ venv }}/bin/buildslave restart {{ work }}" + sudo: yes + sudo_user: "{{ botuser }}" -- cgit v0.12