mk/git-package.mk (eliminates caching if no updates)
Makoto Fujiwara <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.pkgsrc.wip.general |
|---|---|
| Message-ID | <yfmvcthyo2b.wl%[email protected]> |
I would like to add some modification to mk/git-package.mk. The changes eliminates storing cache tar file if Git found no update since unpacked version of existing cache tar file. To detect 'Already up-to-date' string when 'git pull origin master' issued, I have used 'grep' 'tee' and /tmp/git-package.$$ temporary file. I don't think to use hardcoded those names is the right thing. But at least these works with one example with me. Please advice to the good Makefile authoring, Thank you, (by the way, deleting temporary file is not implemented. I will add it later) --- [email protected] 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.6 diff -u -r1.6 git-package.mk --- mk/git-package.mk 30 Dec 2010 09:50:41 -0000 1.6 +++ mk/git-package.mk 29 Aug 2011 01:53:03 -0000 @@ -24,6 +24,7 @@ BUILD_DEPENDS+= scmgit-base>=1.6.4:../../devel/scmgit-base USE_TOOLS+= pax +_GIT_TMP_RESULT= /tmp/git-package.$$ # switch either (from scratch) clone is necessary or (already cloned) checkout is enough _GIT_NEED_CLONE= ${WRKDIR}/.need_clone @@ -142,12 +143,17 @@ ${STEP_MSG} "(3b) git pull origin master from "${GIT_MODULE.${_repo_}:Q} "." ; \ (cd ${GIT_MODULE}; \ ${_GIT_CMD} pull ${GIT_FLAGS} origin master && \ - ${_GIT_CMD} checkout --quiet -f master ; ) \ + ${_GIT_CMD} checkout --quiet -f master \ + | tee ${_GIT_TMP_RESULT} ) \ fi; \ + if [ x`grep 'Already up-to-date' ${_GIT_TMP_RESULT}` != x ]; then \ 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 \ + else \ + ${STEP_MSG} "(6) Skipping write cache, Alread up-to-date.";\ fi .endfor ------------------------------------------------------------------------------ EMC VNX: the world's simplest storage, starting under $10K The only unified storage solution that offers unified management Up to 160% more powerful than alternatives and 25% more efficient. Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev