aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2013-04-17 00:35:56 +0300
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2013-04-17 00:35:56 +0300
commit7189f1ea175ec8e31ca47796a8af20eee62b7d7d (patch)
tree865d1b2f9ee001b3ab1e1fc55af8fbe5a1965dd3 /utils
parent1f92eb45236affb1e0d4a82a1f8d159c6c69fdf6 (diff)
Add initial version of master->snapshots propagation script.
Diffstat (limited to 'utils')
-rwxr-xr-xutils/new-publish/propagate.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/utils/new-publish/propagate.py b/utils/new-publish/propagate.py
new file mode 100755
index 0000000..f7df0df
--- /dev/null
+++ b/utils/new-publish/propagate.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+"""This script propagates build artifacts from build master host
+to actual publishing location (snapshots)."""
+import sys
+import os
+import optparse
+
+import publish
+
+
+REMOTE_HOST = "android-build.linaro.org"
+PUBLISH_USER_NAME = "linaro-android-build-publish"
+TRIGGER_USER_NAME = "linaro-android-build-publish-trigger"
+PUBLISH_KEY_FILE = "/var/run/lava/publish-copy"
+TRIGGER_KEY_FILE = "/var/run/lava/publish-copy"
+#LOCAL_UPLOAD_DIR = "/mnt/publish/uploads"
+LOCAL_UPLOAD_DIR = ""
+REMOTE_UPLOAD_DIR = "/uploads"
+
+
+if __name__ == "__main__":
+ optparser = optparse.OptionParser(usage="%prog")
+ optparser.add_option("--identity-publish", metavar="KEY", default=PUBLISH_KEY_FILE, help="Publish SSH key file")
+ optparser.add_option("--identity-trigger", metavar="KEY", default=TRIGGER_KEY_FILE, help="Trigger SSH key file")
+ optparser.add_option("-n", "--dry-run", action="store_true", help="Don't actually publish files, log commands")
+ options, args = optparser.parse_args(sys.argv[1:])
+ if len(args) != 1:
+ optparser.error("Wrong number of arguments")
+
+ file_list = []
+ for root, dirs, files in os.walk(os.path.join(LOCAL_UPLOAD_DIR, args[0])):
+ file_list.extend([os.path.join(root, f) for f in files])
+ print file_list
+ dir_list = publish.make_dir_struct(file_list)
+ print dir_list
+ if not options.dry_run:
+ publish.create_dir_struct(dir_list, REMOTE_HOST, PUBLISH_USER_NAME,
+ options.identity_publish)
+ upload_script = publish.make_upload_script(file_list)
+ publish.upload_files(upload_script, REMOTE_HOST, PUBLISH_USER_NAME,
+ options.identity_publish, options)