From patchwork Sat Jun 7 21:46:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 357161 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id ADB881400AB for ; Sun, 8 Jun 2014 07:46:20 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B09D08BFA9; Sat, 7 Jun 2014 21:46:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z329giSJ6jBf; Sat, 7 Jun 2014 21:46:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 90E748BF83; Sat, 7 Jun 2014 21:46:16 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 8D65B1BF9D3 for ; Sat, 7 Jun 2014 21:46:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 859748BEBF for ; Sat, 7 Jun 2014 21:46:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CIJmgTzDy0G5 for ; Sat, 7 Jun 2014 21:46:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (top.free-electrons.com [176.31.233.9]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9CFDD8B630 for ; Sat, 7 Jun 2014 21:46:12 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id B1E6291E; Sat, 7 Jun 2014 23:46:13 +0200 (CEST) Received: from localhost (81.89.92.92.rev.sfr.net [92.92.89.81]) by mail.free-electrons.com (Postfix) with ESMTPSA id 26F167AC; Sat, 7 Jun 2014 23:46:13 +0200 (CEST) From: Thomas Petazzoni To: buildroot@uclibc.org Date: Sat, 7 Jun 2014 23:46:05 +0200 Message-Id: <1402177567-8021-3-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1402177567-8021-1-git-send-email-thomas.petazzoni@free-electrons.com> References: <1402177567-8021-1-git-send-email-thomas.petazzoni@free-electrons.com> Cc: Thomas Petazzoni Subject: [Buildroot] [RFCv1 2/4] pkg-generic: add step_pkg_size global instrumentation hook X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net This patch adds a global instrumentation hook that collects the list of files installed in $(TARGET_DIR) by each package, and stores this list into a file called $(BUILD_DIR)/.filelist. It can later be used to determine the size contribution of each package to the target root filesystem. The only limitation is that if a file is installed by a package A, and then overriden by a file from package B, the file will only be listed in $(BUILD_DIR)/A.filelist as it is the first time we will see the file. Signed-off-by: Thomas Petazzoni --- package/pkg-generic.mk | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 5116ed9..069653e 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -55,6 +55,30 @@ define step_time endef GLOBAL_INSTRUMENTATION_HOOKS += step_time +# Package size steps +define step_pkg_size_start + echo "PKG SIZE START $(1)" + (cd $(TARGET_DIR) ; find . -type f) | sort > \ + $(BUILD_DIR)/$(1).tmp_filelist_before +endef + +define step_pkg_size_end + echo "PKG SIZE END $(1)" + (cd $(TARGET_DIR); find . -type f) | sort > \ + $(BUILD_DIR)/$(1).tmp_filelist_after + diff -u $(BUILD_DIR)/$(1).tmp_filelist_before $(BUILD_DIR)/$(1).tmp_filelist_after | \ + grep '^\+\./' | sed 's%^\+%%' > $(BUILD_DIR)/$(1).filelist + $(RM) -f $(BUILD_DIR)/$(1).tmp_filelist_before \ + $(BUILD_DIR)/$(1).tmp_filelist_after +endef + +define step_pkg_size + $(if $(filter install-target,$(2)),\ + $(if $(filter start,$(1)),$(call step_pkg_size_start,$(3))) \ + $(if $(filter end,$(1)),$(call step_pkg_size_end,$(3)))) +endef +GLOBAL_INSTRUMENTATION_HOOKS += step_pkg_size + # User-supplied script define step_user @$(foreach user_hook, $(BR2_INSTRUMENTATION_SCRIPTS), \