summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas De Schampheleire <thomas.de_schampheleire@nokia.com>2017-02-05 14:45:06 +0100
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>2017-08-03 00:16:41 +0200
commita7ec12543f5312d3cd60c692f8f56f89af700d4d (patch)
treef76b1f9d87d6bc6a91e5d288840b64274a3ca685
parent4073fd0377c0df1941550a24191000afcf4ee63b (diff)
downloadbuildroot-a7ec12543f5312d3cd60c692f8f56f89af700d4d.tar.gz
buildroot-a7ec12543f5312d3cd60c692f8f56f89af700d4d.zip
instrumentation: extract duplication to get list of installed files
Before and after the building of each package, the instrumentation hooks are run. One of these hooks obtains the list of files installed by a package. The code to obtain this list is currently duplicated in the start and end part of the hook. While the amount of duplication is currently small, a subsequent patch will make more changes to this code, increasing the duplication. Therefore, split off into a helper function. Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
-rw-r--r--package/pkg-generic.mk11
1 files changed, 7 insertions, 4 deletions
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index ae03051987..f8117dbab6 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -57,13 +57,17 @@ GLOBAL_INSTRUMENTATION_HOOKS += step_time
# Hooks to collect statistics about installed files
+define _step_pkg_size_get_file_list
+ (cd $(TARGET_DIR) ; find . -type f -print0 | xargs -0 md5sum) | sort > \
+ $1
+endef
+
# This hook will be called before the target installation of a
# package. We store in a file named .br_filelist_before the list of
# files currently installed in the target. Note that the MD5 is also
# stored, in order to identify if the files are overwritten.
define step_pkg_size_start
- (cd $(TARGET_DIR) ; find . -type f -print0 | xargs -0 md5sum) | sort > \
- $($(PKG)_DIR)/.br_filelist_before
+ $(call _step_pkg_size_get_file_list,$($(PKG)_DIR)/.br_filelist_before)
endef
# This hook will be called after the target installation of a
@@ -72,8 +76,7 @@ endef
# a diff with the .br_filelist_before to compute the list of files
# installed by this package.
define step_pkg_size_end
- (cd $(TARGET_DIR); find . -type f -print0 | xargs -0 md5sum) | sort > \
- $($(PKG)_DIR)/.br_filelist_after
+ $(call _step_pkg_size_get_file_list,$($(PKG)_DIR)/.br_filelist_after)
comm -13 $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after | \
while read hash file ; do \
echo "$(1),$${file}" >> $(BUILD_DIR)/packages-file-list.txt ; \
OpenPOWER on IntegriCloud