All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anisse Astier <anisse@astier.eu>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH RFC] core: enable per-package log files
Date: Tue, 17 Oct 2017 17:53:53 +0200	[thread overview]
Message-ID: <20171017155353.GB6368@bifrost> (raw)
In-Reply-To: <1508170801-31062-1-git-send-email-anisse@astier.eu>

On Mon, Oct 16, 2017 at 06:20:01PM +0200, Anisse Astier wrote:
> This includes a new support script that helps parsing *_CMDS recipes,
> ensuring everything is forwarded.
> 
> See also: http://repo.or.cz/buildroot-gz.git/commitdiff/833e8fa7c7437931f1356b5b03a6b3810a3db586
> Latest discussion: http://lists.busybox.net/pipermail/buildroot/2017-October/204159.html
> 
> Signed-off-by: Anisse Astier <anisse@astier.eu>
> ---
> 
> This is a proof of concept and does not log everything yet, but should work.
> 
> 
>  package/pkg-generic.mk             | 54 ++++++++++++++++++++--------------
>  support/scripts/recipe-forward-log | 59 ++++++++++++++++++++++++++++++++++++++
>  2 files changed, 91 insertions(+), 22 deletions(-)
>  create mode 100755 support/scripts/recipe-forward-log
> 
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index cca94ba..335e2be 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -137,6 +137,8 @@ endef
>  GLOBAL_INSTRUMENTATION_HOOKS += step_user
>  endif
>  
> +exportvar = $(eval export $(1))
> +
>  ################################################################################
>  # Implicit targets -- produce a stamp file for each step of a package build
>  ################################################################################
> @@ -166,12 +168,13 @@ $(BUILD_DIR)/%/.stamp_actual_downloaded:
>  $(BUILD_DIR)/%/.stamp_extracted:
>  	@$(call step_start,extract)
>  	@$(call MESSAGE,"Extracting")
> -	$(foreach hook,$($(PKG)_PRE_EXTRACT_HOOKS),$(call $(hook))$(sep))
> +	$(foreach hook,$($(PKG)_PRE_EXTRACT_HOOKS),$(call $(hook)) >> $($(PKG)_LOGFILE) 2>&1 $(sep))
>  	$(Q)mkdir -p $(@D)
> -	$($(PKG)_EXTRACT_CMDS)
> +	@$(call exportvar,$(PKG)_EXTRACT_CMDS)
> +	$(TOPDIR)/support/scripts/recipe-forward-log "$($(PKG)_LOGFILE)" "$$$(PKG)_EXTRACT_CMDS"
>  # some packages have messed up permissions inside
>  	$(Q)chmod -R +rw $(@D)
> -	$(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep))
> +	$(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook)) >> $($(PKG)_LOGFILE) 2>&1 $(sep))
>  	@$(call step_end,extract)
>  	$(Q)touch $@
>  
> @@ -223,9 +226,10 @@ $(foreach dir,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)),\
>  $(BUILD_DIR)/%/.stamp_configured:
>  	@$(call step_start,configure)
>  	@$(call MESSAGE,"Configuring")
> -	$(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
> -	$($(PKG)_CONFIGURE_CMDS)
> -	$(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep))
> +	$(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook)) >> $($(PKG)_LOGFILE) 2>&1 $(sep))
> +	@$(call exportvar,$(PKG)_CONFIGURE_CMDS)
> +	$(TOPDIR)/support/scripts/recipe-forward-log "$($(PKG)_LOGFILE)" "$$$(PKG)_CONFIGURE_CMDS"
> +	$(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook)) >> $($(PKG)_LOGFILE) 2>&1 $(sep))
>  	@$(call step_end,configure)
>  	$(Q)touch $@
>  
> @@ -233,9 +237,10 @@ $(BUILD_DIR)/%/.stamp_configured:
>  $(BUILD_DIR)/%/.stamp_built::
>  	@$(call step_start,build)
>  	@$(call MESSAGE,"Building")
> -	$(foreach hook,$($(PKG)_PRE_BUILD_HOOKS),$(call $(hook))$(sep))
> -	+$($(PKG)_BUILD_CMDS)
> -	$(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook))$(sep))
> +	$(foreach hook,$($(PKG)_PRE_BUILD_HOOKS),$(call $(hook)) >> $($(PKG)_LOGFILE) 2>&1 $(sep))
> +	@$(call exportvar,$(PKG)_BUILD_CMDS)
> +	+$(TOPDIR)/support/scripts/recipe-forward-log "$($(PKG)_LOGFILE)" "$$$(PKG)_BUILD_CMDS"
> +	$(foreach hook,$($(PKG)_POST_BUILD_HOOKS),$(call $(hook)) >> $($(PKG)_LOGFILE) 2>&1 $(sep))

Side-note: before this, every use of +$(PKG)_XXX_CMDS wouldn't use the
make jobserver feature for anything but the first command of a multiline
_CMDS variable. This is a small issue since $(MAKE) seems to be used in
all packages.

Regards,

Anisse

      parent reply	other threads:[~2017-10-17 15:53 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-11  8:58 [Buildroot] Discussion on per-package logging Thomas Petazzoni
2017-10-11  9:05 ` Arnout Vandecappelle
2017-10-11  9:55   ` Thomas Petazzoni
2017-10-11 13:08 ` Yann E. MORIN
2017-10-11 13:19   ` Thomas Petazzoni
2017-10-11 14:10     ` Yann E. MORIN
2017-10-16 16:20 ` [Buildroot] [PATCH RFC] core: enable per-package log files Anisse Astier
2017-10-16 16:23   ` Anisse Astier
2017-10-16 16:52   ` Thomas Petazzoni
2017-10-16 21:18     ` Anisse Astier
2017-10-17  7:11       ` Thomas Petazzoni
2017-10-17 12:01         ` Arnout Vandecappelle
2017-10-17 12:11           ` Thomas Petazzoni
2017-10-17 14:44             ` Arnout Vandecappelle
2017-10-17 19:03               ` Thomas Petazzoni
2017-10-17 23:11                 ` Arnout Vandecappelle
2017-10-18  6:57                   ` Thomas Petazzoni
2017-10-18  7:44                     ` Anisse Astier
2017-10-18  7:58                       ` Thomas Petazzoni
2017-10-18  8:09                         ` Anisse Astier
2017-10-18  8:11                           ` Thomas Petazzoni
2017-10-18  9:05                             ` Anisse Astier
2017-10-18  9:10                               ` Thomas Petazzoni
2017-10-18 10:54                                 ` Arnout Vandecappelle
2017-10-18 11:36                                   ` Thomas Petazzoni
2017-10-18 10:57                     ` Arnout Vandecappelle
2017-10-18 11:36                       ` Thomas Petazzoni
2017-10-18 17:42                         ` Yann E. MORIN
2017-10-17 15:45           ` Anisse Astier
2017-10-17 22:58             ` Arnout Vandecappelle
2017-10-18  6:53               ` Thomas Petazzoni
2017-10-18  7:34               ` Anisse Astier
2017-10-17 15:53   ` Anisse Astier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171017155353.GB6368@bifrost \
    --to=anisse@astier.eu \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.