From d6ecdd41b90402c2d02138854a9438dab56a0b9f Mon Sep 17 00:00:00 2001 From: hyokeun Date: Fri, 26 Jan 2018 10:44:13 +0900 Subject: [PATCH] ABS: Save enough logs Change-Id: I3306c98ab7442e813ea2532c70f53f611365870e --- abs/job_abs_update.py | 4 +++- common/tizen_studio.py | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/abs/job_abs_update.py b/abs/job_abs_update.py index ddfa3bf..4e0d3b5 100755 --- a/abs/job_abs_update.py +++ b/abs/job_abs_update.py @@ -137,12 +137,14 @@ def build_result_report(build_number): mymail.add_message('Full build cause: %s\n' % reason) mymail.add_message('OBS Target Project: %s\n' % target) mymail.add_message('branch: %s\n\n' % branch) + mymail.add_message('\nFor detailed info, please visit %s/abs_rbs.code?rbs_only=1&project=%s\n\n' \ + % (os.getenv("PUBLIC_DASHBOARD_URL"), target)) log_size = 0 for x in build_result: sys.stdout.flush() mymail.add_message('\n\n[ %s ] [%s]\n=========' % (x.get('project'), x.get('result'))) - mymail.add_message(x.get('log')) + #mymail.add_message(x.get('log')) log_size += len(x.get('log')) print 'Log Size: %d' % log_size diff --git a/common/tizen_studio.py b/common/tizen_studio.py index ecdceaa..ea5e373 100644 --- a/common/tizen_studio.py +++ b/common/tizen_studio.py @@ -140,7 +140,7 @@ class TizenStudio(object): sys.stdout.flush() shutil.copy(self.vm_image, temp_image) if not os.path.isfile(temp_image): - shutil.rmtree(temp_image) + os.remove(temp_image) print 'Temp file creation failed' return None os.chmod(temp_image, os.stat(temp_image).st_mode | stat.S_IWRITE) @@ -167,7 +167,7 @@ class TizenStudio(object): print '[ TizenStudio END ] %s' % (str(datetime.now())) if int(ret) != 0: - shutil.rmtree(temp_image) + os.remove(temp_image) print 'Updating failed, cause : %s' % ret return None os.rename(temp_image, self.vm_image) @@ -200,10 +200,11 @@ class TizenStudio(object): # Get building log self.buildlog = '' - for filename in os.listdir(self.builddir): + mtime = lambda f: os.stat(os.path.join(self.builddir, f)).st_mtime + for filename in list(sorted(os.listdir(self.builddir), key=mtime)): if re.match('build.*\.log', filename): - onefile = tail(os.path.join(self.builddir, filename), c=2304) - self.buildlog = self.buildlog + onefile[:onefile.rfind("Finished build-native")] + onefile = tail(os.path.join(self.builddir, filename), c=4096) + self.buildlog = onefile[:onefile.rfind("Finished build-native")] if self.build_result != 0: return {'built_version': built_version, \ -- 2.7.4