aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGeorgy Redkozubov <georgy.redkozubov@linaro.org>2013-09-20 17:12:19 +0400
committerGeorgy Redkozubov <georgy.redkozubov@linaro.org>2013-09-20 17:12:19 +0400
commitcefbf0c1c274dbc194dcbf1d96aa5b7dc1f2e8a5 (patch)
treef80db46bc638018430252ce161bc7b76499467d8 /scripts
parent467096446114fc69212a3e726153781f29ef0c6c (diff)
Added checks to avoid generation of incorrect BUILD-INFO.txt
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/publish_to_snapshots.py24
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])