summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/setbuilder.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2018-09-28 07:27:57 +1000
committerChris Johns <chrisj@rtems.org>2018-09-28 07:36:49 +1000
commit38fd56c8a896a52bcab4f8921f67c483e36cf728 (patch)
tree0676e76fe5193ca5b690ff678f12c916b71d1b30 /source-builder/sb/setbuilder.py
parentsb: Raise an error if an option is not registered and unknown. (diff)
downloadrtems-source-builder-38fd56c8a896a52bcab4f8921f67c483e36cf728.tar.bz2
sb: Monitor the build disk usage. Report the usage, total and various sizes
- Track the size of a build of a package in a build set to determine the maximum amout of disk space used. This can be used as a guide to documenting how much space a user needs to set aside to build a specific set of tools. - The `%clean` stage of a build is now split into a separate script. I do not think this is an issue because I could not find any `%clean` sections in any build configs we have. In time support for the `%clean` section will be removed, the package builder cleans up. Closes #3516
Diffstat (limited to 'source-builder/sb/setbuilder.py')
-rw-r--r--source-builder/sb/setbuilder.py42
1 files changed, 40 insertions, 2 deletions
diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py
index b7cd8f2..2e6d643 100644
--- a/source-builder/sb/setbuilder.py
+++ b/source-builder/sb/setbuilder.py
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2010-2016 Chris Johns (chrisj@rtems.org)
+# Copyright 2010-2018 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -447,13 +447,48 @@ class buildset:
self.install(b.name(),
b.config.expand('%{buildroot}'),
b.config.expand('%{_prefix}'))
-
+ #
+ # Sizes ...
+ #
+ if len(builds) > 1:
+ size_build = 0
+ size_installed = 0
+ size_build_max = 0
+ for b in builds:
+ s = b.get_build_size()
+ size_build += s
+ if s > size_build_max:
+ size_build_max = s
+ size_installed += b.get_installed_size()
+ size_sources = 0
+ for p in builds[0].config.expand('%{_sourcedir}').split(':'):
+ size_sources += path.get_size(p)
+ size_patches = 0
+ for p in builds[0].config.expand('%{_patchdir}').split(':'):
+ size_patches += path.get_size(p)
+ size_total = size_sources + size_patches + size_installed
+ build_size = 'usage: %s' % (build.humanize_number(size_build_max + size_installed, 'B'))
+ build_size += ' total: %s' % (build.humanize_number(size_total, 'B'))
+ build_size += ' (sources: %s' % (build.humanize_number(size_sources, 'B'))
+ build_size += ', patches: %s' % (build.humanize_number(size_patches, 'B'))
+ build_size += ', installed %s)' % (build.humanize_number(size_installed, 'B'))
+ #
+ # Cleaning ...
+ #
if deps is None and \
(not self.opts.no_clean() or self.opts.always_clean()):
for b in builds:
if not b.disabled():
log.notice('cleaning: %s' % (b.name()))
b.cleanup()
+ #
+ # Log the build size message
+ #
+ if len(builds) > 1:
+ log.notice('Build Sizes: %s' % (build_size))
+ #
+ # Clear out the builds ...
+ #
for b in builds:
del b
except error.general as gerr:
@@ -484,6 +519,9 @@ class buildset:
self.write_mail_header('')
log.notice('Mailing report: %s' % (mail['to']))
body = self.get_mail_header()
+ body += 'Sizes' + os.linesep
+ body += '=====' + os.linesep + os.linesep
+
body += 'Output' + os.linesep
body += '======' + os.linesep + os.linesep
body += os.linesep.join(mail['output'].get())