diff options
author | Milo Casagrande <milo@ubuntu.com> | 2013-12-23 15:37:55 +0100 |
---|---|---|
committer | Milo Casagrande <milo@ubuntu.com> | 2013-12-23 15:37:55 +0100 |
commit | cd83fd6b0d0e4617ca160eae718da9f75a5ab831 (patch) | |
tree | c47793aea9d9accaba456b872e884f122b91d2e5 /scripts | |
parent | 3573af4f20afdcca50919d4bf3a804ccbe868d6c (diff) |
Fixed problem with BUILD-INFO rewrite.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/publish_to_snapshots.py | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/scripts/publish_to_snapshots.py b/scripts/publish_to_snapshots.py index b1bf087..074f3c0 100755 --- a/scripts/publish_to_snapshots.py +++ b/scripts/publish_to_snapshots.py @@ -434,6 +434,31 @@ class SnapshotsPublisher(object): common_bi.splice(tmp_bi) +def rewrite_build_info(build_dir_path, target_dir_path, tmp_bi, job_type): + + if job_type == 'prebuilt': + for _, subdirs, _ in os.walk(build_dir_path): + for element in subdirs: + target_dir_path = os.path.join(target_dir_path, element) + + bi_path = os.path.join(target_dir_path, BUILDINFO) + if os.path.getsize(tmp_bi) > 0: + shutil.copy(tmp_bi, bi_path) + + append_open_buildinfo(target_dir_path) + bi = SpliceBuildInfos([target_dir_path]) + bi.splice(bi_path) + + +def combine_build_info(publisher, build_dir_path, target_dir_path, tmp_bi, + job_type): + if job_type == 'prebuilt': + for _, subdirs, _ in os.walk(build_dir_path): + for element in subdirs: + target_dir_path = os.path.join(target_dir_path, element) + publisher.combine_buildinfo(build_dir_path, target_dir_path, tmp_bi) + + def main(): global uploads_path global target_path @@ -462,23 +487,27 @@ def main(): except BuildInfoException as e: print e.value return FAIL + fd, tmp_bi = tempfile.mkstemp() os.close(fd) os.chmod(tmp_bi, 0644) - publisher.combine_buildinfo(build_dir_path, target_dir_path, tmp_bi) - ret = publisher.move_artifacts(args, build_dir_path, target_dir_path) - if ret != PASS: - print "Move Failed" - return FAIL - else: - if os.path.getsize(tmp_bi) > 0: - shutil.copy(tmp_bi, os.path.join(target_dir_path, BUILDINFO)) + + try: + combine_build_info( + publisher, build_dir_path, target_dir_path, tmp_bi, + args.job_type) + ret = publisher.move_artifacts( + args, build_dir_path, target_dir_path) + if ret != PASS: + print "Move Failed" + return FAIL + else: + rewrite_build_info( + build_dir_path, target_dir_path, tmp_bi, args.job_type) + print "Move succeeded" + return PASS + finally: os.remove(tmp_bi) - append_open_buildinfo(target_dir_path) - bi = SpliceBuildInfos([target_dir_path]) - bi.splice(os.path.join(target_dir_path, BUILDINFO)) - print "Move succeeded" - return PASS except Exception, details: print "In main() Exception details:", details return FAIL |