changeset 197:854ac4008ac8

Exactly one of property and extract_fn must be set
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 02 Feb 2011 14:52:09 -0800
parents 4e5e38de6b1e
children 1a50b63c73a3
files autobot/process/factory.py
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/process/factory.py	Wed Feb 02 14:44:34 2011 -0800
+++ b/autobot/process/factory.py	Wed Feb 02 14:52:09 2011 -0800
@@ -19,12 +19,6 @@
   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):
@@ -34,6 +28,9 @@
 
   def __init__(self, platform, base_url=None):
 
+    # must have the os specified!
+    assert platform.get('os'), "platform['os'] must be one of (linux, win, mac)"
+
     # determine the (damn) url
     script = 'get-latest-tinderbox'
     if base_url:
@@ -46,9 +43,14 @@
                              ))
 
     # get the filename
-    self.addStep(SetProperty(property='firefox_bundle',
-                             command=['echo', WithProperties('%(firefox_url)s')],
-                             extract_fn=url_basename))
+    def firefox_bundle_name(returncode, stdout, stderr):
+      """
+      extract the end part of the URL ~ the basename
+      """
+      return {'firefox_bundle': stdout.rsplit('/', 1)[-1]}
+
+    self.addStep(SetProperty(command=['echo', WithProperties('%(firefox_url)s')],
+                             extract_fn=firefox_bundle_name))
 
     # download Firefox
     self.addStep(ShellCommand(command=['wget',
@@ -61,6 +63,7 @@
     # - 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):