changeset 194:5257c9abea50

now we should at least download firefox, in theory
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 02 Feb 2011 14:26:41 -0800
parents 44f829802442
children 524b8b215a01
files autobot/process/factory.py autobot/projects/mozmill/__init__.py
diffstat 2 files changed, 30 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/process/factory.py	Wed Feb 02 11:53:52 2011 -0800
+++ b/autobot/process/factory.py	Wed Feb 02 14:26:41 2011 -0800
@@ -8,6 +8,9 @@
 from buildbot.steps.shell import ShellCommand
 from buildbot.steps.shell import WithProperties
 
+
+### utility functions; could go elsewhere
+
 def find(*args):
   """
   returns a command to echo the found file cross-platform
@@ -16,12 +19,20 @@
   command = 'if %s; else false; fi' % '; elif '.join(args)
   return ['bash', '-c', command]
 
+def url_basename(returncode, stdout, stderr):
+  """
+  extract the end part of the URL ~ the basename
+  """
+  return stdout.rsplit('/', 1)[-1]
+
+### factories
+
 class FirefoxDownloaderFactory(BuildFactory):
   """
   factory to aid in downloading Firefox
   """
 
-  def __init__(self, base_url=None):
+  def __init__(self, platform, base_url=None):
 
     # determine the (damn) url
     script = 'get-latest-tinderbox'
@@ -34,6 +45,23 @@
                              haltOnFailure=True
                              ))
 
+    # get the filename
+    self.addStep(SetProperty(property='firefox_bundle',
+                             command=['echo', WithProperties('%(firefox_url)s')],
+                             extract_fn=url_basename))
+
+    # download Firefox
+    self.addStep(ShellCommand(command=['wget',
+                                       WithProperties('%(firefox_url)s'),
+                                       '-O',
+                                       WithProperties('%(firefox_bundle)s')],
+                              haltOnFailure=True))
+
+    # three cases:
+    # - linux has firefox in a .tar.bz2 file
+    # - mac has firefox in a .dmg file [TODO]
+    # - windows has firefox in a .zip file
+
 
 class SourceFactory(BuildFactory):
   """
--- a/autobot/projects/mozmill/__init__.py	Wed Feb 02 11:53:52 2011 -0800
+++ b/autobot/projects/mozmill/__init__.py	Wed Feb 02 14:26:41 2011 -0800
@@ -12,7 +12,7 @@
   # VCS
   sources = {'git': ['http://github.com/mozautomation/mozmill.git']}
   
-  def __init__(self, platform=None, git=None, firefox_url=None,
+  def __init__(self, platform, git=None, firefox_url=None,
                tests='http://hg.mozilla.org/qa/mozmill-tests'):
 
     # setup the environment