def main(): if len(sys.argv) < 3: print "Usage: %s <version> [mobilesdk-XXX.zip, ..]" % sys.argv[0] sys.exit(1) version = sys.argv[1] mobilesdk_zips = sys.argv[2:] cfg = utils.get_build_config() if not cfg.verify_aws(): print "Error: Need both AWS_KEY and AWS_SECRET in the environment or config.json" sys.exit(1) global bucket bucket = cfg.open_bucket() upload_release(version, mobilesdk_zips)
def usage(): print "Usage: %s (add|remove|list|default) (mobile|desktop) <branch>" % sys.argv[ 0] sys.exit(1) if len(sys.argv) < 3: usage() command = sys.argv[1] type = sys.argv[2] if command in ['add', 'remove', 'default']: if len(sys.argv) != 4: usage() branch = sys.argv[3] cfg = utils.get_build_config() if not cfg.verify_aws(): print "Error: Need both AWS_KEY and AWS_SECRET in the environment or config.json" sys.exit(1) bucket = cfg.open_bucket() branches_key = '%s/branches.json' % type branches = utils.get_key_json_object(bucket, branches_key) def list_branches(): if not 'branches' in branches: print 'No branches for %s' % type sys.exit(1) print 'Building branches for %s:' % type
#!/usr/bin/python import sys, os, socket, utils from boto.s3.connection import S3Connection from boto.s3.key import Key import simplejson if len(sys.argv) != 6: print "Usage: %s <desktop|mobile> <path> <branch> <revision> <build url>" % sys.argv[0] sys.exit(1) (type, path, branch, revision, build_url) = sys.argv[1:] cfg = utils.get_build_config() if not cfg.verify_aws(): print "Error: Need both AWS_KEY and AWS_SECRET in the environment or config.json" sys.exit(1) bucket = cfg.open_bucket() sha1 = utils.shasum(path) filename = os.path.basename(path) filesize = os.path.getsize(path) print 'uploading %s (branch %s / revision %s)...' % (filename, branch, revision) key = Key(bucket) key.key = '%s/%s/%s' % (type, branch, filename) key.set_metadata('git_revision', revision) key.set_metadata('git_branch', branch) key.set_metadata('build_url', build_url) key.set_metadata('build_type', type) key.set_metadata('sha1', sha1)