pkgsrc-WIP-discuss archive

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

Re: mk/git-package.mk (eliminates caching if no updates)



Makoto Fujiwara <makoto%ki.nu@localhost> writes:

> I would like to add some modification to mk/git-package.mk.

If you're going to introduce this, do the same for all other 
VCS-based packages. The code needs refactoring, and all such
non-synchronous changes complicate it.

> 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)
> ---
> mef%NetBSD.org@localhost
> 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.$$

Follow TMPDIR settings, please!

>  # 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 grep -F "Already up-to-date" >/dev/null 2>&1; 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


-- 
HE CE3OH...


------------------------------------------------------------------------------
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
_______________________________________________
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