summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-12-03 22:54:11 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-12-03 22:54:11 +0200
commit21f0f4cf3d2be79995e94e0712347eba0c686e2e (patch)
tree9a09d97b529a43111b9fddb52dc69dbdb1caeed8
parent38e8d8fb8e05aa4b45f6f2900d4f543733131f39 (diff)
downloadpublishing-api-21f0f4cf3d2be79995e94e0712347eba0c686e2e.tar.gz
Implement --split-job-owner, to rewrite job path as required for android-build.
Rewrite destination path containing Jenkins job name from .../owner_jobname/123 to .../~owner/jobname/123 , as required for android-build publishing. Change-Id: I8d7383d03ba5874abc4c0b2e3140ec51a37dd455
-rwxr-xr-xlinaro-cp.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/linaro-cp.py b/linaro-cp.py
index 7c1d8c1..5757ec6 100755
--- a/linaro-cp.py
+++ b/linaro-cp.py
@@ -8,6 +8,7 @@ import pycurl
import sys
import tempfile
import time
+import re
# Public artifacts BUILD-INFO.txt
build_info = 'Format-Version: 0.5\n\nFiles-Pattern: *\nLicense-Type: open\n'
@@ -116,6 +117,8 @@ def main():
parser.add_argument('--server', default='http://snapshots.linaro.org/',
help='Publishing API server. default=%(default)s')
parser.add_argument('-b', '--build-info', help='Custom build-info file')
+ parser.add_argument('--split-job-owner', action='store_true',
+ help='Split Jenkins job owner in dst (owner_job -> ~owner/job)')
parser.add_argument('src', help='source directory with files to publish')
parser.add_argument('dst', help='destination to publish to')
@@ -143,6 +146,11 @@ def main():
else:
api = API_v2(arguments.server, arguments.build_info, key)
+ if arguments.split_job_owner:
+ # Rewrite job path .../owner_jobname/123 -> .../~owner/jobname/123 ,
+ # as required for android-build publishing.
+ arguments.dst = re.sub(r"^(.+?)/([^/]+?)_([^/]+?)/([0-9]+)/?$", r"\1/~\2/\3/\4/", arguments.dst)
+
transfer_failures = api.upload(arguments.src, arguments.dst)
if len(transfer_failures) > 0: