Skip to contentSkip to conversation

fs/common.mk: move BR2_ROOTFS_POST_FAKEROOT_SCRIPT after pre cmd hooks

PATCH New Charles Hardin 3 participants 5 messages Sep 11, 2020 – Oct 2, 2020 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/common.mk: move BR2_ROOTFS_POST_FAKEROOT_SCRIPT after pre cmd hooks

From: Charles Hardin <[email protected]>

The fakeroot script does not appear to be used in any of the checked in defconfig targets, but it seems that most often the post fakeroot script should be done after all the packages rules have been applied instead of before.

Given that a change in systemd moved the SYSTEMD_PRESET_ALL hook to a ROOTFS_PRE_CMD_HOOKS, there was no way to use a FAKEROOT script to disable a service or fixup a systemd configuration. The systemd move makes sense, and this just tries to preserve the same ability to fixup a rootfs after all the cmd hooks are processed.

Refer to commit 65b63785a642bbc565924edf365b5d7c080f961c for the change that instigated this reordering.

---
 fs/common.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/common.mk +2 -2
index ec6aa831d1..84e13d1b7e 100644
@@ -173,11 +173,11 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)
 	echo "chown -h -R 0:0 $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
 	PATH=$$(BR_PATH) $$(TOPDIR)/support/scripts/mkusers $$(ROOTFS_FULL_USERS_TABLE) $$(TARGET_DIR) >> $$(FAKEROOT_SCRIPT)
 	echo "$$(HOST_DIR)/bin/makedevs -d $$(ROOTFS_FULL_DEVICES_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
+	$$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\
+		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
 	$$(foreach s,$$(call qstrip,$$(BR2_ROOTFS_POST_FAKEROOT_SCRIPT)),\
 		echo "echo '$$(TERM_BOLD)>>>   Executing fakeroot script $$(s)$$(TERM_RESET)'" >> $$(FAKEROOT_SCRIPT); \
 		echo $$(EXTRA_ENV) $$(s) $$(TARGET_DIR) $$(BR2_ROOTFS_POST_SCRIPT_ARGS) >> $$(FAKEROOT_SCRIPT)$$(sep))
-	$$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\
-		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
 
 	$$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),\
 		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
Signature · 1 line
2.21.1 (Apple Git-122.3)
#1 lore raw

PATCH 1/1 fs/common.mk: move BR2_ROOTFS_POST_FAKEROOT_SCRIPT after pre cmd hooks

Charles, All,

On 2020-09-10 17:30 -0700, Charles Hardin spake thusly:

Quoted 13 lines

From: Charles Hardin <[email protected]>

The fakeroot script does not appear to be used in any of the checked in defconfig targets, but it seems that most often the post fakeroot script should be done after all the packages rules have been applied instead of before.

Given that a change in systemd moved the SYSTEMD_PRESET_ALL hook to a ROOTFS_PRE_CMD_HOOKS, there was no way to use a FAKEROOT script to disable a service or fixup a systemd configuration. The systemd move makes sense, and this just tries to preserve the same ability to fixup a rootfs after all the cmd hooks are processed.

Quoted 4 lines

Refer to commit 65b63785a642bbc565924edf365b5d7c080f961c for the change that instigated this reordering.

Did you verify that our run-time testing still works:

support/testing/tests/core/test_post_scripts.py

which can be tested with:

    ./support/testing/run-tests \
        -o /path/to/where/you/want/temp/stuff \
        -d /path/to/BR2_DL_DIR \
        -k \
        tests.core.test_post_scripts

Otherwise, this change does make sense, because we do want to allow users to be able to override the internal decisions.

Regards,
Yann E. MORIN.

Quoted 22 lines
---
 fs/common.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/common.mk +2 -2
index ec6aa831d1..84e13d1b7e 100644
@@ -173,11 +173,11 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)
 	echo "chown -h -R 0:0 $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
 	PATH=$$(BR_PATH) $$(TOPDIR)/support/scripts/mkusers $$(ROOTFS_FULL_USERS_TABLE) $$(TARGET_DIR) >> $$(FAKEROOT_SCRIPT)
 	echo "$$(HOST_DIR)/bin/makedevs -d $$(ROOTFS_FULL_DEVICES_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
+	$$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\
+		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
 	$$(foreach s,$$(call qstrip,$$(BR2_ROOTFS_POST_FAKEROOT_SCRIPT)),\
 		echo "echo '$$(TERM_BOLD)>>>   Executing fakeroot script $$(s)$$(TERM_RESET)'" >> $$(FAKEROOT_SCRIPT); \
 		echo $$(EXTRA_ENV) $$(s) $$(TARGET_DIR) $$(BR2_ROOTFS_POST_SCRIPT_ARGS) >> $$(FAKEROOT_SCRIPT)$$(sep))
-	$$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\
-		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
 
 	$$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),\
 		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 fs/common.mk: move BR2_ROOTFS_POST_FAKEROOT_SCRIPT after pre cmd hooks

Yes - inline

Quoted 25 lines · Yann E. MORIN

Charles, All,

On 2020-09-10 17:30 -0700, Charles Hardin spake thusly:

Quoted 13 lines

From: Charles Hardin <[email protected]>

The fakeroot script does not appear to be used in any of the checked in defconfig targets, but it seems that most often the post fakeroot script should be done after all the packages rules have been applied instead of before.

Given that a change in systemd moved the SYSTEMD_PRESET_ALL hook to a ROOTFS_PRE_CMD_HOOKS, there was no way to use a FAKEROOT script to disable a service or fixup a systemd configuration. The systemd move makes sense, and this just tries to preserve the same ability to fixup a rootfs after all the cmd hooks are processed.

Quoted 4 lines

Refer to commit 65b63785a642bbc565924edf365b5d7c080f961c for the change that instigated this reordering.

Did you verify that our run-time testing still works:

support/testing/tests/core/test_post_scripts.py

Quoted 9 lines

which can be tested with:

    ./support/testing/run-tests \
        -o /path/to/where/you/want/temp/stuff \
        -d /path/to/BR2_DL_DIR \
        -k \
        tests.core.test_post_scripts

vagrant$ ./support/testing/run-tests -o ~/dumpster -d ~/build/buildroot-dl -k tests.core.test_post_scripts

22:35:57 TestPostScripts Starting

22:36:03 TestPostScripts Building

22:41:26 TestPostScripts Building done

22:41:26 TestPostScripts Cleaning up

.

----------------------------------------------------------------------

Ran 1 test in 328.762s

OK

Otherwise, this change does make sense, because we do want to allow

Quoted 45 lines

users to be able to override the internal decisions.

Regards,
Yann E. MORIN.

fs/common.mk $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME):

Quoted 9 lines
---
 fs/common.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/common.mk +0 -0
index ec6aa831d1..84e13d1b7e 100644
@@ -173,11 +173,11 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME):

$$(ROOTFS_$(2)_DEPENDENCIES)

fs/common.mk $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): · line 174

Quoted 2 lines
fs/common.mk +0 -0
      echo "chown -h -R 0:0 $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
      PATH=$$(BR_PATH) $$(TOPDIR)/support/scripts/mkusers

$$(ROOTFS_FULL_USERS_TABLE) $$(TARGET_DIR) >> $$(FAKEROOT_SCRIPT)

fs/common.mk $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): · line 175

Quoted 1 line
fs/common.mk +0 -0
      echo "$$(HOST_DIR)/bin/makedevs -d $$(ROOTFS_FULL_DEVICES_TABLE)

$$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)

fs/common.mk $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)

Quoted 4 lines
fs/common.mk +2 -0
+     $$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\
+             $$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
      $$(foreach s,$$(call qstrip,$$(BR2_ROOTFS_POST_FAKEROOT_SCRIPT)),\
              echo "echo '$$(TERM_BOLD)>>>   Executing fakeroot script

$$(s)$$(TERM_RESET)'" >> $$(FAKEROOT_SCRIPT); \

fs/common.mk $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): · line 180

Quoted 1 line
fs/common.mk +0 -0
              echo $$(EXTRA_ENV) $$(s) $$(TARGET_DIR)

$$(BR2_ROOTFS_POST_SCRIPT_ARGS) >> $$(FAKEROOT_SCRIPT)$$(sep))

fs/common.mk $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES) · line 183

Quoted 5 lines
fs/common.mk +0 -2
-     $$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\
-             $$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
 
      $$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),\
              $$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))

--

.-----------------.--------------------.------------------.--------------------.

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

'------------------------------^-------^------------------^--------------------'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200914/7ade830e/attachment.html>

#3 lore raw

PATCH 1/1 fs/common.mk: move BR2_ROOTFS_POST_FAKEROOT_SCRIPT after pre cmd hooks

In reply to Charles Hardin

Charles, All,

On 2020-09-10 17:30 -0700, Charles Hardin spake thusly:

Quoted 13 lines

From: Charles Hardin <[email protected]>

The fakeroot script does not appear to be used in any of the checked in defconfig targets, but it seems that most often the post fakeroot script should be done after all the packages rules have been applied instead of before.

Given that a change in systemd moved the SYSTEMD_PRESET_ALL hook to a ROOTFS_PRE_CMD_HOOKS, there was no way to use a FAKEROOT script to disable a service or fixup a systemd configuration. The systemd move makes sense, and this just tries to preserve the same ability to fixup a rootfs after all the cmd hooks are processed.

Quoted 4 lines

Refer to commit 65b63785a642bbc565924edf365b5d7c080f961c for the change that instigated this reordering.

Applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 22 lines
---
 fs/common.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/common.mk +2 -2
index ec6aa831d1..84e13d1b7e 100644
@@ -173,11 +173,11 @@ $$(BINARIES_DIR)/$$(ROOTFS_$(2)_FINAL_IMAGE_NAME): $$(ROOTFS_$(2)_DEPENDENCIES)
 	echo "chown -h -R 0:0 $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
 	PATH=$$(BR_PATH) $$(TOPDIR)/support/scripts/mkusers $$(ROOTFS_FULL_USERS_TABLE) $$(TARGET_DIR) >> $$(FAKEROOT_SCRIPT)
 	echo "$$(HOST_DIR)/bin/makedevs -d $$(ROOTFS_FULL_DEVICES_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)
+	$$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\
+		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
 	$$(foreach s,$$(call qstrip,$$(BR2_ROOTFS_POST_FAKEROOT_SCRIPT)),\
 		echo "echo '$$(TERM_BOLD)>>>   Executing fakeroot script $$(s)$$(TERM_RESET)'" >> $$(FAKEROOT_SCRIPT); \
 		echo $$(EXTRA_ENV) $$(s) $$(TARGET_DIR) $$(BR2_ROOTFS_POST_SCRIPT_ARGS) >> $$(FAKEROOT_SCRIPT)$$(sep))
-	$$(foreach hook,$$(ROOTFS_PRE_CMD_HOOKS),\
-		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
 
 	$$(foreach hook,$$(ROOTFS_$(2)_PRE_GEN_HOOKS),\
 		$$(call PRINTF,$$($$(hook))) >> $$(FAKEROOT_SCRIPT)$$(sep))
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 1/1 fs/common.mk: move BR2_ROOTFS_POST_FAKEROOT_SCRIPT after pre cmd hooks

Quoted 17 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Charles, All,
On 2020-09-10 17:30 -0700, Charles Hardin spake thusly:

Quoted 13 lines

From: Charles Hardin <[email protected]>

The fakeroot script does not appear to be used in any of the checked in defconfig targets, but it seems that most often the post fakeroot script should be done after all the packages rules have been applied instead of before.

Given that a change in systemd moved the SYSTEMD_PRESET_ALL hook to a ROOTFS_PRE_CMD_HOOKS, there was no way to use a FAKEROOT script to disable a service or fixup a systemd configuration. The systemd move makes sense, and this just tries to preserve the same ability to fixup a rootfs after all the cmd hooks are processed.

Quoted 6 lines
Quoted 4 lines

Refer to commit 65b63785a642bbc565924edf365b5d7c080f961c for the change that instigated this reordering.

Applied to master, thanks.

Committed to 2020.08.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard