diff options
author | Georgy Redkozubov <georgy.redkozubov@linaro.org> | 2013-09-20 17:41:41 +0400 |
---|---|---|
committer | Georgy Redkozubov <georgy.redkozubov@linaro.org> | 2013-09-20 17:41:41 +0400 |
commit | 236e7e9280b552fd7041fff3b9df28cdea742220 (patch) | |
tree | ec316f4fdbceb839b98cd1032d2e6c96bfb0ee3c /scripts | |
parent | abd310abf119ec112dea1a220c0afc27288b7719 (diff) | |
parent | cefbf0c1c274dbc194dcbf1d96aa5b7dc1f2e8a5 (diff) |
[merge] Added checks to avoid generation of incorrect BUILD-INFO.txt
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/publish_to_snapshots.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/scripts/publish_to_snapshots.py b/scripts/publish_to_snapshots.py index f13a689..624e1ba 100755 --- a/scripts/publish_to_snapshots.py +++ b/scripts/publish_to_snapshots.py @@ -35,27 +35,28 @@ acceptable_job_types = [ ] open_buildinfo_files = [ 'MANIFEST', - '*manifest.xml', + '*manifest*.xml', 'MD5SUMS', '*build_cmds.sh', 'kernel_config', 'HOWTO_*', 'lava-job-info*' ] -open_buildinfo = 'Files-Pattern: %s\nLicense-Type: open\n' +open_buildinfo = '\nFiles-Pattern: %s\nLicense-Type: open\n' def append_open_buildinfo(buildinfo_path, files=open_buildinfo_files): """Append BUILD-INFO.txt with open section for open_buildinfo_files""" - try: - bifile = open(os.path.join(buildinfo_path, buildinfo), "a") + if os.path.exists(os.path.join(buildinfo_path, buildinfo)): try: - bifile.write(open_buildinfo % ', '.join(files)) - finally: - bifile.close() - except IOError: - print "Unable to write to BUILD-INFO.txt" - pass + bifile = open(os.path.join(buildinfo_path, buildinfo), "a") + try: + bifile.write(open_buildinfo % ', '.join(files)) + finally: + bifile.close() + except IOError: + print "Unable to write to BUILD-INFO.txt" + pass def setup_parser(): @@ -469,7 +470,8 @@ def main(): print "Move Failed" return FAIL else: - shutil.copy(tmp_bi, os.path.join(target_dir_path, buildinfo)) + if os.path.getsize(tmp_bi) > 0: + shutil.copy(tmp_bi, os.path.join(target_dir_path, buildinfo)) os.remove(tmp_bi) append_open_buildinfo(target_dir_path) bi = SpliceBuildInfos([target_dir_path]) |