webrtc/tools/add_webrtc_slave_utils.py
kjellander@webrtc.org de2a76fcf9 Try server and buildbot scripts now using Chromium scripts.
- compatible with depot_tools try commands.
- old build master is converted to use Chromium scripts, according to
http://www.chromium.org/developers/testing/chromium-build-infrastructure/getting-the-buildbot-source/forking-your-buildbot
- slaves can now be run out of a plain checkout, no local configuration needed.

Also added files to make it possible to use tools as a separate checkout.

BUG=None
TEST=Runs on local machine with remote slaves. I've successfully submitted try jobs with both git try and gcl try commands.

Review URL: https://webrtc-codereview.appspot.com/449011

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1945 4adac7df-926f-26a2-2b94-8c16560cd09d
2012-03-27 15:57:30 +00:00

50 lines
1.7 KiB
Python
Executable File

#!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
__author__ = 'kjellander@webrtc.org (Henrik Kjellander)'
import os
def main():
"""
Simple script for adding an import of the WebRTC slave_utils module for the
buildbot slaves to the Chromium buildbot.tac file.
Using this script, we don't need to maintain our own version of the slave
scripts and can automatically stay up to date with their changes.
It will add a comment and the import at the end of the file, if it's not
already present.
This script should be invoked as a hooks step in the DEPS file, like this:
hooks = [
{
# Update slave buildbot.tac to include WebRTC slave_utils import.
"pattern": ".",
"action": ["python", "tools/add_webrtc_slave_utils.py"],
},
]
"""
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
TARGET_FILE = os.path.join(SCRIPT_PATH,
'continuous_build/build/slave/buildbot.tac')
COMMENT_LINE = '# Load WebRTC custom slave script.\n'
IMPORT_LINE = 'from webrtc_buildbot import slave_utils\n'
file = open(TARGET_FILE, 'r')
if file.read().find(IMPORT_LINE) == -1:
print 'Patching %s with WebRTC imports.' % TARGET_FILE
file.close()
file = open(TARGET_FILE, 'a')
file.write(COMMENT_LINE)
file.write(IMPORT_LINE)
file.close()
if __name__ == '__main__':
main()