# HG changeset patch # User Jeff Hammel # Date 1300755134 25200 # Node ID b73ccb5bf33790ba4a193407ec40853962f27e71 # Parent c82a46673ce925862b949193c752b65da6d9228c lots of work to get dmg on macs to give me something i care about on mac; thank you mr jobs diff -r c82a46673ce9 -r b73ccb5bf337 autobot/process/factory.py --- a/autobot/process/factory.py Mon Mar 21 15:08:04 2011 -0700 +++ b/autobot/process/factory.py Mon Mar 21 17:52:14 2011 -0700 @@ -80,19 +80,41 @@ # See: # http://mxr.mozilla.org/mozilla-central/source/build/package/mac_osx/unpack-diskimage # http://hg.mozilla.org/qa/mozmill-automation/file/default/libs/install.py + # ideally, the duplication of intent should be disappeared self.addStep(ShellCommand(command=['rm', '-rf', 'firefox-tmp'])) self.addStep(ShellCommand(command=['mkdir', 'firefox-tmp'], haltOnFailure=True)) self.addStep(ShellCommand(command=['hdiutil', 'attach', + '-verbose', '-noautoopen', WithProperties('%(firefox_bundle)s'), '-mountpoint', 'firefox-tmp'], haltOnFailure=True)) + self.addStep(ShellCommand(command=['rm', '-rf', 'firefox'])) + def app_name(returncode, stdout, stderr): + """ + extract the name of the app + """ + return {'app_name': stdout.rsplit('/', 1)[-1]} + self.addStep(SetProperty(command=['echo', 'firefox-tmp', '*.app'], + extract_fn=app_name)) + self.addStep(ShellCommand(command=['cp', '-r', 'firefox-tmp', 'firefox'])) + + # it would be nice to reuse the logic from + # https://github.com/mozautomation/mozmill/blob/master/mozrunner/mozrunner/runner.py + # however, I can't think of a clever way of doing this right now. + # When refactoring Mozilla, things like this should be kept in + # mind wrt consolidating towards best practices instead of + # copy+pasting and creating (dysfunctional, difficult to maintain) + # code islands + self.addStep(SetProperty(property='firefox', + command=self.abspath(WithProperties('firefox/%(app_name)s/Contents/MacOS/firefox-bin')))) + else: raise NotImplementedError("FirefoxDownloader doesn't know how to work with your os: %s" % platform['os']) def abspath(self, path): """returns a command that will print the absolute path""" - # TODO: could use WirthProperties if needed + # TODO: could use WithProperties if needed # could also go not in a class, again if needed return ['python', '-c', 'import os; print os.path.abspath("%s")' % path]