From patchwork Sat Oct 28 15:30:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 831615 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I2QuGqcl"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yPPpr09Cxz9t2M for ; Sun, 29 Oct 2017 02:31:15 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id EFB1D89ECD; Sat, 28 Oct 2017 15:31:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rHu4e7k2HDoI; Sat, 28 Oct 2017 15:31:12 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 9765489EDD; Sat, 28 Oct 2017 15:31:12 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 716171C26AC for ; Sat, 28 Oct 2017 15:31:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6D65F8A1B2 for ; Sat, 28 Oct 2017 15:31:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lBXkdd8tuwSH for ; Sat, 28 Oct 2017 15:31:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by hemlock.osuosl.org (Postfix) with ESMTPS id A5E558A1B7 for ; Sat, 28 Oct 2017 15:31:07 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id l8so8551148wre.12 for ; Sat, 28 Oct 2017 08:31:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=aUDMBW3+nx3MF3UgWueTTtIZPBUNJ/Hy/o9N2lwm2Lk=; b=I2QuGqclgKHtcIhqnsvzyObQgM3GV4MQ6wphvDjpj6HpLqChYDr7aiLQMh6OliGq8P ekTbCAVbEre92PswkyuXtWDhMzeruFGorezPjfow1vjJITL8cqH2Nwe0vKUthPIfoQJ7 siPN/H/DxmWVJw3HpDcSEcbTGLMa0dRT8UyIAK69S0hinID7Eku1tv9ku7vmZs8ah2KD BRFPAzzXLESLOh4l6KdFbRaE/SvobTTCgDhMQ5yaFFG+DCoNY6cGiCnaIRPOnTgqFZ+O PeQne6nYOEM4r1rphrN6Oc8hKj+HFpE3GjgzG4tyWJQuSe2XiQuQziRN+q6WwJy1GrjG 8FCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=aUDMBW3+nx3MF3UgWueTTtIZPBUNJ/Hy/o9N2lwm2Lk=; b=mmw9qRivzNv4OTZkuPUHNbr6D04oM7jZBApeFLeNzEUaqajNFxozKnGkOrdzGHDFSM CDeQu9t+edAQed+HtpJpiwspDYBLxnlSQZxZJ1aYoxFwUBO719vyPUOL54v6ocWDzY0l 8GfhGZpHoEhY5+BeSkyBfGhCLS0Gl2hvZZoKHWL6QD9eIOwamxAI8nm+hPG0K9zUQSLr /TaKIYhzPq9NlfMLwG2+V5FU95vA24XU9YClFtCT9lBenaNGa/vmjmz2wHgWQbD8m01c DNeIOdD+f4bcLO1sfKSoUwRoGxHBgh6FnKUZoI4oDDY9kW4huOGdVGzPm8nujXX8GNI7 Tvpw== X-Gm-Message-State: AMCzsaUd2ysCNKF1VW9ALBHVasUnSycTsNWM5hGvLNPuh65KbKD7m0E3 epsm910QgVcjrYHdoIz7QpYmBA== X-Google-Smtp-Source: ABhQp+SZdWx4OELQOqcoyTR5NCN4+hx8BRpp0qB9YORQRjkhQ9esvfrikI7QK1g2BHwCL7rjaLRMvg== X-Received: by 10.223.195.110 with SMTP id e43mr3066469wrg.219.1509204665778; Sat, 28 Oct 2017 08:31:05 -0700 (PDT) Received: from localhost.localdomain (2a01cb088610730050af6d1c2df0d987.ipv6.abo.wanadoo.fr. [2a01:cb08:8610:7300:50af:6d1c:2df0:d987]) by smtp.gmail.com with ESMTPSA id o11sm9848932wrg.5.2017.10.28.08.31.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Oct 2017 08:31:04 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sat, 28 Oct 2017 17:30:58 +0200 Message-Id: <31dc17f2b1318c61f33d73e86fea48f38698360f.1509204637.git.yann.morin.1998@free.fr> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: Cc: Thomas Petazzoni , "Yann E. MORIN" Subject: [Buildroot] [PATCH 3/4 v3] core/pkg-generic: store file->package list for staging and host too X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 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" Currently, we store the list of files installed in target/ and associate each of them to the package that installed it. However, we sometime may need to know what package installed which file in staging/, for example to debug header collision, or in host/, to debug what package installed what host tool. Enhance the step instrumentation to also generate the list for staging/ and host/. We maintain backward compatibility, for external script that wanted to parse the previously existing list, by not renaming the target-related package list. Only the staging- and host-related lists are named after staging and host. Signed-off-by: "Yann E. MORIN" Cc: Thomas Petazzoni --- package/pkg-generic.mk | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 0baab661c7..e50fad906c 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -58,7 +58,7 @@ GLOBAL_INSTRUMENTATION_HOOKS += step_time # Hooks to collect statistics about installed files define _step_pkg_size_get_file_list - (cd $(TARGET_DIR) ; \ + (cd $(2) ; \ ( \ find . -xtype f -print0 | xargs -0 md5sum ; \ find . -xtype d -print0 | xargs -0 -I{} printf 'directory {}\n'; \ @@ -66,32 +66,44 @@ define _step_pkg_size_get_file_list ) | 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. +# This hook will be called before the installation of a package. We store in +# a file named .br_filelist_before the list of files currently installed. +# Note that the MD5 is also stored, in order to identify if the files are +# overwritten. +# $(1): package name (ignored) +# $(2): base directory to search in define step_pkg_size_start - $(call _step_pkg_size_get_file_list,$($(PKG)_DIR)/.br_filelist_before) + $(call _step_pkg_size_get_file_list,$($(PKG)_DIR)/.br_filelist_before,$(2)) endef -# This hook will be called after the target installation of a -# package. We store in a file named .br_filelist_after the list of -# files (and their MD5) currently installed in the target. We then do -# a diff with the .br_filelist_before to compute the list of files -# installed by this package. +# This hook will be called after the installation of a package. We store in +# a file named .br_filelist_after the list of files (and their MD5) currently +# installed. We then do a diff with the .br_filelist_before to compute the +# list of files installed by this package. +# The suffix is typically for the target variant, for legacy backward +# compatibility. +# $(1): package name (ignored) +# $(2): base directory to search in +# $(3): suffix of file (optional) define step_pkg_size_end - $(call _step_pkg_size_get_file_list,$($(PKG)_DIR)/.br_filelist_after) + $(call _step_pkg_size_get_file_list,$($(PKG)_DIR)/.br_filelist_after,$(2)) comm -13 $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_filelist_after | \ while read hash file ; do \ echo "$(1),$${file}" ; \ - done >> $(BUILD_DIR)/packages-file-list.txt + done >> $(BUILD_DIR)/packages-file-list$(3).txt rm -f $($(PKG)_DIR)/.br_filelist_before $($(PKG)_DIR)/.br_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)))) + $(if $(filter start,$(1)),$(call step_pkg_size_start,$(3),$(TARGET_DIR))) \ + $(if $(filter end,$(1)),$(call step_pkg_size_end,$(3),$(TARGET_DIR)))) + $(if $(filter install-staging,$(2)),\ + $(if $(filter start,$(1)),$(call step_pkg_size_start,$(3),$(STAGING_DIR),-staging)) \ + $(if $(filter end,$(1)),$(call step_pkg_size_end,$(3),$(STAGING_DIR),-staging))) + $(if $(filter install-host,$(2)),\ + $(if $(filter start,$(1)),$(call step_pkg_size_start,$(3),$(HOST_DIR),-host)) \ + $(if $(filter end,$(1)),$(call step_pkg_size_end,$(3),$(HOST_DIR),-host))) endef GLOBAL_INSTRUMENTATION_HOOKS += step_pkg_size