# HG changeset patch # User Jeff Hammel # Date 1296674554 28800 # Node ID 7789fe9f8c303f78970cf8fd1d8fa013a3f377cd # Parent 6b0587a217d31df0db7620c08985a6dbde548cb3 WIP to download some version of Firefox, let alone a good one diff -r 6b0587a217d3 -r 7789fe9f8c30 autobot/process/factory.py --- a/autobot/process/factory.py Wed Feb 02 09:27:38 2011 -0800 +++ b/autobot/process/factory.py Wed Feb 02 11:22:34 2011 -0800 @@ -16,6 +16,25 @@ command = 'if %s; else false; fi' % '; elif '.join(args) return ['bash', '-c', command] +class FirefoxDownloaderFactory(BuildFactory): + """ + factory to aid in downloading Firefox + """ + + def __init__(self, base_url=None): + + # determine the (damn) url + script = 'get-latest-tinderbox' + if base_url: + command = [script, '-u', base_url] + else: + command = [script] + self.addStep(SetProperty(property='firefox_url', + command=command, + haltOnFailure=True + )) + + class SourceFactory(BuildFactory): """ base class for factories with VCS sources @@ -118,8 +137,6 @@ command=find(script, script + '.exe'), workdir=WithProperties('%(scripts)s'))) - - class PythonSourceFactory(VirtualenvFactory): """ setup several python packages diff -r 6b0587a217d3 -r 7789fe9f8c30 autobot/projects/__init__.py --- a/autobot/projects/__init__.py Wed Feb 02 09:27:38 2011 -0800 +++ b/autobot/projects/__init__.py Wed Feb 02 11:22:34 2011 -0800 @@ -15,8 +15,6 @@ import os import sys from buildbot.process.factory import BuildFactory -from logparser import TestLogParserFactory -from mozmill import TestMozmillFactory __all__ = ['factories', 'descriptions', 'here', 'args'] diff -r 6b0587a217d3 -r 7789fe9f8c30 autobot/projects/mozmill/__init__.py --- a/autobot/projects/mozmill/__init__.py Wed Feb 02 09:27:38 2011 -0800 +++ b/autobot/projects/mozmill/__init__.py Wed Feb 02 11:22:34 2011 -0800 @@ -1,8 +1,9 @@ +from autobot.process.factory import FirefoxDownloaderFactory from autobot.process.factory import VirtualenvFactory from buildbot.steps.shell import ShellCommand from buildbot.steps.shell import WithProperties -class TestMozmillFactory(VirtualenvFactory): +class TestMozmillFactory(VirtualenvFactory, FirefoxDownloaderFactory): """ factory to test Mozmill http://github.com/mozautomation/mozmill @@ -11,7 +12,7 @@ # VCS sources = {'git': ['http://github.com/mozautomation/mozmill.git']} - def __init__(self, platform=None, git=None, + def __init__(self, platform=None, git=None, firefox_url=None, tests='http://hg.mozilla.org/qa/mozmill-tests'): # setup the environment @@ -34,6 +35,7 @@ description='mozmill --help')) # get firefox + FirefoxDownloaderFactory.__init__(self, base_url=firefox_url) # [TODO] # run the in-built tests diff -r 6b0587a217d3 -r 7789fe9f8c30 autobot/steps/firefox.py --- a/autobot/steps/firefox.py Wed Feb 02 09:27:38 2011 -0800 +++ b/autobot/steps/firefox.py Wed Feb 02 11:22:34 2011 -0800 @@ -5,12 +5,37 @@ from buildbot.process.properties import WithProperties from buildbot.steps.shell import ShellCommand -class DownloadFirefoxTarball(ShellCommand): +class DownloadFirefoxRelease(ShellCommand): - def __init__(self, url, **kw): + def __init__(self, os, version, locale='en-US', bits=32, + base_url='http://stage.mozilla.org/pub/mozilla.org/firefox/releases', + **kw): """ - - url : location of the bundle + - os : operating system to download for [linux, win, mac] + - version : version of Firefox (e.g. 4.0b1) + - locale : the full locale + - bits : 32 or 64 + - base_url : location of the releases """ ShellCommand.__init__(self, **kw) - self.addFactoryArguments(url=url) - self.command = ['wget', '-o', url] # STUB + self.addFactoryArguments(os=os, version=version, + locale=locale, bits=bits, base_url=url) + url = base_url.rstrip('/') + '/' + version + '/' + if os == 'linux': + if bits == 32: + platform = 'linux-i686' + elif bits == 64: + platform = 'linux-x86_64' + else: + raise NotImplementedError("bits must be 32 or 64") + elif os == 'win': + platform = 'win32' # for 32 + 64 bits, evidently + elif os == 'mac': + if bits == 32: + platform == 'mac' + elif bits == 64: + platform == 'mac64' + else: + raise NotImplementedError("bits must be 32 or 64") + +# self.command = ['wget', '-o', url] # STUB diff -r 6b0587a217d3 -r 7789fe9f8c30 setup.py --- a/setup.py Wed Feb 02 09:27:38 2011 -0800 +++ b/setup.py Wed Feb 02 11:22:34 2011 -0800 @@ -1,7 +1,7 @@ import os, sys from setuptools import setup, find_packages -version = '0.0' +version = '0.1' setup(name='autobot', version=version, @@ -22,10 +22,11 @@ zip_safe=False, install_requires=[ # -*- Extra requirements: -*- - 'buildbot>=0.8.3p1', - 'buildbot-slave', - 'virtualenv', - 'MakeItSo', + 'buildbot>=0.8.3p1', + 'buildbot-slave', + 'virtualenv', + 'MakeItSo', + 'GetLatestTinderbox' ], entry_points=""" # -*- Entry points: -*-