From 6af9211a06b09b07221d586c6a09a7cd02a2311e Mon Sep 17 00:00:00 2001 From: Georgy Redkozubov Date: Tue, 23 Apr 2013 16:30:41 +0400 Subject: Fix for bug 1146220 to reinstate BUILD-INFO.txt support. Script checks if BUILD-INFO.txt is present among artifacts being published or among artifacts already published for the same build. Otherwise error is thrown and no artifacts are published. --- scripts/publish_to_snapshots.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'scripts') diff --git a/scripts/publish_to_snapshots.py b/scripts/publish_to_snapshots.py index 5276751..c1d5662 100755 --- a/scripts/publish_to_snapshots.py +++ b/scripts/publish_to_snapshots.py @@ -15,6 +15,7 @@ staging_target_path = '/srv/staging.snapshots.linaro.org/www/' product_dir_path = 'target/product' PASS = 0 FAIL = 1 +buildinfo = 'BUILD-INFO.txt' acceptable_job_types = [ 'android', 'prebuilt', @@ -367,6 +368,22 @@ class SnapshotsPublisher(object): print "Failed to move files destination path", target_dir_path return FAIL + def check_buildinfo(self, build_dir_path, target_dir_path): + bi_dirs = [] + for path, subdirs, files in os.walk(build_dir_path): + for filename in files: + if buildinfo in filename: + bi_dirs.append(path) + for path, subdirs, files in os.walk(target_dir_path): + for filename in files: + if buildinfo in filename: + bi_dirs.append(path) + + if not bi_dirs: + return FAIL + + return PASS + def main(): global uploads_path @@ -387,6 +404,10 @@ def main(): if build_dir_path is None or target_dir_path is None: print "Problem with build/target path, move failed" return FAIL + ret = publisher.check_buildinfo(build_dir_path, target_dir_path) + if ret != PASS: + print "BUILD-INFO.txt is not present for build being published" + return FAIL ret = publisher.move_artifacts(args, build_dir_path, target_dir_path) if ret != PASS: print "Move Failed" -- cgit v1.2.3