Skip to contentSkip to conversation

pkg-download with git and not VERSION set in package

PATCH New Patrick Boettcher 2 participants 3 messages Mar 29, 2013 – Apr 4, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pkg-download with git and not VERSION set in package

I'm new to buildroot and was playing with a local git-tree. I noticed that things weren't working when VERSION is not set in the package.

The following patch is trivial but solves the problem with the current implemenation.

Please copy me on replies as I'm not yet subscribed.

Patrick Boettcher (1):
pkg-download: take some more care of <PKG_>VERSION when METHOD is git

 package/pkg-download.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
1.7.10.4

#1 lore raw

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

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.

---
 package/pkg-download.mk |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-download.mk +1 -1
index 1705fcd..d21605a 100644
@@ -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) && \
Signature · 1 line
1.7.10.4
#2 lore raw

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

Quoted 7 lines · Patrick Boettcher

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

Quoted 20 lines
---
  package/pkg-download.mk |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-download.mk +1 -1
index 1705fcd..d21605a 100644
@@ -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) && \
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:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F