pkgsrc-WIP-discuss archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[PATCH] mk/git-package.mk (Re: migrate to git for emacs-current (24.0.50) ?
I have experimental patch for adding cache capability for
git-package.mk. This is reminded by emacs-current conversion
to git as attached mail. The code is derived from
cvs-package.mk.
I believe git-package.mk is used by following 4 now.
cinelerra-cv
darcs-to-git
pan2-git
xf86-video-nv-current
darcs-to-git does not support x86_64, so it is not confirmed yet.
Others should be OK with this patch (pan2-git needs to add one line).
| From: Makoto Fujiwara <makoto%ki.nu@localhost>
| Subject: migrate to git for emacs-current (24.0.50) ?
| Date: Tue, 08 Jun 2010 01:32:59 +0900
MEF> It doesn't seems to me the cvs repository which wip/emacs-current
MEF> downloads from, is being updated.
MEF> Shall I convert its cvs to git repository ?
MEF> It may download huge directory and takes time. But I
MEF> don't think there is another way to go :-)
MEF> ------
MEF> modena@makoto 01:24:24/100608(..wip/emacs-current)% du -sk work/emacs/.git
MEF> 284066 work/emacs/.git
MEF> ------
---
Makoto Fujiwara,
Chiba, Japan, Narita Airport and Disneyland prefecture.
Index: mk/git-package.mk
===================================================================
RCS file: /cvsroot/pkgsrc-wip/wip/mk/git-package.mk,v
retrieving revision 1.2
diff -u -r1.2 git-package.mk
--- mk/git-package.mk 3 Mar 2010 05:06:26 -0000 1.2
+++ mk/git-package.mk 8 Jun 2010 12:19:56 -0000
@@ -24,11 +24,15 @@
BUILD_DEPENDS+= scmgit-base>=1.6.4:../../devel/scmgit-base
+# switch either (from scratch) clone is necessary or (already cloned) checkout
is enough
+_GIT_NEED_CLONE= ${WRKDIR}/.need_clone
+
#
# defaults for user-visible input variables
#
GIT_TAG?= tip
+GIT_MODULE?= ${PKGBASE}
DISTFILES?= # empty
.if empty(GIT_TAG) || ${GIT_TAG} == "tip"
@@ -37,6 +41,10 @@
PKGREVISION?= ${GIT_TAG}
.endif
+#
+# Input validation
+#
+
.if !defined(GIT_REPOSITORIES)
PKG_FAIL_REASON+= "[git-package.mk] GIT_REPOSITORIES must be set."
GIT_REPOSITORIES?= # none
@@ -55,21 +63,83 @@
_GIT_CMD= git
_GIT_ENV= # empty
-_GIT_FLAGS= --quiet --depth 1
+_GIT_FLAGS?= --quiet --depth 1
_GIT_PKGVERSION_CMD= ${DATE} -u +'%Y.%m.%d'
_GIT_PKGVERSION= ${_GIT_PKGVERSION_CMD:sh}
+_GIT_DISTDIR= ${DISTDIR}/git-package
+
+_GIT_TODAY_CMD= ${DATE} -u +'%Y-%m-%d'
+_GIT_TODAY= ${_GIT_TODAY_CMD:sh}
+
+.for _repo_ in ${GIT_REPOSITORIES}
+GIT_MODULE.${_repo_}?= ${GIT_MODULE} #${_repo_}
+
+## # determine appropriate checkout date or tag
+## . if defined(GIT_TAG.${repo})
+## _GIT_TAG_FLAG.${repo}= -r${GIT_TAG.${repo}}
+## _GIT_TAG.${repo}= ${GIT_TAG.${repo}}
+## . elif defined(GIT_TAG)
+## _GIT_TAG_FLAG.${repo}= -r${GIT_TAG}
+## _GIT_TAG.${repo}= ${GIT_TAG}
+## . elif defined(CHECKOUT_DATE)
+## _GIT_TAG_FLAG.${repo}= -D${CHECKOUT_DATE:Q}
+## _GIT_TAG.${repo}= ${CHECKOUT_DATE:Q}
+## . else
+## _GIT_TAG_FLAG.${repo}= '-D${_GIT_TODAY} 00:00 +0000'
+_GIT_TAG.${_repo_}= ${_GIT_TODAY:Q}
+## . endif
+
+# Cache support:
+# cache file name (compression is not really effective)
+_GIT_DISTFILE.${_repo_}=
${PKGBASE}-${GIT_MODULE.${_repo_}}-${_GIT_TAG.${_repo_}}.tar
+
+# command to extract cache file
+_GIT_EXTRACT_CACHED.${_repo_}= \
+ if [ -f ${_GIT_DISTDIR}/${_GIT_DISTFILE.${_repo_}:Q} ]; then
\
+ ${STEP_MSG} "(1) Extracting cached GIT archive
"${_GIT_DISTFILE.${_repo_}:Q}"."; \
+ pax -r -f ${_GIT_DISTDIR}/${_GIT_DISTFILE.${_repo_}:Q} ; \
+ fi
+
+# create cache archive
+_GIT_CREATE_CACHE.${_repo_}= \
+ ${STEP_MSG} "(4) Creating cached GIT archive
"${_GIT_DISTFILE.${_repo_}:Q} "on" ${_GIT_DISTDIR:Q}"."; \
+ ${MKDIR} ${_GIT_DISTDIR:Q}; \
+ pax -w -f ${_GIT_DISTDIR}/${_GIT_DISTFILE.${_repo_}:Q} */.git || rm
-f ${_GIT_DISTDIR}/${_GIT_DISTFILE.${_repo_}:Q}
+.endfor
pre-extract: do-git-extract
.PHONY: do-git-extract
do-git-extract:
.for _repo_ in ${GIT_REPOSITORIES}
- ${_PKG_SILENT}${_PKG_DEBUG}set -e; \
+ ${_PKG_SILENT}${_PKG_DEBUG} set -e; \
cd ${WRKDIR}; \
- ${SETENV} ${_GIT_ENV} \
+ if [ ! -d ${_GIT_DISTDIR} ]; then mkdir -p ${_GIT_DISTDIR:Q}; fi;
\
+ ${_GIT_EXTRACT_CACHED.${_repo_}}; \
+ p="$$(cd ${_GIT_DISTDIR} && ls -t ${PKGBASE}-${GIT_MODULE.${_repo_}}-*
| head -n 1)"; \
+ if [ -n "$$p" ]; then \
+ if [ "$$p" != ${_GIT_DISTFILE.${_repo_}:Q} ]; then
\
+ ${STEP_MSG} "(2) Extracting cached GIT archive \"""$$p\"."; \
+ pax -r -f ${_GIT_DISTDIR:Q}/"$$p"; \
+ fi \
+ else \
+ touch ${_GIT_NEED_CLONE}; \
+ fi; \
+ if [ -r ${_GIT_NEED_CLONE} ]; then \
+ ${STEP_MSG} "(3a) git clone from "${GIT_MODULE.${_repo_}:Q}"." ; \
${_GIT_CMD} clone \
${_GIT_FLAGS} \
- ${GIT_REPO.${_repo_}:Q}
+ ${GIT_REPO.${_repo_}:Q}; \
+ else \
+ ${STEP_MSG} "(3b) git checkout from "${GIT_MODULE.${_repo_}:Q} "." ; \
+ (cd ${GIT_MODULE};${_GIT_CMD} checkout -q -f master;) \
+ fi; \
+ if [ "$$p" != ${_GIT_DISTFILE.${_repo_}:Q} ] || [ -r ${_GIT_NEED_CLONE}
]; then \
+ ${_GIT_CREATE_CACHE.${_repo_}}; \
+ else \
+ ${STEP_MSG} "(5) Skipping write cache, the same date or newly
cloned";\
+ fi
.endfor
.endif
+# ${SETENV} ${_GIT_ENV} \
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
pkgsrc-wip-discuss mailing list
pkgsrc-wip-discuss%lists.sourceforge.net@localhost
https://lists.sourceforge.net/lists/listinfo/pkgsrc-wip-discuss
Home |
Main Index |
Thread Index |
Old Index