1 |
commit: 15f9b645b39b2cbac2a7659a3a6a006c8befadfc |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 30 20:14:34 2019 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 30 21:04:25 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=15f9b645 |
7 |
|
8 |
Record disk usage for each package/component |
9 |
|
10 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
11 |
|
12 |
gen_determineargs.sh | 2 ++ |
13 |
gen_funcs.sh | 11 +++++++++++ |
14 |
gen_initramfs.sh | 8 +++++++- |
15 |
worker_modules/gkbuild.sh | 7 +++++++ |
16 |
4 files changed, 27 insertions(+), 1 deletion(-) |
17 |
|
18 |
diff --git a/gen_determineargs.sh b/gen_determineargs.sh |
19 |
index 79d0638..db6ccf9 100755 |
20 |
--- a/gen_determineargs.sh |
21 |
+++ b/gen_determineargs.sh |
22 |
@@ -764,6 +764,8 @@ determine_real_args() { |
23 |
unset FEATURE_REQUIRING_BUSYBOX FEATURES_REQUIRING_BUSYBOX |
24 |
fi |
25 |
|
26 |
+ DU_COMMAND="$(which du 2>/dev/null)" |
27 |
+ |
28 |
LDDTREE_COMMAND="$(which lddtree 2>/dev/null)" |
29 |
if [ -z "${LDDTREE_COMMAND}" ] |
30 |
then |
31 |
|
32 |
diff --git a/gen_funcs.sh b/gen_funcs.sh |
33 |
index c3bcee6..f835220 100755 |
34 |
--- a/gen_funcs.sh |
35 |
+++ b/gen_funcs.sh |
36 |
@@ -813,6 +813,16 @@ get_chost_libdir() { |
37 |
echo "${libdir}" |
38 |
} |
39 |
|
40 |
+get_du() { |
41 |
+ [[ ${#} -ne 1 ]] \ |
42 |
+ && gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid usage of ${FUNCNAME}(): Function takes exactly one argument (${#} given)!" |
43 |
+ |
44 |
+ [ -z "${DU_COMMAND}" ] && return |
45 |
+ |
46 |
+ local sz=( $("${DU_COMMAND}" -hs "${1}" 2>/dev/null) ) |
47 |
+ echo "${sz[0]}" |
48 |
+} |
49 |
+ |
50 |
_get_gkpkg_var_value() { |
51 |
[[ ${#} -ne 2 ]] \ |
52 |
&& gen_die "$(get_useful_function_stack "${FUNCNAME}")Invalid usage of ${FUNCNAME}(): Function takes exactly two arguments (${#} given)!" |
53 |
@@ -1264,6 +1274,7 @@ gkbuild() { |
54 |
"GKPKG_SRCTAR='${SRCTAR}'" |
55 |
"GKPKG_BINPKG='${BINPKG}'" |
56 |
"GKPKG_DEPS='${DEPS}'" |
57 |
+ "DU_COMMAND='${DU_COMMAND}'" |
58 |
"TAR_COMMAND='${TAR_COMMAND}'" |
59 |
) |
60 |
|
61 |
|
62 |
diff --git a/gen_initramfs.sh b/gen_initramfs.sh |
63 |
index 067f630..a27e2ca 100755 |
64 |
--- a/gen_initramfs.sh |
65 |
+++ b/gen_initramfs.sh |
66 |
@@ -171,8 +171,14 @@ copy_system_binaries() { |
67 |
} |
68 |
|
69 |
log_future_cpio_content() { |
70 |
+ local dir_size=$(get_du "${PWD}") |
71 |
+ if [ -n "${dir_size}" ] |
72 |
+ then |
73 |
+ dir_size=" (${dir_size})" |
74 |
+ fi |
75 |
+ |
76 |
print_info 3 "=================================================================" 1 0 1 |
77 |
- print_info 3 "About to add these files from '${PWD}' to cpio archive:" 1 0 1 |
78 |
+ print_info 3 "About to add these files${dir_size} from '${PWD}' to cpio archive:" 1 0 1 |
79 |
print_info 3 "$(find . -print0 | xargs --null ls -ald)" 1 0 1 |
80 |
print_info 3 "=================================================================" 1 0 1 |
81 |
} |
82 |
|
83 |
diff --git a/worker_modules/gkbuild.sh b/worker_modules/gkbuild.sh |
84 |
index ea64a17..213597a 100644 |
85 |
--- a/worker_modules/gkbuild.sh |
86 |
+++ b/worker_modules/gkbuild.sh |
87 |
@@ -184,6 +184,13 @@ _gkbuild_main() { |
88 |
"${TAR_COMMAND}" -caf "${GKPKG_BINPKG}" . \ |
89 |
|| die "Failed to create binpkg of ${P} in '${GKPKG_BINPKG}'!" |
90 |
|
91 |
+ if [ -n "${DU_COMMAND}" ] |
92 |
+ then |
93 |
+ print_info 5 "Final size of build root: $(get_du "${BROOT}")" |
94 |
+ print_info 5 "Final size of build directory: $(get_du "${S}")" |
95 |
+ print_info 5 "Final size of installed tree: $(get_du "${D}")" |
96 |
+ fi |
97 |
+ |
98 |
cd "${TEMP}" || die "Failed to chdir to '${TEMP}'!" |
99 |
if [ ! -f "${TEMP}/.no_cleanup" ] |
100 |
then |