Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3] infra: Add PRE_*_HOOKS for every step
@ 2014-03-27 23:42 Maxime Hadjinlian
  2014-03-27 23:43 ` Maxime Hadjinlian
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Hadjinlian @ 2014-03-27 23:42 UTC (permalink / raw)
  To: buildroot

Add PRE_*_HOOKS to all the different steps through which a package may go.

This will help avoid using POST_*_HOOKS to do tasks that should be done
in the PRE_*_HOOKS of the next step.
Otherwise, when the user would do a make foo-re<step>, this would not do
what was really intented, the POST_*_HOOK of the preceding step not
being executed.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---
Changes v2 -> v3
  - Fix a mis-match in the number of spaces used to indent (Yann E.
    Morin)
Changes v1 -> v2
  - Move the PRE_*_HOOKS after the message (Arnout Vandecappelle)
  - PRE_LEGAL_HOOKS executed even if condition is not met (Arnout Vandecappelle)
---
 docs/manual/adding-packages-hooks.txt | 17 +++++++++++++++++
 package/pkg-generic.mk                | 22 ++++++++++++++++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/docs/manual/adding-packages-hooks.txt b/docs/manual/adding-packages-hooks.txt
index d96c991..38d3e4a 100644
--- a/docs/manual/adding-packages-hooks.txt
+++ b/docs/manual/adding-packages-hooks.txt
@@ -14,17 +14,34 @@ of the package construction.
 
 The following hook points are available:
 
+* +LIBFOO_PRE_DOWNLOAD_HOOKS+
 * +LIBFOO_POST_DOWNLOAD_HOOKS+
+
+* +LIBFOO_PRE_EXTRACT_HOOKS+
 * +LIBFOO_POST_EXTRACT_HOOKS+
+
+* +LIBFOO_PRE_RSYNC_HOOKS+
 * +LIBFOO_POST_RSYNC_HOOKS+
+
 * +LIBFOO_PRE_PATCH_HOOKS+
 * +LIBFOO_POST_PATCH_HOOKS+
+
 * +LIBFOO_PRE_CONFIGURE_HOOKS+
 * +LIBFOO_POST_CONFIGURE_HOOKS+
+
+* +LIBFOO_PRE_BUILD_HOOKS+
 * +LIBFOO_POST_BUILD_HOOKS+
+
+* +LIBFOO_PRE_INSTALL_HOOKS+ (for host packages only)
 * +LIBFOO_POST_INSTALL_HOOKS+ (for host packages only)
+
+* +LIBFOO_PRE_INSTALL_STAGING_HOOKS+ (for target packages only)
 * +LIBFOO_POST_INSTALL_STAGING_HOOKS+ (for target packages only)
+
+* +LIBFOO_PRE_INSTALL_TARGET_HOOKS+ (for target packages only)
 * +LIBFOO_POST_INSTALL_TARGET_HOOKS+ (for target packages only)
+
+* +LIBFOO_PRE_LEGAL_INFO_HOOKS+
 * +LIBFOO_POST_LEGAL_INFO_HOOKS+
 
 These variables are 'lists' of variable names containing actions to be
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 555c3c2..9edcfbe 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -70,6 +70,7 @@ endif
 
 # Retrieve the archive
 $(BUILD_DIR)/%/.stamp_downloaded:
+	$(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 ifeq ($(DL_MODE),DOWNLOAD)
 # Only show the download message if it isn't already downloaded
 	$(Q)if test ! -e $(DL_DIR)/$($(PKG)_SOURCE); then \
@@ -101,6 +102,7 @@ endif
 $(BUILD_DIR)/%/.stamp_extracted:
 	@$(call step_start,extract)
 	@$(call MESSAGE,"Extracting")
+	$(foreach hook,$($(PKG)_PRE_EXTRACT_HOOKS),$(call $(hook))$(sep))
 	$(Q)mkdir -p $(@D)
 	$($(PKG)_EXTRACT_CMDS)
 # some packages have messed up permissions inside
@@ -114,6 +116,7 @@ $(BUILD_DIR)/%/.stamp_extracted:
 $(BUILD_DIR)/%/.stamp_rsynced:
 	@$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
 	@test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
+	$(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
 	rsync -au $(RSYNC_VCS_EXCLUSIONS) $(SRCDIR)/ $(@D)
 	$(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
@@ -162,8 +165,8 @@ $(BUILD_DIR)/%/.stamp_patched:
 # Configure
 $(BUILD_DIR)/%/.stamp_configured:
 	@$(call step_start,configure)
-	$(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
 	@$(call MESSAGE,"Configuring")
+	$(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
 	$($(PKG)_CONFIGURE_CMDS)
 	$(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
@@ -173,6 +176,7 @@ $(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))
 	$(Q)touch $@
@@ -182,6 +186,7 @@ $(BUILD_DIR)/%/.stamp_built::
 $(BUILD_DIR)/%/.stamp_host_installed:
 	@$(call step_start,install-host)
 	@$(call MESSAGE,"Installing to host directory")
+	$(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep))
 	$($(PKG)_INSTALL_CMDS)
 	$(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
@@ -191,6 +196,7 @@ $(BUILD_DIR)/%/.stamp_host_installed:
 $(BUILD_DIR)/%/.stamp_staging_installed:
 	@$(call step_start,install-staging)
 	@$(call MESSAGE,"Installing to staging directory")
+	$(foreach hook,$($(PKG)_PRE_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
 	$($(PKG)_INSTALL_STAGING_CMDS)
 	$(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
 	$(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
@@ -207,6 +213,7 @@ $(BUILD_DIR)/%/.stamp_staging_installed:
 $(BUILD_DIR)/%/.stamp_images_installed:
 	@$(call step_start,install-image)
 	@$(call MESSAGE,"Installing to images directory")
+	$(foreach hook,$($(PKG)_PRE_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
 	$($(PKG)_INSTALL_IMAGES_CMDS)
 	$(foreach hook,$($(PKG)_POST_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
@@ -216,6 +223,7 @@ $(BUILD_DIR)/%/.stamp_images_installed:
 $(BUILD_DIR)/%/.stamp_target_installed:
 	@$(call step_start,install-target)
 	@$(call MESSAGE,"Installing to target")
+	$(foreach hook,$($(PKG)_PRE_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
 	$(if $(BR2_INIT_SYSTEMD),\
 		$($(PKG)_INSTALL_INIT_SYSTEMD))
 	$(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
@@ -377,19 +385,28 @@ $(2)_EXTRACT_CMDS ?= \
 	$$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $(DL_DIR)/$$($(2)_SOURCE) | \
 	$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $$($(2)_DIR) $(TAR_OPTIONS) -)
 
-# post-steps hooks
+# pre/post-steps hooks
+$(2)_PRE_DOWNLOAD_HOOKS         ?=
 $(2)_POST_DOWNLOAD_HOOKS        ?=
+$(2)_PRE_EXTRACT_HOOKS          ?=
 $(2)_POST_EXTRACT_HOOKS         ?=
+$(2)_PRE_RSYNC_HOOKS            ?=
 $(2)_POST_RSYNC_HOOKS           ?=
 $(2)_PRE_PATCH_HOOKS            ?=
 $(2)_POST_PATCH_HOOKS           ?=
 $(2)_PRE_CONFIGURE_HOOKS        ?=
 $(2)_POST_CONFIGURE_HOOKS       ?=
+$(2)_PRE_BUILD_HOOKS            ?=
 $(2)_POST_BUILD_HOOKS           ?=
+$(2)_PRE_INSTALL_HOOKS          ?=
 $(2)_POST_INSTALL_HOOKS         ?=
+$(2)_PRE_INSTALL_STAGING_HOOKS  ?=
 $(2)_POST_INSTALL_STAGING_HOOKS ?=
+$(2)_PRE_INSTALL_TARGET_HOOKS   ?=
 $(2)_POST_INSTALL_TARGET_HOOKS  ?=
+$(2)_PRE_INSTALL_IMAGES_HOOKS   ?=
 $(2)_POST_INSTALL_IMAGES_HOOKS  ?=
+$(2)_PRE_LEGAL_INFO_HOOKS       ?=
 $(2)_POST_LEGAL_INFO_HOOKS      ?=
 
 # human-friendly targets and target sequencing
@@ -543,6 +560,7 @@ $(2)_MANIFEST_TARBALL ?= not saved
 # legal-info: produce legally relevant info.
 $(1)-legal-info:
 # Packages without a source are assumed to be part of Buildroot, skip them.
+	$(foreach hook,$($(2)_PRE_LEGAL_INFO_HOOKS),$(call $(hook))$(sep))
 ifneq ($(call qstrip,$$($(2)_SOURCE)),)
 
 ifeq ($$($(2)_SITE_METHOD),local)
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3] infra: Add PRE_*_HOOKS for every step
  2014-03-27 23:42 Maxime Hadjinlian
@ 2014-03-27 23:43 ` Maxime Hadjinlian
  0 siblings, 0 replies; 6+ messages in thread
From: Maxime Hadjinlian @ 2014-03-27 23:43 UTC (permalink / raw)
  To: buildroot

Hi all,

Forget this patch, I sent it from a bad branch that was not rebased on master.
I'll send a correct version later on.

Sorry for the noise.

On Fri, Mar 28, 2014 at 12:42 AM, Maxime Hadjinlian
<maxime.hadjinlian@gmail.com> wrote:
> Add PRE_*_HOOKS to all the different steps through which a package may go.
>
> This will help avoid using POST_*_HOOKS to do tasks that should be done
> in the PRE_*_HOOKS of the next step.
> Otherwise, when the user would do a make foo-re<step>, this would not do
> what was really intented, the POST_*_HOOK of the preceding step not
> being executed.
>
> Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
> ---
> Changes v2 -> v3
>   - Fix a mis-match in the number of spaces used to indent (Yann E.
>     Morin)
> Changes v1 -> v2
>   - Move the PRE_*_HOOKS after the message (Arnout Vandecappelle)
>   - PRE_LEGAL_HOOKS executed even if condition is not met (Arnout Vandecappelle)
> ---
>  docs/manual/adding-packages-hooks.txt | 17 +++++++++++++++++
>  package/pkg-generic.mk                | 22 ++++++++++++++++++++--
>  2 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/docs/manual/adding-packages-hooks.txt b/docs/manual/adding-packages-hooks.txt
> index d96c991..38d3e4a 100644
> --- a/docs/manual/adding-packages-hooks.txt
> +++ b/docs/manual/adding-packages-hooks.txt
> @@ -14,17 +14,34 @@ of the package construction.
>
>  The following hook points are available:
>
> +* +LIBFOO_PRE_DOWNLOAD_HOOKS+
>  * +LIBFOO_POST_DOWNLOAD_HOOKS+
> +
> +* +LIBFOO_PRE_EXTRACT_HOOKS+
>  * +LIBFOO_POST_EXTRACT_HOOKS+
> +
> +* +LIBFOO_PRE_RSYNC_HOOKS+
>  * +LIBFOO_POST_RSYNC_HOOKS+
> +
>  * +LIBFOO_PRE_PATCH_HOOKS+
>  * +LIBFOO_POST_PATCH_HOOKS+
> +
>  * +LIBFOO_PRE_CONFIGURE_HOOKS+
>  * +LIBFOO_POST_CONFIGURE_HOOKS+
> +
> +* +LIBFOO_PRE_BUILD_HOOKS+
>  * +LIBFOO_POST_BUILD_HOOKS+
> +
> +* +LIBFOO_PRE_INSTALL_HOOKS+ (for host packages only)
>  * +LIBFOO_POST_INSTALL_HOOKS+ (for host packages only)
> +
> +* +LIBFOO_PRE_INSTALL_STAGING_HOOKS+ (for target packages only)
>  * +LIBFOO_POST_INSTALL_STAGING_HOOKS+ (for target packages only)
> +
> +* +LIBFOO_PRE_INSTALL_TARGET_HOOKS+ (for target packages only)
>  * +LIBFOO_POST_INSTALL_TARGET_HOOKS+ (for target packages only)
> +
> +* +LIBFOO_PRE_LEGAL_INFO_HOOKS+
>  * +LIBFOO_POST_LEGAL_INFO_HOOKS+
>
>  These variables are 'lists' of variable names containing actions to be
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index 555c3c2..9edcfbe 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -70,6 +70,7 @@ endif
>
>  # Retrieve the archive
>  $(BUILD_DIR)/%/.stamp_downloaded:
> +       $(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
>  ifeq ($(DL_MODE),DOWNLOAD)
>  # Only show the download message if it isn't already downloaded
>         $(Q)if test ! -e $(DL_DIR)/$($(PKG)_SOURCE); then \
> @@ -101,6 +102,7 @@ endif
>  $(BUILD_DIR)/%/.stamp_extracted:
>         @$(call step_start,extract)
>         @$(call MESSAGE,"Extracting")
> +       $(foreach hook,$($(PKG)_PRE_EXTRACT_HOOKS),$(call $(hook))$(sep))
>         $(Q)mkdir -p $(@D)
>         $($(PKG)_EXTRACT_CMDS)
>  # some packages have messed up permissions inside
> @@ -114,6 +116,7 @@ $(BUILD_DIR)/%/.stamp_extracted:
>  $(BUILD_DIR)/%/.stamp_rsynced:
>         @$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
>         @test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
> +       $(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
>         rsync -au $(RSYNC_VCS_EXCLUSIONS) $(SRCDIR)/ $(@D)
>         $(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
>         $(Q)touch $@
> @@ -162,8 +165,8 @@ $(BUILD_DIR)/%/.stamp_patched:
>  # Configure
>  $(BUILD_DIR)/%/.stamp_configured:
>         @$(call step_start,configure)
> -       $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
>         @$(call MESSAGE,"Configuring")
> +       $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
>         $($(PKG)_CONFIGURE_CMDS)
>         $(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep))
>         $(Q)touch $@
> @@ -173,6 +176,7 @@ $(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))
>         $(Q)touch $@
> @@ -182,6 +186,7 @@ $(BUILD_DIR)/%/.stamp_built::
>  $(BUILD_DIR)/%/.stamp_host_installed:
>         @$(call step_start,install-host)
>         @$(call MESSAGE,"Installing to host directory")
> +       $(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep))
>         $($(PKG)_INSTALL_CMDS)
>         $(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep))
>         $(Q)touch $@
> @@ -191,6 +196,7 @@ $(BUILD_DIR)/%/.stamp_host_installed:
>  $(BUILD_DIR)/%/.stamp_staging_installed:
>         @$(call step_start,install-staging)
>         @$(call MESSAGE,"Installing to staging directory")
> +       $(foreach hook,$($(PKG)_PRE_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
>         $($(PKG)_INSTALL_STAGING_CMDS)
>         $(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
>         $(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
> @@ -207,6 +213,7 @@ $(BUILD_DIR)/%/.stamp_staging_installed:
>  $(BUILD_DIR)/%/.stamp_images_installed:
>         @$(call step_start,install-image)
>         @$(call MESSAGE,"Installing to images directory")
> +       $(foreach hook,$($(PKG)_PRE_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
>         $($(PKG)_INSTALL_IMAGES_CMDS)
>         $(foreach hook,$($(PKG)_POST_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
>         $(Q)touch $@
> @@ -216,6 +223,7 @@ $(BUILD_DIR)/%/.stamp_images_installed:
>  $(BUILD_DIR)/%/.stamp_target_installed:
>         @$(call step_start,install-target)
>         @$(call MESSAGE,"Installing to target")
> +       $(foreach hook,$($(PKG)_PRE_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
>         $(if $(BR2_INIT_SYSTEMD),\
>                 $($(PKG)_INSTALL_INIT_SYSTEMD))
>         $(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
> @@ -377,19 +385,28 @@ $(2)_EXTRACT_CMDS ?= \
>         $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $(DL_DIR)/$$($(2)_SOURCE) | \
>         $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $$($(2)_DIR) $(TAR_OPTIONS) -)
>
> -# post-steps hooks
> +# pre/post-steps hooks
> +$(2)_PRE_DOWNLOAD_HOOKS         ?=
>  $(2)_POST_DOWNLOAD_HOOKS        ?=
> +$(2)_PRE_EXTRACT_HOOKS          ?=
>  $(2)_POST_EXTRACT_HOOKS         ?=
> +$(2)_PRE_RSYNC_HOOKS            ?=
>  $(2)_POST_RSYNC_HOOKS           ?=
>  $(2)_PRE_PATCH_HOOKS            ?=
>  $(2)_POST_PATCH_HOOKS           ?=
>  $(2)_PRE_CONFIGURE_HOOKS        ?=
>  $(2)_POST_CONFIGURE_HOOKS       ?=
> +$(2)_PRE_BUILD_HOOKS            ?=
>  $(2)_POST_BUILD_HOOKS           ?=
> +$(2)_PRE_INSTALL_HOOKS          ?=
>  $(2)_POST_INSTALL_HOOKS         ?=
> +$(2)_PRE_INSTALL_STAGING_HOOKS  ?=
>  $(2)_POST_INSTALL_STAGING_HOOKS ?=
> +$(2)_PRE_INSTALL_TARGET_HOOKS   ?=
>  $(2)_POST_INSTALL_TARGET_HOOKS  ?=
> +$(2)_PRE_INSTALL_IMAGES_HOOKS   ?=
>  $(2)_POST_INSTALL_IMAGES_HOOKS  ?=
> +$(2)_PRE_LEGAL_INFO_HOOKS       ?=
>  $(2)_POST_LEGAL_INFO_HOOKS      ?=
>
>  # human-friendly targets and target sequencing
> @@ -543,6 +560,7 @@ $(2)_MANIFEST_TARBALL ?= not saved
>  # legal-info: produce legally relevant info.
>  $(1)-legal-info:
>  # Packages without a source are assumed to be part of Buildroot, skip them.
> +       $(foreach hook,$($(2)_PRE_LEGAL_INFO_HOOKS),$(call $(hook))$(sep))
>  ifneq ($(call qstrip,$$($(2)_SOURCE)),)
>
>  ifeq ($$($(2)_SITE_METHOD),local)
> --
> 1.9.0
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3] infra: Add PRE_*_HOOKS for every step
@ 2014-03-28 18:29 Maxime Hadjinlian
  2014-04-06 12:31 ` Thomas Petazzoni
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Hadjinlian @ 2014-03-28 18:29 UTC (permalink / raw)
  To: buildroot

Add PRE_*_HOOKS to all the different steps through which a package may go.

This will help avoid using POST_*_HOOKS to do tasks that should be done
in the PRE_*_HOOKS of the next step.
Otherwise, when the user would do a make foo-re<step>, this would not do
what was really intented, the POST_*_HOOK of the preceding step not
being executed.

Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com>
---
Changes v2 -> v3
  - Fix a mis-match in the number of spaces used to indent (Yann E.
    Morin)
Changes v1 -> v2
  - Move the PRE_*_HOOKS after the message (Arnout Vandecappelle)
  - PRE_LEGAL_HOOKS executed even if condition is not met (Arnout Vandecappelle)
---
 docs/manual/adding-packages-hooks.txt | 17 +++++++++++++++++
 package/pkg-generic.mk                | 22 ++++++++++++++++++++--
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/docs/manual/adding-packages-hooks.txt b/docs/manual/adding-packages-hooks.txt
index d96c991..38d3e4a 100644
--- a/docs/manual/adding-packages-hooks.txt
+++ b/docs/manual/adding-packages-hooks.txt
@@ -14,17 +14,34 @@ of the package construction.
 
 The following hook points are available:
 
+* +LIBFOO_PRE_DOWNLOAD_HOOKS+
 * +LIBFOO_POST_DOWNLOAD_HOOKS+
+
+* +LIBFOO_PRE_EXTRACT_HOOKS+
 * +LIBFOO_POST_EXTRACT_HOOKS+
+
+* +LIBFOO_PRE_RSYNC_HOOKS+
 * +LIBFOO_POST_RSYNC_HOOKS+
+
 * +LIBFOO_PRE_PATCH_HOOKS+
 * +LIBFOO_POST_PATCH_HOOKS+
+
 * +LIBFOO_PRE_CONFIGURE_HOOKS+
 * +LIBFOO_POST_CONFIGURE_HOOKS+
+
+* +LIBFOO_PRE_BUILD_HOOKS+
 * +LIBFOO_POST_BUILD_HOOKS+
+
+* +LIBFOO_PRE_INSTALL_HOOKS+ (for host packages only)
 * +LIBFOO_POST_INSTALL_HOOKS+ (for host packages only)
+
+* +LIBFOO_PRE_INSTALL_STAGING_HOOKS+ (for target packages only)
 * +LIBFOO_POST_INSTALL_STAGING_HOOKS+ (for target packages only)
+
+* +LIBFOO_PRE_INSTALL_TARGET_HOOKS+ (for target packages only)
 * +LIBFOO_POST_INSTALL_TARGET_HOOKS+ (for target packages only)
+
+* +LIBFOO_PRE_LEGAL_INFO_HOOKS+
 * +LIBFOO_POST_LEGAL_INFO_HOOKS+
 
 These variables are 'lists' of variable names containing actions to be
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 555c3c2..9edcfbe 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -70,6 +70,7 @@ endif
 
 # Retrieve the archive
 $(BUILD_DIR)/%/.stamp_downloaded:
+	$(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 ifeq ($(DL_MODE),DOWNLOAD)
 # Only show the download message if it isn't already downloaded
 	$(Q)if test ! -e $(DL_DIR)/$($(PKG)_SOURCE); then \
@@ -101,6 +102,7 @@ endif
 $(BUILD_DIR)/%/.stamp_extracted:
 	@$(call step_start,extract)
 	@$(call MESSAGE,"Extracting")
+	$(foreach hook,$($(PKG)_PRE_EXTRACT_HOOKS),$(call $(hook))$(sep))
 	$(Q)mkdir -p $(@D)
 	$($(PKG)_EXTRACT_CMDS)
 # some packages have messed up permissions inside
@@ -114,6 +116,7 @@ $(BUILD_DIR)/%/.stamp_extracted:
 $(BUILD_DIR)/%/.stamp_rsynced:
 	@$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
 	@test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
+	$(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
 	rsync -au $(RSYNC_VCS_EXCLUSIONS) $(SRCDIR)/ $(@D)
 	$(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
@@ -162,8 +165,8 @@ $(BUILD_DIR)/%/.stamp_patched:
 # Configure
 $(BUILD_DIR)/%/.stamp_configured:
 	@$(call step_start,configure)
-	$(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
 	@$(call MESSAGE,"Configuring")
+	$(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))
 	$($(PKG)_CONFIGURE_CMDS)
 	$(foreach hook,$($(PKG)_POST_CONFIGURE_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
@@ -173,6 +176,7 @@ $(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))
 	$(Q)touch $@
@@ -182,6 +186,7 @@ $(BUILD_DIR)/%/.stamp_built::
 $(BUILD_DIR)/%/.stamp_host_installed:
 	@$(call step_start,install-host)
 	@$(call MESSAGE,"Installing to host directory")
+	$(foreach hook,$($(PKG)_PRE_INSTALL_HOOKS),$(call $(hook))$(sep))
 	$($(PKG)_INSTALL_CMDS)
 	$(foreach hook,$($(PKG)_POST_INSTALL_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
@@ -191,6 +196,7 @@ $(BUILD_DIR)/%/.stamp_host_installed:
 $(BUILD_DIR)/%/.stamp_staging_installed:
 	@$(call step_start,install-staging)
 	@$(call MESSAGE,"Installing to staging directory")
+	$(foreach hook,$($(PKG)_PRE_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
 	$($(PKG)_INSTALL_STAGING_CMDS)
 	$(foreach hook,$($(PKG)_POST_INSTALL_STAGING_HOOKS),$(call $(hook))$(sep))
 	$(Q)if test -n "$($(PKG)_CONFIG_SCRIPTS)" ; then \
@@ -207,6 +213,7 @@ $(BUILD_DIR)/%/.stamp_staging_installed:
 $(BUILD_DIR)/%/.stamp_images_installed:
 	@$(call step_start,install-image)
 	@$(call MESSAGE,"Installing to images directory")
+	$(foreach hook,$($(PKG)_PRE_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
 	$($(PKG)_INSTALL_IMAGES_CMDS)
 	$(foreach hook,$($(PKG)_POST_INSTALL_IMAGES_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
@@ -216,6 +223,7 @@ $(BUILD_DIR)/%/.stamp_images_installed:
 $(BUILD_DIR)/%/.stamp_target_installed:
 	@$(call step_start,install-target)
 	@$(call MESSAGE,"Installing to target")
+	$(foreach hook,$($(PKG)_PRE_INSTALL_TARGET_HOOKS),$(call $(hook))$(sep))
 	$(if $(BR2_INIT_SYSTEMD),\
 		$($(PKG)_INSTALL_INIT_SYSTEMD))
 	$(if $(BR2_INIT_SYSV)$(BR2_INIT_BUSYBOX),\
@@ -377,19 +385,28 @@ $(2)_EXTRACT_CMDS ?= \
 	$$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE))) $(DL_DIR)/$$($(2)_SOURCE) | \
 	$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $$($(2)_DIR) $(TAR_OPTIONS) -)
 
-# post-steps hooks
+# pre/post-steps hooks
+$(2)_PRE_DOWNLOAD_HOOKS         ?=
 $(2)_POST_DOWNLOAD_HOOKS        ?=
+$(2)_PRE_EXTRACT_HOOKS          ?=
 $(2)_POST_EXTRACT_HOOKS         ?=
+$(2)_PRE_RSYNC_HOOKS            ?=
 $(2)_POST_RSYNC_HOOKS           ?=
 $(2)_PRE_PATCH_HOOKS            ?=
 $(2)_POST_PATCH_HOOKS           ?=
 $(2)_PRE_CONFIGURE_HOOKS        ?=
 $(2)_POST_CONFIGURE_HOOKS       ?=
+$(2)_PRE_BUILD_HOOKS            ?=
 $(2)_POST_BUILD_HOOKS           ?=
+$(2)_PRE_INSTALL_HOOKS          ?=
 $(2)_POST_INSTALL_HOOKS         ?=
+$(2)_PRE_INSTALL_STAGING_HOOKS  ?=
 $(2)_POST_INSTALL_STAGING_HOOKS ?=
+$(2)_PRE_INSTALL_TARGET_HOOKS   ?=
 $(2)_POST_INSTALL_TARGET_HOOKS  ?=
+$(2)_PRE_INSTALL_IMAGES_HOOKS   ?=
 $(2)_POST_INSTALL_IMAGES_HOOKS  ?=
+$(2)_PRE_LEGAL_INFO_HOOKS       ?=
 $(2)_POST_LEGAL_INFO_HOOKS      ?=
 
 # human-friendly targets and target sequencing
@@ -543,6 +560,7 @@ $(2)_MANIFEST_TARBALL ?= not saved
 # legal-info: produce legally relevant info.
 $(1)-legal-info:
 # Packages without a source are assumed to be part of Buildroot, skip them.
+	$(foreach hook,$($(2)_PRE_LEGAL_INFO_HOOKS),$(call $(hook))$(sep))
 ifneq ($(call qstrip,$$($(2)_SOURCE)),)
 
 ifeq ($$($(2)_SITE_METHOD),local)
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3] infra: Add PRE_*_HOOKS for every step
  2014-03-28 18:29 [Buildroot] [PATCH v3] infra: Add PRE_*_HOOKS for every step Maxime Hadjinlian
@ 2014-04-06 12:31 ` Thomas Petazzoni
  2014-04-07 21:48   ` Luca Ceresoli
  2014-04-07 21:56   ` Yann E. MORIN
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2014-04-06 12:31 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 28 Mar 2014 19:29:32 +0100, Maxime Hadjinlian wrote:

> +* +LIBFOO_PRE_LEGAL_INFO_HOOKS+
>  * +LIBFOO_POST_LEGAL_INFO_HOOKS+

I'm generally fine with the patch, but I'm wondering what's the
usefulness of the legal-info hooks. I know you're merely adding a
pre-hook to match an existing post-hook, but I'm wondering what would
be the usage of a post-legal-info hook actually.

Luca?

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3] infra: Add PRE_*_HOOKS for every step
  2014-04-06 12:31 ` Thomas Petazzoni
@ 2014-04-07 21:48   ` Luca Ceresoli
  2014-04-07 21:56   ` Yann E. MORIN
  1 sibling, 0 replies; 6+ messages in thread
From: Luca Ceresoli @ 2014-04-07 21:48 UTC (permalink / raw)
  To: buildroot

Hi Thomas,

Thomas Petazzoni wrote:
> Hello,
>
> On Fri, 28 Mar 2014 19:29:32 +0100, Maxime Hadjinlian wrote:
>
>> +* +LIBFOO_PRE_LEGAL_INFO_HOOKS+
>>   * +LIBFOO_POST_LEGAL_INFO_HOOKS+
>
> I'm generally fine with the patch, but I'm wondering what's the
> usefulness of the legal-info hooks. I know you're merely adding a
> pre-hook to match an existing post-hook, but I'm wondering what would
> be the usage of a post-legal-info hook actually.
>
> Luca?

Maybe some mysterious package wants to save some additional files in the
sources directory, or anything even more strange...?
No, I can't really think of anything sound.

OTOH having pre- and post-hooks for all steps /except one/ does not look
very polished, and I think the effort to maintain an unused hook is
minimal.

So I would keep Maxime's patch as-is, unless there is a solid
reason to do otherwise.

-- 
Luca

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v3] infra: Add PRE_*_HOOKS for every step
  2014-04-06 12:31 ` Thomas Petazzoni
  2014-04-07 21:48   ` Luca Ceresoli
@ 2014-04-07 21:56   ` Yann E. MORIN
  1 sibling, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2014-04-07 21:56 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2014-04-06 14:31 +0200, Thomas Petazzoni spake thusly:
> On Fri, 28 Mar 2014 19:29:32 +0100, Maxime Hadjinlian wrote:
> 
> > +* +LIBFOO_PRE_LEGAL_INFO_HOOKS+
> >  * +LIBFOO_POST_LEGAL_INFO_HOOKS+
> 
> I'm generally fine with the patch, but I'm wondering what's the
> usefulness of the legal-info hooks. I know you're merely adding a
> pre-hook to match an existing post-hook, but I'm wondering what would
> be the usage of a post-legal-info hook actually.

I can think of an example where it would be needed: the freescale imx6
binary blobs for the GPU. There is a license text in the auto-extract
archive, but we do not save it for now (because "that's just too much
effort.")

Adding a pre-legal hook could be useful to extract the license from the
archive, for example.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-07 21:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-28 18:29 [Buildroot] [PATCH v3] infra: Add PRE_*_HOOKS for every step Maxime Hadjinlian
2014-04-06 12:31 ` Thomas Petazzoni
2014-04-07 21:48   ` Luca Ceresoli
2014-04-07 21:56   ` Yann E. MORIN
  -- strict thread matches above, loose matches on Subject: below --
2014-03-27 23:42 Maxime Hadjinlian
2014-03-27 23:43 ` Maxime Hadjinlian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox