Patchwork pkg-download: take some more care of <PKG_>VERSION when METHOD is git

login
register
mail settings
Submitter Patrick Boettcher
Date March 29, 2013, 2:07 p.m.
Message ID <1364566078-29535-2-git-send-email-Patrick.Boettcher@parrot.com>
Download mbox | patch
Permalink /patch/232419/
State Changes Requested
Headers show

Comments

Patrick Boettcher - March 29, 2013, 2:07 p.m.
If a package's SITE_METHOD is set to git, but the VERSION is not set
it fails to create a tar-ball, this patch is fixes this by always using
HEAD as git-archive reference.

HEAD will work in both cases:
1) if VERSION is set the clone's HEAD is VERSION,
2) if VERSION is not set the clone's HEAD is the default branch.

Signed-off-by: Patrick Boettcher <Patrick.Boettcher@parrot.com>
---
 package/pkg-download.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Arnout Vandecappelle - April 4, 2013, 11:41 a.m.
On 29/03/13 15:07, Patrick Boettcher wrote:
> If a package's SITE_METHOD is set to git, but the VERSION is not set
> it fails to create a tar-ball, this patch is fixes this by always using
> HEAD as git-archive reference.
>
> HEAD will work in both cases:
> 1) if VERSION is set the clone's HEAD is VERSION,
> 2) if VERSION is not set the clone's HEAD is the default branch.

  This doesn't work if the version is an unnamed sha1. In that case, a 
full clone will be done so HEAD does not point to the requested version.

  A better solution is probably to have <PKG>_VERSION default to HEAD if 
the site-method is one of the revision control systems.


  Regards,
  Arnout

>
> Signed-off-by: Patrick Boettcher <Patrick.Boettcher@parrot.com>
> ---
>   package/pkg-download.mk |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/package/pkg-download.mk b/package/pkg-download.mk
> index 1705fcd..d21605a 100644
> --- a/package/pkg-download.mk
> +++ b/package/pkg-download.mk
> @@ -88,7 +88,7 @@ define DOWNLOAD_GIT
>   	  (echo "Doing full clone" && \
>   	   $(GIT) clone --bare $($(PKG)_SITE) $($(PKG)_BASE_NAME))) && \
>   	pushd $($(PKG)_BASE_NAME) > /dev/null && \
> -	$(GIT) archive --format=tar --prefix=$($(PKG)_BASE_NAME)/ $($(PKG)_DL_VERSION) | \
> +	$(GIT) archive --format=tar --prefix=$($(PKG)_BASE_NAME)/ HEAD | \
>   		gzip -c > $(DL_DIR)/$($(PKG)_SOURCE) && \
>   	popd > /dev/null && \
>   	rm -rf $($(PKG)_DL_DIR) && \
>

Patch

diff --git a/package/pkg-download.mk b/package/pkg-download.mk
index 1705fcd..d21605a 100644
--- a/package/pkg-download.mk
+++ b/package/pkg-download.mk
@@ -88,7 +88,7 @@  define DOWNLOAD_GIT
 	  (echo "Doing full clone" && \
 	   $(GIT) clone --bare $($(PKG)_SITE) $($(PKG)_BASE_NAME))) && \
 	pushd $($(PKG)_BASE_NAME) > /dev/null && \
-	$(GIT) archive --format=tar --prefix=$($(PKG)_BASE_NAME)/ $($(PKG)_DL_VERSION) | \
+	$(GIT) archive --format=tar --prefix=$($(PKG)_BASE_NAME)/ HEAD | \
 		gzip -c > $(DL_DIR)/$($(PKG)_SOURCE) && \
 	popd > /dev/null && \
 	rm -rf $($(PKG)_DL_DIR) && \