support/apply-patches: use options rather than positional arguments
PATCH 1/2 support/apply-patches: use options rather than positional arguments
In order to improve the apply-patches script in a follow up patch and ease it maintenance, use options provided by bash getopts rather than positional arguments.
Update Buildroot infra and packages but this will break existing packages from BR2_EXTERNAL using APPLY_PATCHES.
While at it, rename builddir to sourcedir since it is really the package source directory.
Ref:
http://lists.busybox.net/pipermail/buildroot/2016-August/169760.html
--- boot/at91bootstrap/at91bootstrap.mk | 3 +- boot/at91bootstrap3/at91bootstrap3.mk | 3 +- boot/barebox/barebox.mk | 4 +- boot/uboot/uboot.mk | 4 +- linux/linux-ext-rtai.mk | 6 +- linux/linux.mk | 6 +- package/android-tools/android-tools.mk | 2 +- package/cvs/cvs.mk | 2 +- package/gcc/gcc.mk | 4 +- package/input-tools/input-tools.mk | 2 +- package/linux-headers/linux-headers.mk | 4 +- package/mii-diag/mii-diag.mk | 2 +- package/netcat-openbsd/netcat-openbsd.mk | 2 +- package/pkg-autotools.mk | 8 +- package/pkg-generic.mk | 6 +- package/setserial/setserial.mk | 2 +- package/sysvinit/sysvinit.mk | 2 +- package/thttpd/thttpd.mk | 2 +- support/scripts/apply-patches.sh | 138 ++++++++++++++++++++----------- 19 files changed, 122 insertions(+), 80 deletions(-)
boot/at91bootstrap/at91bootstrap.mk +2 -1
@@ -24,7 +24,8 @@ endef ifneq ($(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP_CUSTOM_PATCH_DIR)),) define AT91BOOTSTRAP_APPLY_CUSTOM_PATCHES - $(APPLY_PATCHES) $(@D) $(BR2_TARGET_AT91BOOTSTRAP_CUSTOM_PATCH_DIR) \*.patch + $(APPLY_PATCHES) -d $(@D) \ + -D $(BR2_TARGET_AT91BOOTSTRAP_CUSTOM_PATCH_DIR) -p \*.patch endef AT91BOOTSTRAP_POST_PATCH_HOOKS += AT91BOOTSTRAP_APPLY_CUSTOM_PATCHES
boot/at91bootstrap3/at91bootstrap3.mk +2 -1
@@ -26,7 +26,8 @@ AT91BOOTSTRAP3_MAKE_OPTS = CROSS_COMPILE=$(TARGET_CROSS) DESTDIR=$(BINARIES_DIR) ifneq ($(AT91BOOTSTRAP3_CUSTOM_PATCH_DIR),) define AT91BOOTSTRAP3_APPLY_CUSTOM_PATCHES - $(APPLY_PATCHES) $(@D) $(AT91BOOTSTRAP3_CUSTOM_PATCH_DIR) \*.patch + $(APPLY_PATCHES) -d $(@D) \ + -D $(AT91BOOTSTRAP3_CUSTOM_PATCH_DIR) -p \*.patch endef AT91BOOTSTRAP3_POST_PATCH_HOOKS += AT91BOOTSTRAP3_APPLY_CUSTOM_PATCHES
boot/barebox/barebox.mk +2 -2
@@ -43,8 +43,8 @@ $(1)_CUSTOM_EMBEDDED_ENV_PATH = $$(call qstrip,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDE ifneq ($$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR)),) define $(1)_APPLY_CUSTOM_PATCHES - $$(APPLY_PATCHES) $$(@D) \ - $$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) \*.patch + $$(APPLY_PATCHES) -d $$(@D) \ + -D $$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) -p \*.patch endef $(1)_POST_PATCH_HOOKS += $(1)_APPLY_CUSTOM_PATCHES
boot/uboot/uboot.mk +2 -2
@@ -121,9 +121,9 @@ UBOOT_PATCH = $(filter ftp://% http://% https://%,$(UBOOT_PATCHES)) define UBOOT_APPLY_LOCAL_PATCHES for p in $(filter-out ftp://% http://% https://%,$(UBOOT_PATCHES)) ; do \ if test -d $$p ; then \ - $(APPLY_PATCHES) $(@D) $$p \*.patch || exit 1 ; \ + $(APPLY_PATCHES) -d $(@D) -D $$p -p \*.patch || exit 1 ; \ else \ - $(APPLY_PATCHES) $(@D) `dirname $$p` `basename $$p` || exit 1; \ + $(APPLY_PATCHES) -d $(@D) -D `dirname -p $$p` `basename $$p` || exit 1; \ fi \ done endef
linux/linux-ext-rtai.mk +3 -3
@@ -20,9 +20,9 @@ endif define RTAI_PREPARE_KERNEL kver=`$(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelversion` ; \ if test -f $(RTAI_DIR)/base/arch/$(RTAI_ARCH)/patches/hal-linux-$${kver}-*patch ; then \ - $(APPLY_PATCHES) $(LINUX_DIR) \ - $(RTAI_DIR)/base/arch/$(RTAI_ARCH)/patches/ \ - hal-linux-$${kver}-*patch ; \ + $(APPLY_PATCHES) -d $(LINUX_DIR) \ + -D $(RTAI_DIR)/base/arch/$(RTAI_ARCH)/patches/ \ + -p hal-linux-$${kver}-*patch ; \ else \ echo "No RTAI patch for your kernel version" ; \ exit 1 ; \
linux/linux.mk +3 -3
@@ -185,9 +185,9 @@ endif # BR2_LINUX_KERNEL_VMLINUX define LINUX_APPLY_LOCAL_PATCHES for p in $(filter-out ftp://% http://% https://%,$(LINUX_PATCHES)) ; do \ if test -d $$p ; then \ - $(APPLY_PATCHES) $(@D) $$p \*.patch || exit 1 ; \ + $(APPLY_PATCHES) -d $(@D) -D $$p -p \*.patch || exit 1 ; \ else \ - $(APPLY_PATCHES) $(@D) `dirname $$p` `basename $$p` || exit 1; \ + $(APPLY_PATCHES) -d $(@D) -D `dirname $$p` -p `basename $$p` || exit 1; \ fi \ done endef
@@ -199,7 +199,7 @@ LINUX_POST_PATCH_HOOKS += LINUX_APPLY_LOCAL_PATCHES # Try a dry-run patch to see if this applies, if it does go ahead define LINUX_TRY_PATCH_TIMECONST @if patch -p1 --dry-run -f -s -d $(@D) <$(LINUX_PKGDIR)/0001-timeconst.pl-Eliminate-Perl-warning.patch.conditional >/dev/null ; then \ - $(APPLY_PATCHES) $(@D) $(LINUX_PKGDIR) 0001-timeconst.pl-Eliminate-Perl-warning.patch.conditional ; \ + $(APPLY_PATCHES) -d $(@D) -D $(LINUX_PKGDIR) -p 0001-timeconst.pl-Eliminate-Perl-warning.patch.conditional ; \ fi endef LINUX_POST_PATCH_HOOKS += LINUX_TRY_PATCH_TIMECONST
package/android-tools/android-tools.mk +1 -1
@@ -24,7 +24,7 @@ ANDROID_TOOLS_POST_EXTRACT_HOOKS += ANDROID_TOOLS_DEBIAN_EXTRACT # Apply the Debian patches before applying the Buildroot patches define ANDROID_TOOLS_DEBIAN_PATCH - $(APPLY_PATCHES) $(@D) $(@D)/debian/patches \* + $(APPLY_PATCHES) -d $(@D) -D $(@D)/debian/patches -p \* endef HOST_ANDROID_TOOLS_PRE_PATCH_HOOKS += ANDROID_TOOLS_DEBIAN_PATCH
package/cvs/cvs.mk +1 -1
@@ -38,7 +38,7 @@ define CVS_DEBIAN_PATCHES do $(SED) 's,^\+\+\+ .*cvs-$(CVS_VERSION)/,+++ cvs-$(CVS_VERSION)/,' $$i; \ done; \ ); \ - $(APPLY_PATCHES) $(@D) $(@D)/debian/patches \*; \ + $(APPLY_PATCHES) -d $(@D) -D $(@D)/debian/patches -p \*; \ fi endef endif
package/gcc/gcc.mk +2 -2
@@ -36,7 +36,7 @@ endef ifeq ($(ARCH),powerpc) ifneq ($(BR2_SOFT_FLOAT),) define HOST_GCC_APPLY_POWERPC_PATCH - $(APPLY_PATCHES) $(@D) package/gcc/$(GCC_VERSION) 1000-powerpc-link-with-math-lib.patch.conditional + $(APPLY_PATCHES) -d $(@D) -D package/gcc/$(GCC_VERSION) -p 1000-powerpc-link-with-math-lib.patch.conditional endef endif endif
@@ -50,7 +50,7 @@ define HOST_GCC_APPLY_PATCHES $(addsuffix /gcc/$(GCC_VERSION),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ $(addsuffix /gcc,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) ; do \ if test -d $${patchdir}; then \ - $(APPLY_PATCHES) $(@D) $${patchdir} \*.patch || exit 1; \ + $(APPLY_PATCHES) -d $(@D) -D $${patchdir} -p \*.patch || exit 1; \ fi; \ done $(HOST_GCC_APPLY_POWERPC_PATCH)
package/input-tools/input-tools.mk +1 -1
@@ -17,7 +17,7 @@ INPUT_TOOLS_TARGETS_$(BR2_PACKAGE_INPUT_TOOLS_JSTEST) += jstest define INPUT_TOOLS_DEBIAN_PATCHES if [ -d $(@D)/debian/patches ]; then \ - $(APPLY_PATCHES) $(@D) $(@D)/debian/patches \*.patch; \ + $(APPLY_PATCHES) -d $(@D) -D $(@D)/debian/patches -p \*.patch; \ fi endef
package/linux-headers/linux-headers.mk +2 -2
@@ -62,9 +62,9 @@ LINUX_HEADERS_PATCH = $(filter ftp://% http://% https://%,$(LINUX_HEADERS_PATCHE define LINUX_HEADERS_APPLY_LOCAL_PATCHES for p in $(filter-out ftp://% http://% https://%,$(LINUX_HEADERS_PATCHES)) ; do \ if test -d $$p ; then \ - $(APPLY_PATCHES) $(@D) $$p \*.patch || exit 1 ; \ + $(APPLY_PATCHES) -d $(@D) -D $$p -p \*.patch || exit 1 ; \ else \ - $(APPLY_PATCHES) $(@D) `dirname $$p` `basename $$p` || exit 1; \ + $(APPLY_PATCHES) -d $(@D) -D `dirname $$p` -p `basename $$p` || exit 1; \ fi \ done endef
package/mii-diag/mii-diag.mk +1 -1
@@ -15,7 +15,7 @@ MII_DIAG_MAKE_OPTS = $(TARGET_CONFIGURE_OPTS) define MII_DIAG_DEBIAN_PATCHES if [ -d $(@D)/debian/patches ]; then \ - $(APPLY_PATCHES) $(@D) $(@D)/debian/patches \*.patch; \ + $(APPLY_PATCHES) -d $(@D) -D $(@D)/debian/patches -p \*.patch; \ fi endef
package/netcat-openbsd/netcat-openbsd.mk +1 -1
@@ -18,7 +18,7 @@ endif define NETCAT_OPENBSD_APPLY_DEBIAN_PATCHES if [ -d $(@D)/debian/patches ]; then \ - $(APPLY_PATCHES) $(@D) $(@D)/debian/patches *.dpatch; \ + $(APPLY_PATCHES) -d $(@D) -D $(@D)/debian/patches -p *.dpatch; \ fi endef
package/pkg-autotools.mk +4 -4
@@ -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; \ + $(APPLY_PATCHES) -d $${i%/*} -D support/libtool -p buildroot-libtool-v1.5.patch; \ elif test $${ltmain_version} = "2.2"; then\ - $(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.2.patch; \ + $(APPLY_PATCHES) -d $${i%/*} -D support/libtool -p buildroot-libtool-v2.2.patch; \ 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; \ + $(APPLY_PATCHES) -d $${i%/*} -D support/libtool -p buildroot-libtool-v2.4.4.patch; \ else \ - $(APPLY_PATCHES) $${i%/*} support/libtool buildroot-libtool-v2.4.patch; \ + $(APPLY_PATCHES) -d $${i%/*} -D support/libtool -p buildroot-libtool-v2.4.patch; \ fi \ fi \ done
package/pkg-generic.mk +3 -3
@@ -165,14 +165,14 @@ $(BUILD_DIR)/%/.stamp_patched: @$(call step_start,patch) @$(call MESSAGE,"Patching") $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep)) - $(foreach p,$($(PKG)_PATCH),$(APPLY_PATCHES) $(@D) $(DL_DIR) $(notdir $(p))$(sep)) + $(foreach p,$($(PKG)_PATCH),$(APPLY_PATCHES) -d $(@D) -D $(DL_DIR) -p $(notdir $(p))$(sep)) $(Q)( \ for D in $(PATCH_BASE_DIRS); do \ if test -d $${D}; then \ if test -d $${D}/$($(PKG)_VERSION); then \ - $(APPLY_PATCHES) $(@D) $${D}/$($(PKG)_VERSION) \*.patch \*.patch.$(ARCH) || exit 1; \ + $(APPLY_PATCHES) -d $(@D) -D $${D}/$($(PKG)_VERSION) -p \*.patch \*.patch.$(ARCH) || exit 1; \ else \ - $(APPLY_PATCHES) $(@D) $${D} \*.patch \*.patch.$(ARCH) || exit 1; \ + $(APPLY_PATCHES) -d $(@D) -D $${D} -p \*.patch \*.patch.$(ARCH) || exit 1; \ fi; \ fi; \ done; \
package/setserial/setserial.mk +1 -1
@@ -18,7 +18,7 @@ define SETSERIAL_APPLY_DEBIAN_PATCHES if [ -d $(@D)/debian/patches ]; then \ touch $(@D)/gorhack.h; \ rm $(@D)/debian/patches/01_makefile.dpatch; \ - $(APPLY_PATCHES) $(@D) $(@D)/debian/patches *.dpatch; \ + $(APPLY_PATCHES) -d $(@D) -D $(@D)/debian/patches -p *.dpatch; \ fi endef
package/sysvinit/sysvinit.mk +1 -1
@@ -25,7 +25,7 @@ endif define SYSVINIT_DEBIAN_PATCHES if [ -d $(@D)/debian/patches ]; then \ - $(APPLY_PATCHES) $(@D) $(@D)/debian/patches \*.patch; \ + $(APPLY_PATCHES) -d $(@D) -D $(@D)/debian/patches -p \*.patch; \ fi endef
package/thttpd/thttpd.mk +1 -1
@@ -14,7 +14,7 @@ THTTPD_LICENSE_FILES = thttpd.c ifneq ($(THTTPD_PATCH),) define THTTPD_DEBIAN_PATCHES if [ -d $(@D)/debian/patches ]; then \ - $(APPLY_PATCHES) $(@D) $(@D)/debian/patches \*.patch; \ + $(APPLY_PATCHES) -d $(@D) -D $(@D)/debian/patches -p \*.patch; \ fi endef endif
support/scripts/apply-patches.sh +89 -49
179 lines not on this page · raw message
Signature · 1 line
2.5.5
PATCH 2/2 support/apply-patches: don't bail-out on libtool patch while using <package>-reconfigure
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.
Add a new option to apply-paches script to not bail-out on libtool patch if already present in .applied_patches_list.
--- package/pkg-autotools.mk | 8 ++++---- support/scripts/apply-patches.sh | 27 ++++++++++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-)
package/pkg-autotools.mk +4 -4
@@ -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) -d $${i%/*} -D support/libtool -p buildroot-libtool-v1.5.patch; \ + $(APPLY_PATCHES) -F -d $${i%/*} -D support/libtool -p buildroot-libtool-v1.5.patch; \ elif test $${ltmain_version} = "2.2"; then\ - $(APPLY_PATCHES) -d $${i%/*} -D support/libtool -p buildroot-libtool-v2.2.patch; \ + $(APPLY_PATCHES) -F -d $${i%/*} -D support/libtool -p buildroot-libtool-v2.2.patch; \ elif test $${ltmain_version} = "2.4"; then\ if test $${ltmain_patchlevel:-0} -gt 2; then\ - $(APPLY_PATCHES) -d $${i%/*} -D support/libtool -p buildroot-libtool-v2.4.4.patch; \ + $(APPLY_PATCHES) -F -d $${i%/*} -D support/libtool -p buildroot-libtool-v2.4.4.patch; \ else \ - $(APPLY_PATCHES) -d $${i%/*} -D support/libtool -p buildroot-libtool-v2.4.patch; \ + $(APPLY_PATCHES) -F -d $${i%/*} -D support/libtool -p buildroot-libtool-v2.4.patch; \ fi \ fi \ done
support/scripts/apply-patches.sh +20 -7
@@ -29,6 +29,7 @@ export LC_COLLATE=C # Set directories from arguments, or use defaults. sourcedir="." +noFail="no" patchdir="../kernel-patches" patchpattern="*"
@@ -36,11 +37,12 @@ main() { local OPT OPTARG # Parse our options; anything after '--' is for the backend - while getopts :hd:D:p:s OPT; do + while getopts :hd:FD:p:s OPT; do case "${OPT}" in h) help; exit 0;; d) sourcedir="${OPTARG}";; D) patchdir="${OPTARG}";; + F) noFail="yes";; p) patchpattern="${OPTARG}";; s) silent="-s";; # Option to be used by the patch tool. :) error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
@@ -119,13 +121,16 @@ function apply_patch { fi existing="$(grep -E "/${patch}\$" ${sourcedir}/.applied_patches_list || true)" if [ -n "${existing}" ]; then - echo "Error: duplicate filename '${patch}'" - echo "Conflicting files are:" - echo " already applied: ${existing}" - echo " to be applied : ${path}/${patch}" - exit 1 + if [ "${noFail}" = "no" ]; then + echo "Error: duplicate filename '${patch}'" + echo "Conflicting files are:" + echo " already applied: ${existing}" + echo " to be applied : ${path}/${patch}" + exit 1 + fi + else + echo "${path}/${patch}" >> ${sourcedir}/.applied_patches_list fi - echo "${path}/${patch}" >> ${sourcedir}/.applied_patches_list ${uncomp} "${path}/$patch" | patch -g0 -p1 -E -d "${sourcedir}" -t -N $silent if [ $? != 0 ] ; then echo "Patch failed! Please fix ${patch}!"
@@ -187,6 +192,14 @@ DESCRIPTION -D The patch directory, optional, default '../kernel-patches'. The place where are the scripts you want to apply. + -F Don't fail on already applied patch check, optional, default + "no". This option is intended to be used for libtool patches + which can be applied after autoreconf is done during + PRE_CONFIGURE_HOOKS. 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. + -p Patch name patterns, optional, default value is '*'. Pattern(s) describing the patch names you want to apply. (*.patch, *.dpatch, *.conditional...)
Signature · 1 line
2.5.5
PATCH 2/2 support/apply-patches: don't bail-out on libtool patch while using <package>-reconfigure
Quoted 10 lines · Romain Naour
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
Quoted 6 lines
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.
Add a new option to apply-paches script to not bail-out on libtool patch if already present in .applied_patches_list.
However, I wonder if it really makes sense at all to use apply_patches.sh 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 I would actually use patch directly rather than apply-patches:
patch -i support/libtool/buildroot-libtool-vxxx.patch $${i}
Use of apply-patches was introduced in f11fa22d0e88c5a3b04429a3110a3cbbf0c30c49
in 2008, I don't know why John Voltz chose to use apply-patches back then...
Regards,
Arnout
Quoted 9 lines
Signed-off-by Romain Naour <[email protected]>Cc "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>--- package/pkg-autotools.mk | 8 ++++---- support/scripts/apply-patches.sh | 27 ++++++++++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-)
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind 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
PATCH 2/2 support/apply-patches: don't bail-out on libtool patch while using <package>-reconfigure
Arnout, All,
On 2016-08-15 01:02 +0200, Arnout Vandecappelle spake thusly:
Quoted 34 lines · Romain Naour
Quoted 10 lines
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.patchQuoted 6 lines
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.
Add a new option to apply-paches script to not bail-out on libtool patch if already present in .applied_patches_list.
However, I wonder if it really makes sense at all to use
apply_patches.shfor
the libtool patches...apply_patches.shdoes 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 whereltmain.shis found, not in the top-level directory, so you have these patch lists spread over the source tree.
Quoted 3 lines
So I would actually use patch directly rather than apply-patches:
patch -i
support/libtool/buildroot-libtool-vxxx.patch$${i}
And this is probably the best proposal for master, with the updates to apply-patches.sh for next.
Romain?
Regards,
Yann E. MORIN.
Quoted 24 lines
Use of apply-patches was introduced in
f11fa22d0e88c5a3b04429a3110a3cbbf0c30c49
in 2008, I don't know why John Voltz chose to use apply-patches back then...Regards,
ArnoutQuoted 9 lines
Signed-off-by Romain Naour <[email protected]>Cc "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>--- package/pkg-autotools.mk | 8 ++++---- support/scripts/apply-patches.sh | 27 ++++++++++++++++++++------- 2 files changed, 24 insertions(+), 11 deletions(-)[snip]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind 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
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 support/apply-patches: use options rather than positional arguments
In reply to Romain NaourQuoted 10 lines · Romain Naour
In order to improve the apply-patches script in a follow up patch and ease it maintenance, use options provided by bash getopts rather than positional arguments.
Update Buildroot infra and packages but this will break existing packages from
BR2_EXTERNALusingAPPLY_PATCHES.While at it, rename builddir to sourcedir since it is really the package source directory.
Quoted 6 lines
Ref:
http://lists.busybox.net/pipermail/buildroot/2016-August/169760.htmlSigned-off-by Romain Naour <[email protected]>Cc "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>
However, I think the -d -D is a bit confusing. How about -S (sourcedir) and -P
(patchdir) instead?
We could also do a little bit of refactoring, and define a globalAPPLY_DEBIAN_PATCHES that can be used for all the debian-patched packages (it can be used directly as a POST_PATCH_HOOK). If you do that first, this commit becomes a lot smaller.
Also (but for a separate patch of course), the current defaults are totally
stupid. It would make more sense to default to *.patch for the pattern, because those are the most common ones. The default sourcedir and patchdir are probably best defined empty, so that it errors out in case those are forgotten.
And another nice addition would be an option for a single patch file, we have
quite a few of those.
But all of this is optional :-)
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind 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
PATCH 1/2 support/apply-patches: use options rather than positional arguments
Arnout, All,
On 2016-08-15 00:35 +0200, Arnout Vandecappelle spake thusly:
Quoted 14 lines · Romain Naour
Quoted 13 lines
In order to improve the apply-patches script in a follow up patch and ease it maintenance, use options provided by bash getopts rather than positional arguments.
Update Buildroot infra and packages but this will break existing packages from
BR2_EXTERNALusingAPPLY_PATCHES.While at it, rename builddir to sourcedir since it is really the package source directory.
Ref:
http://lists.busybox.net/pipermail/buildroot/2016-August/169760.html
Quoted 8 lines
Quoted 3 lines
Signed-off-by Romain Naour <[email protected]>Cc "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>However, I think the -d -D is a bit confusing. How about -S (sourcedir) and -P
(patchdir) instead?
The original proposal by Romain was to use:
-b build dir (which is in fact the source dir, but is currently
called build dir in the script)
-p patch dir
-P patch pattern
However, I think that -p and -P are too close to each other, so I asked he changed that to use options that are not too similar graphically.
With your proposal, we'd get -s and -S which are again a bit too similar.
With -d, -D , -p and -s, we now have options that are not look-alike.
Quoted 4 lines
We could also do a little bit of refactoring, and define a global
APPLY_DEBIAN_PATCHESthat can be used for all the debian-patched packages (it can be used directly as aPOST_PATCH_HOOK). If you do that first, this commit becomes a lot smaller.
Ideally, I'd prefer we fix things before adding features. Besides, we're targetting this change for master, since it is fixing a blocking regression introduced since the last release.
Quoted 4 lines
Also (but for a separate patch of course), the current defaults are totally
stupid. It would make more sense to default to *.patch for the pattern, because those are the most common ones. The default sourcedir and patchdir are probably best defined empty, so that it errors out in case those are forgotten.
Ditto for the ptach pattern: it should not be empty, IMHO.
Quoted 2 lines
And another nice addition would be an option for a single patch file, we have
quite a few of those.
Just pass the patch filename as a pattern, no?
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/2 support/apply-patches: use options rather than positional arguments
Quoted 35 lines · Yann E. MORIN
Arnout, All,
On 2016-08-15 00:35 +0200, Arnout Vandecappelle spake thusly:
Quoted 14 lines · Romain Naour
Quoted 13 lines
In order to improve the apply-patches script in a follow up patch and ease it maintenance, use options provided by bash getopts rather than positional arguments.
Update Buildroot infra and packages but this will break existing packages from
BR2_EXTERNALusingAPPLY_PATCHES.While at it, rename builddir to sourcedir since it is really the package source directory.
Ref:
http://lists.busybox.net/pipermail/buildroot/2016-August/169760.htmlQuoted 8 lines
Quoted 3 lines
Signed-off-by Romain Naour <[email protected]>Cc "Yann E. MORIN" <[email protected]>Cc Thomas Petazzoni <[email protected]>However, I think the -d -D is a bit confusing. How about -S (sourcedir) and -P
(patchdir) instead?The original proposal by Romain was to use:
-b build dir (which is in fact the source dir, but is currently
called build dir in the script)-p patch dir
-P patch pattern
Quoted 7 lines
However, I think that -p and -P are too close to each other, so I asked he changed that to use options that are not too similar graphically.
With your proposal, we'd get -s and -S which are again a bit too similar.
With -d, -D , -p and -s, we now have options that are not look-alike.
-d and -D are very alike, and there is no logic at all about which one is the
source dir and which one is the patch dir. With -S and -P, the logic is that it's capitals for the directories (Source and Patch). But of course, two different letters would be even better. How about -i for the (input) patch dir and -o for the (output) source dir?
Quoted 9 lines
Quoted 5 lines
We could also do a little bit of refactoring, and define a global
APPLY_DEBIAN_PATCHESthat can be used for all the debian-patched packages (it can be used directly as aPOST_PATCH_HOOK). If you do that first, this commit becomes a lot smaller.Ideally, I'd prefer we fix things before adding features. Besides, we're targetting this change for master, since it is fixing a blocking regression introduced since the last release.
As discussed on IRC and as per the new patch from Romain, the fix will not
affect apply-patches.sh.
Quoted 6 lines
Quoted 4 lines
Also (but for a separate patch of course), the current defaults are totally
stupid. It would make more sense to default to *.patch for the pattern, because those are the most common ones. The default sourcedir and patchdir are probably best defined empty, so that it errors out in case those are forgotten.Ditto for the ptach pattern: it should not be empty, IMHO.
Fair enough.
Quoted 5 lines
Quoted 3 lines
And another nice addition would be an option for a single patch file, we have
quite a few of those.Just pass the patch filename as a pattern, no?
That's what we do now, but compare
$(APPLY_PATCHES) -o $(@D) -i `dirname $$p` -p `basename $$p`
with
$(APPLY_PATCHES) -o $(@D) -f $$p
For me, the second is much easier to understand.
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind 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