Skip to contentSkip to conversation

apply-patches.sh: make scan_patchdir work recursively

PATCH New Thomas De Schampheleire 2 participants 2 messages Feb 7, 2014 – Feb 8, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 apply-patches.sh: make scan_patchdir work recursively

scan_patchdir is called recursively. For this to work properly, the variable path which is set to $1 at the very beginning must be local not global.

A test case is to set BR2_GLOBAL_PATCH_DIR to 'mypatches' and having the following tree in the buildroot root:

$ find mypatches/
mypatches/
mypatches/busybox
mypatches/busybox/subdir.patch
mypatches/busybox/subdir.patch/busybox-0001-abc.patch
mypatches/busybox/busybox-0002-def.patch
mypatches/busybox/asubdir.patch
mypatches/busybox/asubdir.patch/busybox-0003-xyz.patch

When running 'make busybox-dirclean busybox-patch' originally, you'd get:

Applying busybox-0003-xyz.patch using patch:

Applying busybox-0002-def.patch using patch:
Error: missing patch file mypatches/busybox/asubdir.patch/busybox-0002-def.patch

While with this fix:

Applying busybox-0003-xyz.patch using patch:

Applying busybox-0002-def.patch using patch:

Applying busybox-0001-abc.patch using patch:

This fixes bug #6434 (https://bugs.busybox.net/show_bug.cgi?id=6434)

[Thomas: update commit message with test case]
---
 support/scripts/apply-patches.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
support/scripts/apply-patches.sh +1 -1
@@ -92,7 +92,7 @@ function apply_patch {
 }
 
 function scan_patchdir {
-    path=$1
+    local path=$1
     shift 1
     patches=${@-*}
 
#1 lore raw

PATCH 1/1 apply-patches.sh: make scan_patchdir work recursively

Quoted 32 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas De Schampheleire <[email protected]> writes:

scan_patchdir is called recursively. For this to work properly, the variable path which is set to $1 at the very beginning must be local not global.

A test case is to set BR2_GLOBAL_PATCH_DIR to 'mypatches' and having the following tree in the buildroot root:

$ find mypatches/
mypatches/
mypatches/busybox
mypatches/busybox/subdir.patch
mypatches/busybox/subdir.patch/busybox-0001-abc.patch
mypatches/busybox/busybox-0002-def.patch
mypatches/busybox/asubdir.patch
mypatches/busybox/asubdir.patch/busybox-0003-xyz.patch

When running 'make busybox-dirclean busybox-patch' originally, you'd get:

Applying busybox-0003-xyz.patch using patch:

Applying busybox-0002-def.patch using patch:
Error: missing patch file mypatches/busybox/asubdir.patch/busybox-0002-def.patch

While with this fix:

Applying busybox-0003-xyz.patch using patch:

Applying busybox-0002-def.patch using patch:

Quoted 8 lines

Applying busybox-0001-abc.patch using patch:

This fixes bug #6434 (https://bugs.busybox.net/show_bug.cgi?id=6434)

[Thomas: update commit message with test case]

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard