diff mbox

[1/2] core/pkg-autotools: don't use APPLY_PATCHES for libtool patches

Message ID 1471259370-2914-1-git-send-email-romain.naour@gmail.com
State Changes Requested
Headers show

Commit Message

Romain Naour Aug. 15, 2016, 11:09 a.m. UTC
Since 19241598147e7555dce40b6dd44b28ef22b67ed9 <package>-reconfigure
target is broken.

$ make elementary-reconfigure
Applying buildroot-libtool-v2.4.4.patch using patch:
Error: duplicate filename 'buildroot-libtool-v2.4.4.patch'
Conflicting files are:
  already applied: buildroot/support/libtool/buildroot-libtool-v2.4.4.patch
  to be applied  : buildroot/support/libtool/buildroot-libtool-v2.4.4.patch

When a package use AUTORECONF, the libtool patch can be applied many
times as the <package>-reconfigure target is called. This is not a
problem since autoreconf will overwrite the previously patched files.

In addition to this, the .applied_patches_list file generated by
apply-patches.sh while patching ltmain.sh is not in the top-level
package source directory. Instead a duplicated .applied_patches_list
is generated beside patched ltmain.sh which can be in a subdirectory.

As noticed by Arnout Vandecappelle [1], the apply-patches.sh script
doesn't bring anything for the libtool patches.

"apply_patches.sh does the following:

* It handles directories -> not needed here.
* It handles compressed patches and tarballs -> not needed.
* It handles series files -> not needed.
* It handles errors in case of multiple patches -> not needed since
it's only one patch.
* It detects errors based on *.rej files -> not needed since it's only
a single patch so patch exit code is OK.
* It writes the patch list -> for libtool, this is quite silly because
it will be written in the directory where ltmain.sh is found, not in the
top-level directory, so you have these patch lists spread over the
source tree."

So for 2016.08 use patch directly rather than apply-patches.

[1] http://lists.busybox.net/pipermail/buildroot/2016-August/169810.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
---
 package/pkg-autotools.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Yann E. MORIN Aug. 15, 2016, 11:56 a.m. UTC | #1
Romain, All,

On 2016-08-15 13:09 +0200, Romain Naour spake thusly:
> Since 19241598147e7555dce40b6dd44b28ef22b67ed9 <package>-reconfigure
> target is broken.
[--SNIP--]
> So for 2016.08 use patch directly rather than apply-patches.
> 
> [1] http://lists.busybox.net/pipermail/buildroot/2016-August/169810.html
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>

Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/pkg-autotools.mk | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
> index 75e2df0..d1cdb89 100644
> --- a/package/pkg-autotools.mk
> +++ b/package/pkg-autotools.mk
> @@ -65,14 +65,14 @@ define LIBTOOL_PATCH_HOOK
>  		ltmain_patchlevel=`sed -n '/^[ \t]*VERSION=/{s/^[ \t]*VERSION=//;p;q;}' $$i | \
>  		sed -e 's/\([0-9]*\.[0-9]*\.*\)\([0-9]*\).*/\2/' -e 's/\"//'`; \
>  		if test $${ltmain_version} = '1.5'; then \
> -			$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
> +			patch -i support/libtool/buildroot-libtool-v1.5.patch $${i}; \
>  		elif test $${ltmain_version} = "2.2"; then\
> -			$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
> +			patch -i support/libtool/buildroot-libtool-v2.2.patch $${i}; \
>  		elif test $${ltmain_version} = "2.4"; then\
>  			if test $${ltmain_patchlevel:-0} -gt 2; then\
> -				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.4.patch; \
> +				patch -i support/libtool/buildroot-libtool-v2.4.4.patch $${i}; \
>  			else \
> -				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
> +				patch -i support/libtool/buildroot-libtool-v2.4.patch $${i}; \
>  			fi \
>  		fi \
>  	done
> -- 
> 2.5.5
>
Arnout Vandecappelle Aug. 15, 2016, 10:18 p.m. UTC | #2
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
 Built and reconfigured a bunch of autotools packages with and without AUTORECONF.

 However, some minor spelling nits.

On 15-08-16 13:09, Romain Naour wrote:
> Since 19241598147e7555dce40b6dd44b28ef22b67ed9 <package>-reconfigure
                                                ^the
> target is broken.
> 
> $ make elementary-reconfigure
> Applying buildroot-libtool-v2.4.4.patch using patch:
> Error: duplicate filename 'buildroot-libtool-v2.4.4.patch'
> Conflicting files are:
>   already applied: buildroot/support/libtool/buildroot-libtool-v2.4.4.patch
>   to be applied  : buildroot/support/libtool/buildroot-libtool-v2.4.4.patch
> 
> When a package use AUTORECONF, the libtool patch can be applied many
                 uses                                             a second time
(it can be applied many times the first time the package is configured, but
that's not the issue here; the point is that the same ltmain.sh in the same
directory is patched a second time).

> times as the <package>-reconfigure target is called. This is not a
> problem since autoreconf will overwrite the previously patched files.
> 
> In addition to this, the .applied_patches_list file generated by
> apply-patches.sh while patching ltmain.sh is not in the top-level
> package source directory. Instead a duplicated .applied_patches_list
> is generated beside patched ltmain.sh which can be in a subdirectory.
                     ^the

> 
> As noticed by Arnout Vandecappelle [1], the apply-patches.sh script
> doesn't bring anything for the libtool patches.
> 
> "apply_patches.sh does the following:
> 
> * It handles directories -> not needed here.
> * It handles compressed patches and tarballs -> not needed.
> * It handles series files -> not needed.
> * It handles errors in case of multiple patches -> not needed since
> it's only one patch.
> * It detects errors based on *.rej files -> not needed since it's only
> a single patch so patch exit code is OK.
> * It writes the patch list -> for libtool, this is quite silly because
> it will be written in the directory where ltmain.sh is found, not in the
> top-level directory, so you have these patch lists spread over the
> source tree."

 Nicely written :-P

> 
> So for 2016.08 use patch directly rather than apply-patches.

 Actually, I'd keep it like this even after 2016.08, see my comments in [2/2].

 Regards,
 Arnout

> 
> [1] http://lists.busybox.net/pipermail/buildroot/2016-August/169810.html
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> ---
>  package/pkg-autotools.mk | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
> index 75e2df0..d1cdb89 100644
> --- a/package/pkg-autotools.mk
> +++ b/package/pkg-autotools.mk
> @@ -65,14 +65,14 @@ define LIBTOOL_PATCH_HOOK
>  		ltmain_patchlevel=`sed -n '/^[ \t]*VERSION=/{s/^[ \t]*VERSION=//;p;q;}' $$i | \
>  		sed -e 's/\([0-9]*\.[0-9]*\.*\)\([0-9]*\).*/\2/' -e 's/\"//'`; \
>  		if test $${ltmain_version} = '1.5'; then \
> -			$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
> +			patch -i support/libtool/buildroot-libtool-v1.5.patch $${i}; \
>  		elif test $${ltmain_version} = "2.2"; then\
> -			$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
> +			patch -i support/libtool/buildroot-libtool-v2.2.patch $${i}; \
>  		elif test $${ltmain_version} = "2.4"; then\
>  			if test $${ltmain_patchlevel:-0} -gt 2; then\
> -				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.4.patch; \
> +				patch -i support/libtool/buildroot-libtool-v2.4.4.patch $${i}; \
>  			else \
> -				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
> +				patch -i support/libtool/buildroot-libtool-v2.4.patch $${i}; \
>  			fi \
>  		fi \
>  	done
>
diff mbox

Patch

diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
index 75e2df0..d1cdb89 100644
--- a/package/pkg-autotools.mk
+++ b/package/pkg-autotools.mk
@@ -65,14 +65,14 @@  define LIBTOOL_PATCH_HOOK
 		ltmain_patchlevel=`sed -n '/^[ \t]*VERSION=/{s/^[ \t]*VERSION=//;p;q;}' $$i | \
 		sed -e 's/\([0-9]*\.[0-9]*\.*\)\([0-9]*\).*/\2/' -e 's/\"//'`; \
 		if test $${ltmain_version} = '1.5'; then \
-			$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
+			patch -i support/libtool/buildroot-libtool-v1.5.patch $${i}; \
 		elif test $${ltmain_version} = "2.2"; then\
-			$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
+			patch -i support/libtool/buildroot-libtool-v2.2.patch $${i}; \
 		elif test $${ltmain_version} = "2.4"; then\
 			if test $${ltmain_patchlevel:-0} -gt 2; then\
-				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.4.patch; \
+				patch -i support/libtool/buildroot-libtool-v2.4.4.patch $${i}; \
 			else \
-				$(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
+				patch -i support/libtool/buildroot-libtool-v2.4.patch $${i}; \
 			fi \
 		fi \
 	done