Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 0/2] gcc: apply patches stored in global patches directories
@ 2016-04-13  4:20 Chunhui He
  2016-04-13  4:20 ` [Buildroot] [PATCH v3 1/2] gcc: fix ccache hash of patches in BR2_GLOBAL_PATCH_DIR Chunhui He
  2016-04-13  4:20 ` [Buildroot] [PATCH v3 2/2] gcc: apply patches stored in global patches directories Chunhui He
  0 siblings, 2 replies; 6+ messages in thread
From: Chunhui He @ 2016-04-13  4:20 UTC (permalink / raw)
  To: buildroot

Hi,

this is my patch v3 that applies patches in $(BR2_GLOBAL_PATCH_DIR)/gcc.

Arnout, thanks for your help!

Regards,
Chunhui


v3: - add files to HOST_GCC_COMMON_CCACHE_HASH_FILES to make sure that
      the ccache hash is updated appropriately.
    - fix indent.
    - include Arnout's patch that fix ccache hash.

v2: - move the $(GCC_VERSION) part of the suffix to the correct place.


Arnout Vandecappelle (Essensium/Mind) (1):
  gcc: fix ccache hash of patches in BR2_GLOBAL_PATCH_DIR

Chunhui He (1):
  gcc: apply patches stored in global patches directories

 package/gcc/gcc.mk | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

-- 
2.1.4

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

* [Buildroot] [PATCH v3 1/2] gcc: fix ccache hash of patches in BR2_GLOBAL_PATCH_DIR
  2016-04-13  4:20 [Buildroot] [PATCH v3 0/2] gcc: apply patches stored in global patches directories Chunhui He
@ 2016-04-13  4:20 ` Chunhui He
  2016-04-18 21:06   ` Thomas Petazzoni
  2016-04-13  4:20 ` [Buildroot] [PATCH v3 2/2] gcc: apply patches stored in global patches directories Chunhui He
  1 sibling, 1 reply; 6+ messages in thread
From: Chunhui He @ 2016-04-13  4:20 UTC (permalink / raw)
  To: buildroot

From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>

In commit f4682cf933, a hash of the patches applied to gcc was created
to make sure that ccache can properly detect when the toolchain has
changed. The patches applied to gcc consist of the buildroot patches in
package/gcc, but also potentially patches in BR2_GLOBAL_PATCH_DIR.
However, the path to the patches in BR2_GLOBAL_PATCH_DIR was corrected
incorrectly, because it misses a /. So instead of:

$(BR2_GLOBAL_PATCH_DIR)/gcc-initial/*.patch

it would look for

$(BR2_GLOBAL_PATCH_DIR)gcc-initial/*.patch

In other words, if BR2_GLOBAL_PATCH_DIR doesn't end with /, the patches
in BR2_GLOBAL_PATCH_DIR are not taken into account in the ccache hash.

To fix, add the missing /

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: He Chunhui <hchunhui@mail.ustc.edu.cn>
---
 package/gcc/gcc.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 5646b66..46f05ff 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -238,8 +238,8 @@ HOST_GCC_COMMON_CCACHE_HASH_FILES += $(DL_DIR)/$(GCC_SOURCE)
 HOST_GCC_COMMON_CCACHE_HASH_FILES += \
 	$(sort $(wildcard \
 		package/gcc/$(GCC_VERSION)/*.patch \
-		$(addsuffix $((PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
-		$(addsuffix $((PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))))
+		$(addsuffix /$((PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
+		$(addsuffix /$((PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))))
 ifeq ($(BR2_xtensa),y)
 HOST_GCC_COMMON_CCACHE_HASH_FILES += $(HOST_GCC_XTENSA_OVERLAY_TAR)
 endif
-- 
2.1.4

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

* [Buildroot] [PATCH v3 2/2] gcc: apply patches stored in global patches directories
  2016-04-13  4:20 [Buildroot] [PATCH v3 0/2] gcc: apply patches stored in global patches directories Chunhui He
  2016-04-13  4:20 ` [Buildroot] [PATCH v3 1/2] gcc: fix ccache hash of patches in BR2_GLOBAL_PATCH_DIR Chunhui He
@ 2016-04-13  4:20 ` Chunhui He
  2016-04-13  7:42   ` Arnout Vandecappelle
  2016-07-03 13:53   ` Thomas Petazzoni
  1 sibling, 2 replies; 6+ messages in thread
From: Chunhui He @ 2016-04-13  4:20 UTC (permalink / raw)
  To: buildroot

When building host gcc, patches stored in global patches directories
are skipped.
This patch fixes the unexpected behavior.

Signed-off-by: Chunhui He <hchunhui@mail.ustc.edu.cn>
---
 package/gcc/gcc.mk | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
index 46f05ff..4cadca7 100644
--- a/package/gcc/gcc.mk
+++ b/package/gcc/gcc.mk
@@ -42,9 +42,15 @@ endif
 endif
 
 define HOST_GCC_APPLY_PATCHES
-	if test -d package/gcc/$(GCC_VERSION); then \
-	  $(APPLY_PATCHES) $(@D) package/gcc/$(GCC_VERSION) \*.patch ; \
-	fi;
+	for D in \
+	    package/gcc/$(GCC_VERSION) \
+	    $(addsuffix /gcc/$(GCC_VERSION),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
+	    $(addsuffix /gcc,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
+	    ; do \
+		if test -d $${D}; then \
+			$(APPLY_PATCHES) $(@D) $${D} \*.patch || exit 1; \
+		fi; \
+	done;
 	$(HOST_GCC_APPLY_POWERPC_PATCH)
 endef
 
@@ -235,9 +241,12 @@ ifeq ($(BR2_CCACHE),y)
 HOST_GCC_COMMON_CCACHE_HASH_FILES += $(DL_DIR)/$(GCC_SOURCE)
 # Cfr. PATCH_BASE_DIRS in .stamp_patched, but we catch both versioned and
 # unversioned patches unconditionally
+# Also catch patches in $(BR2_GLOBAL_PATCH_DIR)/gcc.
 HOST_GCC_COMMON_CCACHE_HASH_FILES += \
 	$(sort $(wildcard \
 		package/gcc/$(GCC_VERSION)/*.patch \
+		$(addsuffix /gcc/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
+		$(addsuffix /gcc/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
 		$(addsuffix /$((PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
 		$(addsuffix /$((PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))))
 ifeq ($(BR2_xtensa),y)
-- 
2.1.4

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

* [Buildroot] [PATCH v3 2/2] gcc: apply patches stored in global patches directories
  2016-04-13  4:20 ` [Buildroot] [PATCH v3 2/2] gcc: apply patches stored in global patches directories Chunhui He
@ 2016-04-13  7:42   ` Arnout Vandecappelle
  2016-07-03 13:53   ` Thomas Petazzoni
  1 sibling, 0 replies; 6+ messages in thread
From: Arnout Vandecappelle @ 2016-04-13  7:42 UTC (permalink / raw)
  To: buildroot



On 04/13/16 06:20, Chunhui He wrote:
> When building host gcc, patches stored in global patches directories
> are skipped.
> This patch fixes the unexpected behavior.
>
> Signed-off-by: Chunhui He <hchunhui@mail.ustc.edu.cn>

Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

  Regards,
  Arnout

> ---
>   package/gcc/gcc.mk | 15 ++++++++++++---
>   1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk
> index 46f05ff..4cadca7 100644
> --- a/package/gcc/gcc.mk
> +++ b/package/gcc/gcc.mk
> @@ -42,9 +42,15 @@ endif
>   endif
>
>   define HOST_GCC_APPLY_PATCHES
> -	if test -d package/gcc/$(GCC_VERSION); then \
> -	  $(APPLY_PATCHES) $(@D) package/gcc/$(GCC_VERSION) \*.patch ; \
> -	fi;
> +	for D in \
> +	    package/gcc/$(GCC_VERSION) \
> +	    $(addsuffix /gcc/$(GCC_VERSION),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
> +	    $(addsuffix /gcc,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
> +	    ; do \
> +		if test -d $${D}; then \
> +			$(APPLY_PATCHES) $(@D) $${D} \*.patch || exit 1; \
> +		fi; \
> +	done;
>   	$(HOST_GCC_APPLY_POWERPC_PATCH)
>   endef
>
> @@ -235,9 +241,12 @@ ifeq ($(BR2_CCACHE),y)
>   HOST_GCC_COMMON_CCACHE_HASH_FILES += $(DL_DIR)/$(GCC_SOURCE)
>   # Cfr. PATCH_BASE_DIRS in .stamp_patched, but we catch both versioned and
>   # unversioned patches unconditionally
> +# Also catch patches in $(BR2_GLOBAL_PATCH_DIR)/gcc.
>   HOST_GCC_COMMON_CCACHE_HASH_FILES += \
>   	$(sort $(wildcard \
>   		package/gcc/$(GCC_VERSION)/*.patch \
> +		$(addsuffix /gcc/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
> +		$(addsuffix /gcc/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
>   		$(addsuffix /$((PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \
>   		$(addsuffix /$((PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))))
>   ifeq ($(BR2_xtensa),y)
>

-- 
Arnout Vandecappelle      arnout dot vandecappelle at essensium dot com
Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile)
Essensium, Mind division . . . . . . . . . . . . . . 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:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH v3 1/2] gcc: fix ccache hash of patches in BR2_GLOBAL_PATCH_DIR
  2016-04-13  4:20 ` [Buildroot] [PATCH v3 1/2] gcc: fix ccache hash of patches in BR2_GLOBAL_PATCH_DIR Chunhui He
@ 2016-04-18 21:06   ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2016-04-18 21:06 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 13 Apr 2016 04:20:31 +0000, Chunhui He wrote:
> From: "Arnout Vandecappelle (Essensium/Mind)" <arnout@mind.be>
> 
> In commit f4682cf933, a hash of the patches applied to gcc was created
> to make sure that ccache can properly detect when the toolchain has
> changed. The patches applied to gcc consist of the buildroot patches in
> package/gcc, but also potentially patches in BR2_GLOBAL_PATCH_DIR.
> However, the path to the patches in BR2_GLOBAL_PATCH_DIR was corrected
> incorrectly, because it misses a /. So instead of:
> 
> $(BR2_GLOBAL_PATCH_DIR)/gcc-initial/*.patch
> 
> it would look for
> 
> $(BR2_GLOBAL_PATCH_DIR)gcc-initial/*.patch
> 
> In other words, if BR2_GLOBAL_PATCH_DIR doesn't end with /, the patches
> in BR2_GLOBAL_PATCH_DIR are not taken into account in the ccache hash.
> 
> To fix, add the missing /
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: He Chunhui <hchunhui@mail.ustc.edu.cn>
> ---
>  package/gcc/gcc.mk | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

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 2/2] gcc: apply patches stored in global patches directories
  2016-04-13  4:20 ` [Buildroot] [PATCH v3 2/2] gcc: apply patches stored in global patches directories Chunhui He
  2016-04-13  7:42   ` Arnout Vandecappelle
@ 2016-07-03 13:53   ` Thomas Petazzoni
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2016-07-03 13:53 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 13 Apr 2016 04:20:32 +0000, Chunhui He wrote:
> When building host gcc, patches stored in global patches directories
> are skipped.
> This patch fixes the unexpected behavior.
> 
> Signed-off-by: Chunhui He <hchunhui@mail.ustc.edu.cn>
> ---
>  package/gcc/gcc.mk | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)

We had some pretty lengthy discussion today with Peter and Yann about
this patch, arguing about the various possibilities to solve this
problem. In the end, even though your solution is a bit of a hack, it's
the one that is the easiest in terms of on-going maintenance, so I
applied your patch after doing some minor modifications:

    [Thomas:
     - rename the loop variable from 'D' to 'patchdir'
     - add some additional comments
     - remove final ; at end of loop when applying the patches, since it's
       not needed]

Thanks!

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

end of thread, other threads:[~2016-07-03 13:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-13  4:20 [Buildroot] [PATCH v3 0/2] gcc: apply patches stored in global patches directories Chunhui He
2016-04-13  4:20 ` [Buildroot] [PATCH v3 1/2] gcc: fix ccache hash of patches in BR2_GLOBAL_PATCH_DIR Chunhui He
2016-04-18 21:06   ` Thomas Petazzoni
2016-04-13  4:20 ` [Buildroot] [PATCH v3 2/2] gcc: apply patches stored in global patches directories Chunhui He
2016-04-13  7:42   ` Arnout Vandecappelle
2016-07-03 13:53   ` Thomas Petazzoni

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