commit: 15f9b645b39b2cbac2a7659a3a6a006c8befadfc
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 30 20:14:34 2019 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Aug 30 21:04:25 2019 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=15f9b645
Record disk usage for each package/component
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
gen_determineargs.sh | 2 ++
gen_funcs.sh | 11 +++++++++++
gen_initramfs.sh | 8 +++++++-
worker_modules/gkbuild.sh | 7 +++++++
4 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 79d0638..db6ccf9 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -764,6 +764,8 @@ determine_real_args() {
unset FEATURE_REQUIRING_BUSYBOX
FEATURES_REQUIRING_BUSYBOX
fi
+ DU_COMMAND="$(which du 2>/dev/null)"
+
LDDTREE_COMMAND="$(which lddtree 2>/dev/null)"
if [ -z "${LDDTREE_COMMAND}" ]
then
diff --git a/gen_funcs.sh b/gen_funcs.sh
index c3bcee6..f835220 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -813,6 +813,16 @@ get_chost_libdir() {
echo "${libdir}"
}
+get_du() {
+ [[ ${#} -ne 1 ]] \
+ && gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid
usage of ${FUNCNAME}(): Function takes exactly one argument (${#} given)!"
+
+ [ -z "${DU_COMMAND}" ] && return
+
+ local sz=( $("${DU_COMMAND}" -hs "${1}" 2>/dev/null) )
+ echo "${sz[0]}"
+}
+
_get_gkpkg_var_value() {
[[ ${#} -ne 2 ]] \
&& gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid
usage of ${FUNCNAME}(): Function takes exactly two arguments (${#} given)!"
@@ -1264,6 +1274,7 @@ gkbuild() {
"GKPKG_SRCTAR='${SRCTAR}'"
"GKPKG_BINPKG='${BINPKG}'"
"GKPKG_DEPS='${DEPS}'"
+ "DU_COMMAND='${DU_COMMAND}'"
"TAR_COMMAND='${TAR_COMMAND}'"
)
diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 067f630..a27e2ca 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -171,8 +171,14 @@ copy_system_binaries() {
}
log_future_cpio_content() {
+ local dir_size=$(get_du "${PWD}")
+ if [ -n "${dir_size}" ]
+ then
+ dir_size=" (${dir_size})"
+ fi
+
print_info 3
"=================================================================" 1 0 1
- print_info 3 "About to add these files from '${PWD}' to cpio archive:"
1 0 1
+ print_info 3 "About to add these files${dir_size} from '${PWD}' to cpio
archive:" 1 0 1
print_info 3 "$(find . -print0 | xargs --null ls -ald)" 1 0 1
print_info 3
"=================================================================" 1 0 1
}
diff --git a/worker_modules/gkbuild.sh b/worker_modules/gkbuild.sh
index ea64a17..213597a 100644
--- a/worker_modules/gkbuild.sh
+++ b/worker_modules/gkbuild.sh
@@ -184,6 +184,13 @@ _gkbuild_main() {
"${TAR_COMMAND}" -caf "${GKPKG_BINPKG}" . \
|| die "Failed to create binpkg of ${P} in '${GKPKG_BINPKG}'!"
+ if [ -n "${DU_COMMAND}" ]
+ then
+ print_info 5 "Final size of build root: $(get_du
"${BROOT}")"
+ print_info 5 "Final size of build directory: $(get_du "${S}")"
+ print_info 5 "Final size of installed tree: $(get_du "${D}")"
+ fi
+
cd "${TEMP}" || die "Failed to chdir to '${TEMP}'!"
if [ ! -f "${TEMP}/.no_cleanup" ]
then