Skip to contentSkip to conversation

Run post scripts referenced by relative paths

PATCH New Waldemar Rymarkiewicz 5 participants 10 messages Jan 28, 2014 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Run post scripts referenced by relative paths

This fix will let to run post scripts seamlessly while are referenced by relative paths. Scripts referenced by full path still works.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 067458b..ef7f4c2 100644
@@ -554,7 +554,7 @@ endif
 
 	@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
 		$(call MESSAGE,"Executing post-build script $(s)"); \
-		$(USER_HOOKS_EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
+		$(USER_HOOKS_EXTRA_ENV) $(abspath $(s)) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
 
 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
 LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
@@ -600,7 +600,7 @@ endif
 target-post-image:
 	@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
 		$(call MESSAGE,"Executing post-image script $(s)"); \
-		$(USER_HOOKS_EXTRA_ENV) $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
+		$(USER_HOOKS_EXTRA_ENV) $(abspath $(s)) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
 
 toolchain-eclipse-register:
 	./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 Run post scripts referenced by relative paths

Hi Waldemar, all

Quoted 31 lines · Waldemar Rymarkiewicz

This fix will let to run post scripts seamlessly while are referenced by relative paths. Scripts referenced by full path still works.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -3
index 067458b..ef7f4c2 100644
@@ -554,7 +554,7 @@ endif
 
        @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
                $(call MESSAGE,"Executing post-build script $(s)"); \
-               $(USER_HOOKS_EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
+               $(USER_HOOKS_EXTRA_ENV) $(abspath $(s)) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
 
 ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
 LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
@@ -600,7 +600,7 @@ endif
 target-post-image:
        @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
                $(call MESSAGE,"Executing post-image script $(s)"); \
-               $(USER_HOOKS_EXTRA_ENV) $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
+               $(USER_HOOKS_EXTRA_ENV) $(abspath $(s)) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
 
 toolchain-eclipse-register:
        ./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
--
Quoted 2 lines

1.8.3.2

I am not sure I fully get your patch, what is wrong with putting path/to/my_script.sh ? You don't have to specify the full path, a relative path works well.

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#2 lore raw

PATCH 1/1 Run post scripts referenced by relative paths

Hi

Quoted 4 lines
Quoted 1 line

I am not sure I fully get your patch, what is wrong with putting path/to/my_script.sh ? You don't have to specify the full path, a relative path works well.

Nothing is wrong to put full path to your scripts. Just a matter of what you prefer.

Try to put script file in buildroot directory and set the post script variable using just the name of the script. I does not work for me and I'm pretty sure it does not work for you as well. This is simply how Makefile calls the scripts.

This patch is just addition to run post scripts referenced by relative paths as well, nothing more.

Thanks,
/Waldek

#3 lore raw

PATCH 1/1 Run post scripts referenced by relative paths

Quoted 7 lines · Waldemar Rymarkiewicz

Hi

Quoted 4 lines
Quoted 1 line

I am not sure I fully get your patch, what is wrong with putting path/to/my_script.sh ? You don't have to specify the full path, a relative path works well.

Quoted 7 lines

Nothing is wrong to put full path to your scripts. Just a matter of what you prefer.

Try to put script file in buildroot directory and set the post script variable using just the name of the script. I does not work for me and I'm pretty sure it does not work for you as well. This is simply how Makefile calls the scripts.

Okay, I did not understood where the problem came from as I never put my scripts at the root but in a special directory inside buildroot boards folder so it never happened to me.
Thanks for the clarifications.

Quoted 6 lines

This patch is just addition to run post scripts referenced by relative paths as well, nothing more.

Thanks,
/Waldek

#4 lore raw

PATCH 1/1 Run post scripts referenced by relative paths

In reply to Waldemar Rymarkiewicz

Waldemar, All,

On 2014-01-28 11:50 +0100, Waldemar Rymarkiewicz spake thusly:

Quoted 7 lines
Quoted 3 lines

I am not sure I fully get your patch, what is wrong with putting path/to/my_script.sh ? You don't have to specify the full path, a relative path works well.

Nothing is wrong to put full path to your scripts. Just a matter of what you prefer.

Quoted 7 lines

Try to put script file in buildroot directory and set the post script variable using just the name of the script. I does not work for me and I'm pretty sure it does not work for you as well. This is simply how Makefile calls the scripts.

This patch is just addition to run post scripts referenced by relative paths as well, nothing more.

Why don't you just set:
BR2_ROOTFS_POST_BUILD_SCRIPT="./my-script ./my-second-script"

(Ditto for BR2_ROOTFS_POST_IMAGE_SCRIPT.)

I'd say, we don't need that change. I prefer the user be explixit about what he intends to do, rather than Buildroot guessing.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 1/1 Run post scripts referenced by relative paths

Dear Yann E. MORIN,

Quoted 16 lines · Yann E. MORIN

On 2014-01-28 11:50 +0100, Waldemar Rymarkiewicz spake thusly:

Quoted 7 lines
Quoted 3 lines

I am not sure I fully get your patch, what is wrong with putting path/to/my_script.sh ? You don't have to specify the full path, a relative path works well.

Nothing is wrong to put full path to your scripts. Just a matter of what you prefer.

Quoted 7 lines

Try to put script file in buildroot directory and set the post script variable using just the name of the script. I does not work for me and I'm pretty sure it does not work for you as well. This is simply how Makefile calls the scripts.

This patch is just addition to run post scripts referenced by relative paths as well, nothing more.

Quoted 7 lines

Why don't you just set:
BR2_ROOTFS_POST_BUILD_SCRIPT="./my-script ./my-second-script"

(Ditto for BR2_ROOTFS_POST_IMAGE_SCRIPT.)

I'd say, we don't need that change. I prefer the user be explixit about what he intends to do, rather than Buildroot guessing.

I agree.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

PATCH 1/1 Run post scripts referenced by relative paths

Hi,

Quoted 20 lines · Thomas Petazzoni

Dear Yann E. MORIN,

Quoted 16 lines · Yann E. MORIN

On 2014-01-28 11:50 +0100, Waldemar Rymarkiewicz spake thusly:

Quoted 14 lines
Quoted 3 lines

I am not sure I fully get your patch, what is wrong with putting path/to/my_script.sh ? You don't have to specify the full path, a relative path works well.

Nothing is wrong to put full path to your scripts. Just a matter of what you prefer.

Try to put script file in buildroot directory and set the post script variable using just the name of the script. I does not work for me and I'm pretty sure it does not work for you as well. This is simply how Makefile calls the scripts.
to
This patch is just addition to run post scripts referenced by relative paths as well, nothing more.

Quoted 8 lines
Quoted 6 lines

Why don't you just set:
BR2_ROOTFS_POST_BUILD_SCRIPT="./my-script ./my-second-script"
(Ditto for BR2_ROOTFS_POST_IMAGE_SCRIPT.

I'd say, we don't need that change. I prefer the user be explixit about what he intends to do, rather than Buildroot guessing.

I agree.

Let's leave it as it is now then.

The point was that neither manual nor menuconfig help explains how a script should be referenced. By full path, relative or what. In my case the easiest way was just to put "a space-separated list of scripts" as per help message and it does not work. For someone who is not dealing with buildroot frequently it can be an issue. Of course you can always use ./your_script, but still it's not explained anywhere. Abspath will fix it and it costs nothing, but I understand your way of thinking.

Thanks,
/Waldek

#7 lore raw

PATCH 1/1 Run post scripts referenced by relative paths

Dear Waldemar Rymarkiewicz,

Quoted 8 lines · Waldemar Rymarkiewicz

The point was that neither manual nor menuconfig help explains how a script should be referenced. By full path, relative or what. In my case the easiest way was just to put "a space-separated list of scripts" as per help message and it does not work. For someone who is not dealing with buildroot frequently it can be an issue. Of course you can always use ./your_script, but still it's not explained anywhere. Abspath will fix it and it costs nothing, but I understand your way of thinking.

Your patches to the documentation and/or the help text of the problematic Config.in options would definitely be welcome!

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#8 lore raw

PATCH 1/1 Run post scripts referenced by relative paths

In reply to Waldemar Rymarkiewicz

Waldemar, All,

On 2014-01-28 23:06 +0100, Waldemar Rymarkiewicz spake thusly:

Quoted 10 lines
Quoted 7 lines · Yann E. MORIN
Quoted 6 lines

Why don't you just set:
BR2_ROOTFS_POST_BUILD_SCRIPT="./my-script ./my-second-script"
(Ditto for BR2_ROOTFS_POST_IMAGE_SCRIPT.

I'd say, we don't need that change. I prefer the user be explixit about what he intends to do, rather than Buildroot guessing.

Let's leave it as it is now then.

Quoted 8 lines

The point was that neither manual nor menuconfig help explains how a script should be referenced. By full path, relative or what. In my case the easiest way was just to put "a space-separated list of scripts" as per help message and it does not work. For someone who is not dealing with buildroot frequently it can be an issue. Of course you can always use ./your_script, but still it's not explained anywhere. Abspath will fix it and it costs nothing, but I understand your way of thinking.

Ah, but then we are ready to accept a patch to the manual to fix this! ;-) The manual is located in docs/manual/ in your buildroot tree, FYI.

Your comment is prefectly valid, indeed, but would better be solved by fixing the manual instead.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#9 lore raw

PATCH 1/1 Run post scripts referenced by relative paths

In reply to Waldemar Rymarkiewicz
Quoted 2 lines · Waldemar Rymarkiewicz

This fix will let to run post scripts seamlessly while are referenced by relative paths. Scripts referenced by full path still works.

The commit message is wrong: relative paths work fine already, it is
only a post-script in the current directory (= the buildroot directory) that doesn't work.

Patch itself looks OK to me.

Regards,
Arnout

Quoted 29 lines
---
  Makefile | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 067458b..ef7f4c2 100644
@@ -554,7 +554,7 @@ endif
 
  	@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
  		$(call MESSAGE,"Executing post-build script $(s)"); \
-		$(USER_HOOKS_EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
+		$(USER_HOOKS_EXTRA_ENV) $(abspath $(s)) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
 
  ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
  LOCALE_WHITELIST=$(BUILD_DIR)/locales.nopurge
@@ -600,7 +600,7 @@ endif
  target-post-image:
  	@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
  		$(call MESSAGE,"Executing post-image script $(s)"); \
-		$(USER_HOOKS_EXTRA_ENV) $(s) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
+		$(USER_HOOKS_EXTRA_ENV) $(abspath $(s)) $(BINARIES_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
 
  toolchain-eclipse-register:
  	./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
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