Skip to contentSkip to conversation

buildroot: Add POST_RSYNC_HOOKS support

PATCH Superseded Tzu-Jung Lee 3 participants 4 messages Jul 27, 2013 – Aug 12, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buildroot: Add POST_RSYNC_HOOKS support

One of the use cases is for the 'local packages' to restore the SCM info. Some packages use this information to generate version info during build time. In this case, the local package can have this hook to restore it by symbolic link for example.

---
 package/pkg-generic.mk | 1 +
 1 file changed, 1 insertion(+)
package/pkg-generic.mk +1 -0
index d9a12f2..06e865d 100644
@@ -63,6 +63,7 @@ $(BUILD_DIR)/%/.stamp_rsynced:
 	@$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
 	@test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
 	rsync -au --cvs-exclude --include core $(SRCDIR)/ $(@D)
+	$(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
 
 # Handle the SOURCE_CHECK and SHOW_EXTERNAL_DEPS cases for rsynced
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 buildroot: Add POST_RSYNC_HOOKS support

Hi Tzu-Jung Lee,

Quoted 15 lines · Tzu-Jung Lee

One of the use cases is for the 'local packages' to restore the SCM info. Some packages use this information to generate version info during build time. In this case, the local package can have this hook to restore it by symbolic link for example.

---
 package/pkg-generic.mk | 1 +
 1 file changed, 1 insertion(+)
package/pkg-generic.mk +0 -0
index d9a12f2..06e865d 100644

package/pkg-generic.mk $(BUILD_DIR)/%/.stamp_rsynced: · line 69

Quoted 7 lines
package/pkg-generic.mk +1 -0
@@ -63,6 +63,7 @@ $(BUILD_DIR)/%/.stamp_rsynced:
        @$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
        @test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
        rsync -au --cvs-exclude --include core $(SRCDIR)/ $(@D)
+       $(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
        $(Q)touch $@
 
 # Handle the SOURCE_CHECK and SHOW_EXTERNAL_DEPS cases for rsynced

I think you should update the documentation to mention this hook.

Also, further in pkg-generic.mk is a list of all hooks defaulting to empty. You should add the new POST_RSYNC_HOOK there as well.

Best regards,
Thomas

#2 lore raw

PATCH v2 1/1 buildroot: Add POST_RSYNC_HOOKS support

One of the use cases is for the 'local packages' to restore the SCM info. Some packages use this information to generate version info during build time. In this case, the local package can have this hook to restore it by symbolic link for example.

---
Include the comments aginst v1 from Thomas De Schampheleire:

Updte manual for the new hook.
Set the default hook to empty

 docs/manual/adding-packages-generic.txt | 1 +
 package/pkg-generic.mk                  | 2 ++
 2 files changed, 3 insertions(+)
docs/manual/adding-packages-generic.txt +1 -0
index faf70b1..2889add 100644
@@ -441,6 +441,7 @@ The following hook points are available:
 
 * +LIBFOO_POST_DOWNLOAD_HOOKS+
 * +LIBFOO_POST_EXTRACT_HOOKS+
+* +LIBFOO_POST_RSYNC_HOOKS+
 * +LIBFOO_PRE_PATCH_HOOKS+
 * +LIBFOO_POST_PATCH_HOOKS+
 * +LIBFOO_PRE_CONFIGURE_HOOKS+
package/pkg-generic.mk +2 -0
index d9a12f2..3d3adc9 100644
@@ -63,6 +63,7 @@ $(BUILD_DIR)/%/.stamp_rsynced:
 	@$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
 	@test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
 	rsync -au --cvs-exclude --include core $(SRCDIR)/ $(@D)
+	$(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
 
 # Handle the SOURCE_CHECK and SHOW_EXTERNAL_DEPS cases for rsynced
@@ -337,6 +338,7 @@ $(2)_EXTRACT_CMDS ?= \
 # post-steps hooks
 $(2)_POST_DOWNLOAD_HOOKS        ?=
 $(2)_POST_EXTRACT_HOOKS         ?=
+$(2)_POST_RSYNC_HOOKS           ?=
 $(2)_PRE_PATCH_HOOKS            ?=
 $(2)_POST_PATCH_HOOKS           ?=
 $(2)_PRE_CONFIGURE_HOOKS        ?=
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH v2 1/1 buildroot: Add POST_RSYNC_HOOKS support

Quoted 6 lines · Tzu-Jung Lee

One of the use cases is for the 'local packages' to restore the SCM info. Some packages use this information to generate version info during build time. In this case, the local package can have this hook to restore it by symbolic link for example.

Although IMHO it's a bit of a hack to use it for that specific use
case. That use case would be better served with

rsync -au --cvs-exclude --include core $($(PKG)_RSYNC_OPTS) $(SRCDIR)/ $(@D)

(note that it is possible to set FOO_RSYNC_OPTS in the override file).

Regards,
Arnout

Quoted 43 lines

---
Include the comments aginst v1 from Thomas De Schampheleire:

Updte manual for the new hook.
Set the default hook to empty

  docs/manual/adding-packages-generic.txt | 1 +
  package/pkg-generic.mk                  | 2 ++
  2 files changed, 3 insertions(+)
docs/manual/adding-packages-generic.txt +1 -0
index faf70b1..2889add 100644
@@ -441,6 +441,7 @@ The following hook points are available:
 
  * +LIBFOO_POST_DOWNLOAD_HOOKS+
  * +LIBFOO_POST_EXTRACT_HOOKS+
+* +LIBFOO_POST_RSYNC_HOOKS+
  * +LIBFOO_PRE_PATCH_HOOKS+
  * +LIBFOO_POST_PATCH_HOOKS+
  * +LIBFOO_PRE_CONFIGURE_HOOKS+
package/pkg-generic.mk +2 -0
index d9a12f2..3d3adc9 100644
@@ -63,6 +63,7 @@ $(BUILD_DIR)/%/.stamp_rsynced:
  	@$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
  	@test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
  	rsync -au --cvs-exclude --include core $(SRCDIR)/ $(@D)
+	$(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
  	$(Q)touch $@
 
  # Handle the SOURCE_CHECK and SHOW_EXTERNAL_DEPS cases for rsynced
@@ -337,6 +338,7 @@ $(2)_EXTRACT_CMDS ?= \
  # post-steps hooks
  $(2)_POST_DOWNLOAD_HOOKS        ?=
  $(2)_POST_EXTRACT_HOOKS         ?=
+$(2)_POST_RSYNC_HOOKS           ?=
  $(2)_PRE_PATCH_HOOKS            ?=
  $(2)_POST_PATCH_HOOKS           ?=
  $(2)_PRE_CONFIGURE_HOOKS        ?=
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F