Commit 5738ae54 authored by Leo Iannacone's avatar Leo Iannacone

write files size to package .json

parent 78afc508
......@@ -119,6 +119,12 @@ class DebomaticModule_JSONLogger:
json = toJSON(info, indent=4, sort_keys=True)
infofd.write(json + '\n')
def _get_human_size(self, num):
for x in ['b', 'KB', 'MB', 'GB', 'TB']:
if num < 1024.0:
return "%3.1f %s" % (num, x)
num /= 1024.0
def pre_chroot(self, args):
distribution = self._get_distribution_status(args)
self._append_json_logfile(args, distribution)
......@@ -140,14 +146,20 @@ class DebomaticModule_JSONLogger:
status = self._get_package_status(args)
status['status'] = 'build'
status['success'] = args['success']
status['tags'] = {}
status['files'] = {}
resultdir = os.path.join(args['directory'], 'pool', args['package'])
for filename in os.listdir(resultdir):
if filename.endswith('.json'):
continue
full_path = os.path.join(resultdir, filename)
info = {}
info['size'] = self._get_human_size(os.path.getsize(full_path))
tag = LogParser(full_path).parse()
if tag:
status['tags'][filename] = tag
info['tags'] = tag
status['files'][filename] = info
self._write_package_json(args, status)
status.pop('files', None)
self._append_json_logfile(args, status)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment