diff mbox series

[1/5] package/pkg-waf.mk: drop bundled waf/waflib when external waf is used

Message ID 20230208181933.3925279-1-peter@korsgaard.com
State Accepted
Headers show
Series [1/5] package/pkg-waf.mk: drop bundled waf/waflib when external waf is used | expand

Commit Message

Peter Korsgaard Feb. 8, 2023, 6:19 p.m. UTC
Waf requires that the version of the waf script matches the version of
waflib, so drop any bundled waf/waflib if _NEEDS_EXTERNAL_WAF is used, as
otherwise waf errors out with errors like:

Waf script '2.0.24' and library '1.9.3' do not match

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 package/pkg-waf.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Yann E. MORIN Feb. 8, 2023, 7:24 p.m. UTC | #1
Peter, All,

On 2023-02-08 19:19 +0100, Peter Korsgaard spake thusly:
> Waf requires that the version of the waf script matches the version of
> waflib, so drop any bundled waf/waflib if _NEEDS_EXTERNAL_WAF is used, as
> otherwise waf errors out with errors like:
> 
> Waf script '2.0.24' and library '1.9.3' do not match
> 
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
> ---
>  package/pkg-waf.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/pkg-waf.mk b/package/pkg-waf.mk
> index e090afa9e6..a067e69c9b 100644
> --- a/package/pkg-waf.mk
> +++ b/package/pkg-waf.mk
> @@ -38,6 +38,13 @@ WAF_OPTS = $(if $(VERBOSE),-v) -j $(PARALLEL_JOBS)
>  
>  define inner-waf-package
>  
> +# The version of waflib has to match with the version of waf,
> +# otherwise waf errors out with:
> +# Waf script 'X' and library 'Y' do not match
> +define WAF_PACKAGE_REMOVE_WAF_LIB
> +	$(RM) -fr $(@D)/waf $(@D)/waflib
> +endef
> +
>  # We need host-python3 to run waf
>  $(2)_DEPENDENCIES += host-python3
>  
> @@ -47,6 +54,7 @@ $(2)_NEEDS_EXTERNAL_WAF ?= NO
>  ifeq ($$($(2)_NEEDS_EXTERNAL_WAF),YES)
>  $(2)_DEPENDENCIES += host-waf
>  $(2)_WAF = $$(HOST_DIR)/bin/waf
> +$(2)_PRE_CONFIGURE_HOOKS += WAF_PACKAGE_REMOVE_WAF_LIB

It would make more sense to make that either a post-extract or a
post-patch hook.

Regards,
Yann E. MORIN.

>  else
>  $(2)_WAF ?= ./waf
>  endif
> -- 
> 2.30.2
>
Romain Naour Feb. 8, 2023, 9:05 p.m. UTC | #2
Hello Peter,

Le 08/02/2023 à 19:19, Peter Korsgaard a écrit :
> Waf requires that the version of the waf script matches the version of
> waflib, so drop any bundled waf/waflib if _NEEDS_EXTERNAL_WAF is used, as
> otherwise waf errors out with errors like:
> 
> Waf script '2.0.24' and library '1.9.3' do not match
> 
> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>

Reviewed-by: Romain Naour <romain.naour@smile.fr>

Best regards,
Romain

> ---
>  package/pkg-waf.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/pkg-waf.mk b/package/pkg-waf.mk
> index e090afa9e6..a067e69c9b 100644
> --- a/package/pkg-waf.mk
> +++ b/package/pkg-waf.mk
> @@ -38,6 +38,13 @@ WAF_OPTS = $(if $(VERBOSE),-v) -j $(PARALLEL_JOBS)
>  
>  define inner-waf-package
>  
> +# The version of waflib has to match with the version of waf,
> +# otherwise waf errors out with:
> +# Waf script 'X' and library 'Y' do not match
> +define WAF_PACKAGE_REMOVE_WAF_LIB
> +	$(RM) -fr $(@D)/waf $(@D)/waflib
> +endef
> +
>  # We need host-python3 to run waf
>  $(2)_DEPENDENCIES += host-python3
>  
> @@ -47,6 +54,7 @@ $(2)_NEEDS_EXTERNAL_WAF ?= NO
>  ifeq ($$($(2)_NEEDS_EXTERNAL_WAF),YES)
>  $(2)_DEPENDENCIES += host-waf
>  $(2)_WAF = $$(HOST_DIR)/bin/waf
> +$(2)_PRE_CONFIGURE_HOOKS += WAF_PACKAGE_REMOVE_WAF_LIB
>  else
>  $(2)_WAF ?= ./waf
>  endif
Peter Korsgaard Feb. 9, 2023, 6:48 a.m. UTC | #3
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > Peter, All,
 > On 2023-02-08 19:19 +0100, Peter Korsgaard spake thusly:
 >> Waf requires that the version of the waf script matches the version of
 >> waflib, so drop any bundled waf/waflib if _NEEDS_EXTERNAL_WAF is used, as
 >> otherwise waf errors out with errors like:
 >> 
 >> Waf script '2.0.24' and library '1.9.3' do not match
 >> 
 >> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
 >> ---
 >> package/pkg-waf.mk | 8 ++++++++
 >> 1 file changed, 8 insertions(+)
 >> 
 >> diff --git a/package/pkg-waf.mk b/package/pkg-waf.mk
 >> index e090afa9e6..a067e69c9b 100644
 >> --- a/package/pkg-waf.mk
 >> +++ b/package/pkg-waf.mk
 >> @@ -38,6 +38,13 @@ WAF_OPTS = $(if $(VERBOSE),-v) -j $(PARALLEL_JOBS)
 >> 
 >> define inner-waf-package
 >> 
 >> +# The version of waflib has to match with the version of waf,
 >> +# otherwise waf errors out with:
 >> +# Waf script 'X' and library 'Y' do not match
 >> +define WAF_PACKAGE_REMOVE_WAF_LIB
 >> +	$(RM) -fr $(@D)/waf $(@D)/waflib
 >> +endef
 >> +
 >> # We need host-python3 to run waf
 >> $(2)_DEPENDENCIES += host-python3
 >> 
 >> @@ -47,6 +54,7 @@ $(2)_NEEDS_EXTERNAL_WAF ?= NO
 >> ifeq ($$($(2)_NEEDS_EXTERNAL_WAF),YES)
 >> $(2)_DEPENDENCIES += host-waf
 >> $(2)_WAF = $$(HOST_DIR)/bin/waf
 >> +$(2)_PRE_CONFIGURE_HOOKS += WAF_PACKAGE_REMOVE_WAF_LIB

 > It would make more sense to make that either a post-extract or a
 > post-patch hook.

I hesitated between post-patch and pre-configure, but went with
pre-configure as this is closely related to the configure step - But I'm
fine with making it a post-patch hook instead.
Peter Korsgaard Feb. 10, 2023, 2:09 p.m. UTC | #4
>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > Peter, All,
 > On 2023-02-08 19:19 +0100, Peter Korsgaard spake thusly:
 >> Waf requires that the version of the waf script matches the version of
 >> waflib, so drop any bundled waf/waflib if _NEEDS_EXTERNAL_WAF is used, as
 >> otherwise waf errors out with errors like:
 >> 
 >> Waf script '2.0.24' and library '1.9.3' do not match
 >> 
 >> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
 >> ---
 >> package/pkg-waf.mk | 8 ++++++++
 >> 1 file changed, 8 insertions(+)
 >> 
 >> diff --git a/package/pkg-waf.mk b/package/pkg-waf.mk
 >> index e090afa9e6..a067e69c9b 100644
 >> --- a/package/pkg-waf.mk
 >> +++ b/package/pkg-waf.mk
 >> @@ -38,6 +38,13 @@ WAF_OPTS = $(if $(VERBOSE),-v) -j $(PARALLEL_JOBS)
 >> 
 >> define inner-waf-package
 >> 
 >> +# The version of waflib has to match with the version of waf,
 >> +# otherwise waf errors out with:
 >> +# Waf script 'X' and library 'Y' do not match
 >> +define WAF_PACKAGE_REMOVE_WAF_LIB
 >> +	$(RM) -fr $(@D)/waf $(@D)/waflib
 >> +endef
 >> +
 >> # We need host-python3 to run waf
 >> $(2)_DEPENDENCIES += host-python3
 >> 
 >> @@ -47,6 +54,7 @@ $(2)_NEEDS_EXTERNAL_WAF ?= NO
 >> ifeq ($$($(2)_NEEDS_EXTERNAL_WAF),YES)
 >> $(2)_DEPENDENCIES += host-waf
 >> $(2)_WAF = $$(HOST_DIR)/bin/waf
 >> +$(2)_PRE_CONFIGURE_HOOKS += WAF_PACKAGE_REMOVE_WAF_LIB

 > It would make more sense to make that either a post-extract or a
 > post-patch hook.

Committed after changing it to use a post-patch hook, thanks.
Romain Naour Feb. 11, 2023, 9:33 a.m. UTC | #5
Hello,

Le 08/02/2023 à 20:24, Yann E. MORIN a écrit :
> Peter, All,
> 
> On 2023-02-08 19:19 +0100, Peter Korsgaard spake thusly:
>> Waf requires that the version of the waf script matches the version of
>> waflib, so drop any bundled waf/waflib if _NEEDS_EXTERNAL_WAF is used, as
>> otherwise waf errors out with errors like:
>>
>> Waf script '2.0.24' and library '1.9.3' do not match
>>
>> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
>> ---
>>  package/pkg-waf.mk | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/package/pkg-waf.mk b/package/pkg-waf.mk
>> index e090afa9e6..a067e69c9b 100644
>> --- a/package/pkg-waf.mk
>> +++ b/package/pkg-waf.mk
>> @@ -38,6 +38,13 @@ WAF_OPTS = $(if $(VERBOSE),-v) -j $(PARALLEL_JOBS)
>>  
>>  define inner-waf-package
>>  
>> +# The version of waflib has to match with the version of waf,
>> +# otherwise waf errors out with:
>> +# Waf script 'X' and library 'Y' do not match
>> +define WAF_PACKAGE_REMOVE_WAF_LIB
>> +	$(RM) -fr $(@D)/waf $(@D)/waflib

We need more $$ here :)

Otherwise:

>>> aubio 0.4.9 Patching
rm -f -fr /waf /waflib

Best regards,
Romain


>> +endef
>> +
>>  # We need host-python3 to run waf
>>  $(2)_DEPENDENCIES += host-python3
>>  
>> @@ -47,6 +54,7 @@ $(2)_NEEDS_EXTERNAL_WAF ?= NO
>>  ifeq ($$($(2)_NEEDS_EXTERNAL_WAF),YES)
>>  $(2)_DEPENDENCIES += host-waf
>>  $(2)_WAF = $$(HOST_DIR)/bin/waf
>> +$(2)_PRE_CONFIGURE_HOOKS += WAF_PACKAGE_REMOVE_WAF_LIB
> 
> It would make more sense to make that either a post-extract or a
> post-patch hook.
> 
> Regards,
> Yann E. MORIN.
> 
>>  else
>>  $(2)_WAF ?= ./waf
>>  endif
>> -- 
>> 2.30.2
>>
>
Peter Korsgaard Feb. 11, 2023, 1:17 p.m. UTC | #6
>>>>> "Romain" == Romain Naour <romain.naour@smile.fr> writes:

Hi,

 >>> +# The version of waflib has to match with the version of waf,
 >>> +# otherwise waf errors out with:
 >>> +# Waf script 'X' and library 'Y' do not match
 >>> +define WAF_PACKAGE_REMOVE_WAF_LIB
 >>> +	$(RM) -fr $(@D)/waf $(@D)/waflib

 > We need more $$ here :)

 > Otherwise:

 >>>> aubio 0.4.9 Patching
 > rm -f -fr /waf /waflib

Ahh crap, thanks for pointing it out.
diff mbox series

Patch

diff --git a/package/pkg-waf.mk b/package/pkg-waf.mk
index e090afa9e6..a067e69c9b 100644
--- a/package/pkg-waf.mk
+++ b/package/pkg-waf.mk
@@ -38,6 +38,13 @@  WAF_OPTS = $(if $(VERBOSE),-v) -j $(PARALLEL_JOBS)
 
 define inner-waf-package
 
+# The version of waflib has to match with the version of waf,
+# otherwise waf errors out with:
+# Waf script 'X' and library 'Y' do not match
+define WAF_PACKAGE_REMOVE_WAF_LIB
+	$(RM) -fr $(@D)/waf $(@D)/waflib
+endef
+
 # We need host-python3 to run waf
 $(2)_DEPENDENCIES += host-python3
 
@@ -47,6 +54,7 @@  $(2)_NEEDS_EXTERNAL_WAF ?= NO
 ifeq ($$($(2)_NEEDS_EXTERNAL_WAF),YES)
 $(2)_DEPENDENCIES += host-waf
 $(2)_WAF = $$(HOST_DIR)/bin/waf
+$(2)_PRE_CONFIGURE_HOOKS += WAF_PACKAGE_REMOVE_WAF_LIB
 else
 $(2)_WAF ?= ./waf
 endif