pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

git-package: Add support for git branches



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Fri Sep 25 01:42:22 2015 +0200
Changeset:	24394ee31b66c2efb27912c5f10952da4ed48994

Modified Files:
	mk/git-package.mk

Log Message:
git-package: Add support for git branches

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=24394ee31b66c2efb27912c5f10952da4ed48994

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 mk/git-package.mk | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diffs:
diff --git a/mk/git-package.mk b/mk/git-package.mk
index 79c9e68..cba08a1 100644
--- a/mk/git-package.mk
+++ b/mk/git-package.mk
@@ -12,6 +12,9 @@
 #
 # It may define the following variables:
 #
+#	GIT_BRANCH.${id}
+#		The branch to check out.
+#
 #	GIT_TAG
 #		The tag to check out (default: HEAD).
 #
@@ -75,7 +78,10 @@ _GIT_DISTDIR=		${DISTDIR}/git-packages
 GIT_MODULE.${repo}?=	${repo}
 
 # determine appropriate checkout date or tag
-.  if defined(GIT_TAG.${repo})
+.  if defined(GIT_BRANCH.${repo})
+_GIT_TAG_FLAG.${repo}=	-b${GIT_BRANCH.${repo}}
+_GIT_TAG.${repo}=	${GIT_BRANCH.${repo}}
+.  elif defined(GIT_TAG.${repo})
 _GIT_TAG_FLAG.${repo}=	-r${GIT_TAG.${repo}}
 _GIT_TAG.${repo}=	${GIT_TAG.${repo}}
 .  elif defined(GIT_TAG)
@@ -85,7 +91,18 @@ _GIT_TAG.${repo}=	${GIT_TAG}
 
 # Cache support:
 #   cache file name
-_GIT_DISTFILE.${repo}=	${PKGBASE}-${GIT_MODULE.${repo}}-${_GIT_TAG.${repo}}.tar.gz
+.  if defined(GIT_BRANCH.${repo})
+_GIT_DISTNAME_SHA1_CMD= \
+	${SETENV} ${_GIT_ENV}				\
+	${_GIT_CMD} ls-remote				\
+	${GIT_REPO.${repo}:Q}				\
+	| grep refs/heads/${GIT_BRANCH.${repo}:Q} 	\
+	| cut -f1
+_GIT_DISTNAME_SHA1=	${_GIT_DISTNAME_SHA1_CMD:sh}
+_GIT_DISTFILE.${repo}=	${PKGBASE}-${GIT_MODULE.${repo}}-${_GIT_DISTNAME_SHA1:Q}.tar.gz
+.  elif defined(GIT_TAG.${repo}) || defined(GIT_TAG)
+_GIT_DISTFILE.${repo}=	${PKGBASE}-${GIT_MODULE.${repo}}-${_GIT_TAG.${repo}:Q}.tar.gz
+.  endif
 
 #   command to extract cache file
 _GIT_EXTRACT_CACHED.${repo}=	\


Home | Main Index | Thread Index | Old Index