aboutsummaryrefslogtreecommitdiff
path: root/utils/new-publish/publish
diff options
context:
space:
mode:
Diffstat (limited to 'utils/new-publish/publish')
-rwxr-xr-xutils/new-publish/publish71
1 files changed, 0 insertions, 71 deletions
diff --git a/utils/new-publish/publish b/utils/new-publish/publish
deleted file mode 100755
index b18e351..0000000
--- a/utils/new-publish/publish
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-import sys
-import os
-import glob
-import optparse
-
-import publib
-
-
-REMOTE_HOST = "android-build.linaro.org"
-COPY_USER_NAME = "publish-copy"
-TRIGGER_USER_NAME = "publish-trigger"
-UPLOAD_DIR = "/uploads"
-COPY_KEY_FILE = "/var/run/lava/publish-copy"
-TRIGGER_KEY_FILE = "/var/run/lava/publish-trigger"
-
-def log(msg):
- print msg
- sys.stdout.flush()
-
-if __name__ == "__main__":
- optparser = optparse.OptionParser(usage="%prog <job/build> <pattern>...")
- optparser.add_option("-t", "--type", help="Build type")
- optparser.add_option("-p", "--strip", metavar="NUM", type=int, default=0,
- help="Strip leading components from dest file names.")
- optparser.add_option("-s", "--staging", action="store_true", help="Publish to staging")
- optparser.add_option("--identity-copy", metavar="KEY", default=COPY_KEY_FILE, help="SSH key file")
- optparser.add_option("--identity-trigger", metavar="KEY", default=TRIGGER_KEY_FILE, help="SSH key file")
- optparser.add_option("-n", "--dry-run", action="store_true", help="Don't actually publish files, log commands")
- optparser.add_option("--host", help="Override destination publishing host, for debugging")
- options, args = optparser.parse_args(sys.argv[1:])
- if len(args) < 2:
- optparser.error("Wrong number of arguments")
-
- build_id = args[0]
- patterns = args[1:]
-
- publib.validate_build_id(build_id)
-
- # Support Jenkins syntax, with comma as separator
- if len(patterns) == 1 and "," in patterns[0]:
- patterns = patterns[0].split(",")
-
- for p in patterns:
- if "**" in p:
- print "** in glob patterns is not supported"
- sys.exit(1)
-
- file_list = publib.get_file_list(patterns)
- print "File list:", file_list
- dir_list = publib.make_dir_struct(file_list, UPLOAD_DIR, build_id, options.strip)
- print "Dir list:", dir_list
- log("Creating dir structure on intermediate server")
- publib.create_dir_struct(dir_list, REMOTE_HOST, COPY_USER_NAME, options.identity_copy)
- log("Done creating dir structure on intermediate server")
- upload_script = publib.make_upload_script(file_list, UPLOAD_DIR, build_id, options.strip)
- log("Uploading files to intermediate server")
- publib.upload_files(upload_script, REMOTE_HOST, COPY_USER_NAME, options.identity_copy, options)
- log("Done uploading files to intermediate server")
-
- log("Triggering propagation of files to downloads server")
- rc = os.system("ssh -i %s %s@%s propagate.py %s %s %s" % (options.identity_trigger,
- TRIGGER_USER_NAME, REMOTE_HOST,
- "-s" if options.staging else "",
- "--host=%s" % options.host if options.host else "",
- build_id))
- if rc != 0:
- log("Publishing failed")
- sys.exit(1)
-
- log("Publishing successful")