view sendchanges/sendchanges.py @ 0:f1dd1069f53d

initial packaging of sendchanges script
author cltbld@localhost.localdomain
date Wed, 13 Oct 2010 09:21:30 -0700
parents
children f915c612df49
line wrap: on
line source

#!/usr/bin/env python

# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
# 
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
# 
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
# 
# The Original Code is mozilla.org code.
# 
# The Initial Developer of the Original Code is
# Mozilla.org.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
# 
# Contributor(s):
#     Jeff Hammel <jhammel@mozilla.com>     (Original author)
# 
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
# 
# ***** END LICENSE BLOCK *****

"""
forces sendchanges to test mozilla-central builds for all platforms
usage
sendchange master_port_number
author: Alice Nodelman <anodelman@mozilla.com>
"""

# globals
platforms = ['win32', 'linux', 'linux64', 'macosx64']
branches = ['talos', 'opt-unittest', 'debug-unittest']
ports = ['9010', '9012']

# parse options
from optparse import OptionParser
parser = OptionParser(description=__doc__)
parser.add_option('-p', '--port', dest='port',
                  choices=ports, type='choice',
                  help='buildbot masteir port number to push sendchanges to (choices: %s)' % ports)
parser.add_option('--branch', dest='branch',
                  choices=branches, type='choice',
                  help='which branch to push (choices: %s)' % branches)
parser.add_option('-u', '--url', dest='url',
                  default=None,
                  help='base url where the builds live')
parser.add_option('--platform', dest='platforms', action='append',
                  help='which platforms to run on, all by default (choices: %s)' % platforms)

options, args = parser.parse_args()

if not options.platforms:
  options.platforms = platforms

if not options.port:
  parser.error("Error - please specify a buildbot master port number to push sendchanges to (9010 or 9012)")

if not options.branch:
  parser.error("Error - please specify your branch")

# get the changes
from getlatesttinderbox import GetLatestTinderbox
changes = {}
for platform in options.platforms:
  if args:
    changes[platform] = args
    continue
  latest = GetLatestTinderbox(platform=platform)
  _changes = [ latest.latest_build_url(options.url) ]
  if options.branch != 'talos':
    _changes.append(latest.latest_tests_url(options.url))
    _changes.append(latest.latest_symbols_url(options.url))
  if None in _changes:
     raise AssertionError("You mess something up! %s %s %s" % (platform, options.url, _changes))
  changes[platform] = _changes

# send the changes
from subprocess import check_call
USERNAME="sendchange_script"
for platform in options.platforms:
  check_call(['buildbot', 'sendchange',
              '--user', USERNAME,
              '--master', 'localhost:%d' % int(options.port),
              '--branch', 'mozilla-central-%s-%s' % (platform, options.branch)]
              + changes[platform])