summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/config.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/config.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/config.py')
-rw-r--r--source-builder/sb/config.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py
index 74c002e..a901038 100644
--- a/source-builder/sb/config.py
+++ b/source-builder/sb/config.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'.
@@ -73,6 +73,7 @@ class package:
self.config = config
self.directives = {}
self.infos = {}
+ self.sizes = {}
def __str__(self):
@@ -218,6 +219,16 @@ class package:
def disabled(self):
return len(self.name()) == 0
+ def set_size(self, what, path_):
+ if what not in self.sizes:
+ self.sizes[what] = 0
+ self.sizes[what] += path.get_size(path_)
+
+ def get_size(self, what):
+ if what in self.sizes:
+ return self.sizes[what]
+ return 0
+
class file:
"""Parse a config file."""