pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
git-package.mk: Make saner name of distfiles, reusing proper branch name
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Wed Oct 21 05:19:40 2015 +0200
Changeset: 61cc7b858467c85927cffd2eb3ec85d2744da7ca
Modified Files:
mk/git-package.mk
Log Message:
git-package.mk: Make saner name of distfiles, reusing proper branch name
XXX: TODO: optimize, make single call for git ls-remote
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=61cc7b858467c85927cffd2eb3ec85d2744da7ca
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
mk/git-package.mk | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diffs:
diff --git a/mk/git-package.mk b/mk/git-package.mk
index fb98488..d038278 100644
--- a/mk/git-package.mk
+++ b/mk/git-package.mk
@@ -87,21 +87,36 @@ _GIT_TAG.${repo}= ${GIT_TAG.${repo}}
. elif defined(GIT_TAG)
_GIT_TAG_FLAG.${repo}= -r${GIT_TAG}
_GIT_TAG.${repo}= ${GIT_TAG}
+. else
+# determine the default branch name (HEAD pointer)
+_GIT_HEAD_PTR_SHA1_CMD= \
+ ${SETENV} ${_GIT_ENV} \
+ ${_GIT_CMD} ls-remote \
+ ${GIT_REPO.${repo}:Q} \
+ | grep '[^[:graph:]]HEAD[^[:graph:]]*$$' \
+ | cut -f1
+_GIT_HEAD_PTR_SHA1= ${_GIT_HEAD_PTR_SHA1_CMD:sh}
+# dereference HEAD and get a name of the default branch
+_GIT_DEREF_HEAD_PTR_SHA1_CMD= \
+ ${SETENV} ${_GIT_ENV} \
+ ${_GIT_CMD} ls-remote \
+ ${GIT_REPO.${repo}:Q} \
+ | grep -v '[^[:graph:]]HEAD[^[:graph:]]*$$' \
+ | grep "${_GIT_HEAD_PTR_SHA1}" \
+ | cut -f2 \
+ | sed 's!^refs/heads/!!'
+${_GIT_DEREF_HEAD_PTR_SHA1_CMD}
+GIT_BRANCH.${repo}= ${_GIT_DEREF_HEAD_PTR_SHA1_CMD:sh}
+_GIT_TAG_FLAG.${repo}= --branch ${GIT_BRANCH.${repo}}
+_GIT_TAG.${repo}= ${GIT_BRANCH.${repo}}
. endif
# Cache support:
# cache file name
. 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
+_GIT_DISTFILE.${repo}= ${PKGBASE}-${GIT_MODULE.${repo}}-${GIT_BRANCH.${repo}:Q:S,/,_,}.tar.gz
. else
-_GIT_DISTFILE.${repo}= ${PKGBASE}-${GIT_MODULE.${repo}}-${_GIT_TAG.${repo}:Q}.tar.gz
+_GIT_DISTFILE.${repo}= ${PKGBASE}-${GIT_MODULE.${repo}}-${_GIT_TAG.${repo}:Q:S,/,_,}.tar.gz
. endif
# command to extract cache file
Home |
Main Index |
Thread Index |
Old Index