Patchwork [v2] Add support for plain URL in $(PKG)_PATCH variable

login
register
mail settings
Submitter Jérôme Pouiller
Date May 13, 2013, 3:51 p.m.
Message ID <1368460312-9566-1-git-send-email-jezz@sysmic.org>
Download mbox | patch
Permalink /patch/243427/
State Accepted
Commit 3e2d828c0a5c69a4b2929f330426d93e47ec5d25
Headers show

Comments

Jérôme Pouiller - May 13, 2013, 3:51 p.m.
Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball.
This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly
handle them.

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>

---
v2: 
  - Rebase to apply to HEAD
  - Drop patch called "Add $(PKG_NAME) in name of downloaded patches" since I am
    not personally convinced of its usefulness

---
 package/pkg-generic.mk |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Yann E. MORIN - May 13, 2013, 8:59 p.m.
Jérôme, All,

On 2013-05-13 17:51 +0200, Jérôme Pouiller spake thusly:
> Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball.
> This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly
> handle them.
> 
> Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>

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

Regards,
Yann E. MORIN.
Markos Chandras - May 14, 2013, 9:51 a.m.
On 13 May 2013 21:59, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> Jérôme, All,
>
> On 2013-05-13 17:51 +0200, Jérôme Pouiller spake thusly:
>> Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball.
>> This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly
>> handle them.
>>
>> Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
>
> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>

The patch looks good to me.

Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>

--
Regards,
Markos Chandras
Peter Korsgaard - Sept. 7, 2013, 6:12 a.m.
>>>>> "Jérôme" == Jérôme Pouiller <jezz@sysmic.org> writes:

 Jérôme> Until now, $(PKG)_PATCH allow only to download patches from same URL than tarball.
 Jérôme> This patch allow to detect when plain URL are used in $(PKG)_PATCH and correctly
 Jérôme> handle them.

 Jérôme> Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>

 Jérôme> ---
 Jérôme> v2: 
 Jérôme>   - Rebase to apply to HEAD
 Jérôme>   - Drop patch called "Add $(PKG_NAME) in name of downloaded patches" since I am
 Jérôme>     not personally convinced of its usefulness

Committed, thanks.

Patch

diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index d25797c..db34c13 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -40,7 +40,12 @@  ifeq ($(DL_MODE),DOWNLOAD)
 	fi
 endif
 	$(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE:/=)/$($(PKG)_SOURCE)))
-	$(foreach p,$($(PKG)_PATCH),$(call DOWNLOAD,$($(PKG)_SITE:/=)/$(p))$(sep))
+	$(foreach p,$($(PKG)_PATCH),\
+		$(if $(findstring ://,$(p)),\
+			$(call DOWNLOAD,$(p)),\
+			$(call DOWNLOAD,$($(PKG)_SITE:/=)/$(p))\
+		)\
+	$(sep))
 	$(foreach hook,$($(PKG)_POST_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 ifeq ($(DL_MODE),DOWNLOAD)
 	$(Q)mkdir -p $(@D)
@@ -86,7 +91,7 @@  $(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS = $($(PKG)_DIR_PREFIX)/$(RAWNAME)
 $(BUILD_DIR)/%/.stamp_patched:
 	@$(call MESSAGE,"Patching $($(PKG)_DIR_PREFIX)/$(RAWNAME)")
 	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
-	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(p)$(sep))
+	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(sep))
 	$(Q)( \
 	for D in $(PATCH_BASE_DIRS); do \
 	  if test -d $${D}; then \