After fetching the files from a CVS repository, they are packed into a

source package and placed in DISTDIR. Requests for the same CVS tag or
on the same date will then use the cached CVS archive.

Provided some progress messages.

Reordered the code sections so that the interface part is completely at
the top of the file and is clearly separated from the implementation
part.
This commit is contained in:
Roland Illig 2006-04-25 00:21:12 +00:00 committed by Thomas Klausner
parent 8c7a81e05f
commit bae4cadd21

View file

@ -1,4 +1,4 @@
# $Id: cvs-package.mk,v 1.12 2006/04/16 11:54:07 obache Exp $
# $Id: cvs-package.mk,v 1.13 2006/04/25 00:21:12 rillig Exp $
# This file provides simple access to CVS repositories, so that packages
# can be created from CVS instead of from released tarballs.
@ -39,9 +39,25 @@ _PKG_MK_CVS_PACKAGE_MK= # defined
# defaults for user-visible input variables
#
CVS_TAG?= HEAD
DISTFILES?= # empty
#
# definition of user-visible output variables
#
# commonly used repositories
CVS_ROOT_GNU= :pserver:anonymous@cvs.savannah.gnu.org:/sources
CVS_ROOT_NONGNU= ${CVS_ROOT_GNU}
CVS_ROOT_SOURCEFORGE= :pserver:anonymous:@cvs.sourceforge.net:/cvsroot
#
# End of the interface part. Start of the implementation part.
#
#
# Input validation
#
.if !defined(CVS_REPOSITORIES)
PKG_FAIL_REASON+= "[cvs-package.mk] CVS_REPOSITORIES must be set."
CVS_REPOSITORIES?= # none
@ -54,18 +70,8 @@ PKG_FAIL_REASON+= "[cvs-package.mk] CVS_ROOT."${_repo_:Q}" must be set."
. if !defined(CVS_MODULE.${_repo_})
PKG_FAIL_REASON+= "[cvs-package.mk] CVS_MODULE."${_repo_:Q}" must be set."
. endif
CVS_TAG.${_repo_}?= ${CVS_TAG}
.endfor
#
# definition of user-visible output variables
#
# commonly used repositories
CVS_ROOT_GNU= :pserver:anonymous@cvs.savannah.gnu.org:/sources
CVS_ROOT_NONGNU= ${CVS_ROOT_GNU}
CVS_ROOT_SOURCEFORGE= :pserver:anonymous:@cvs.sourceforge.net:/cvsroot
#
# Internal variables
#
@ -76,8 +82,28 @@ _CVS_ENV= # empty
_CVS_ENV+= CVS_PASSFILE=${_CVS_PASSFILE:Q}
_CVS_ENV+= CVS_RSH=${_CVS_RSH:Q}
_CVS_FLAGS= -Q
_CVS_CHECKOUT_FLAGS= -P -r ${CVS_TAG:Q}
_CVS_CHECKOUT_FLAGS= -P
_CVS_PASSFILE= ${WRKDIR}/.cvs_passwords
_CVS_TODAY_CMD= date -u +'%Y-%m-%d'
_CVS_TODAY= ${_CVS_TODAY_CMD:sh}
#
# Generation of repository-specific variables
#
.for _repo_ in ${CVS_REPOSITORIES}
. if defined(CVS_TAG.${_repo_})
_CVS_TAG_FLAG.${_repo_}= -r${CVS_TAG.${_repo_}}
_CVS_TAG.${_repo_}= ${CVS_TAG.${_repo_}}
. elif defined(CVS_TAG)
_CVS_TAG_FLAG.${_repo_}= -r${CVS_TAG}
_CVS_TAG.${_repo_}= ${CVS_TAG}
. else
_CVS_TAG_FLAG.${_repo_}= -D${_CVS_TODAY}T00:00+0
_CVS_TAG.${_repo_}= ${_CVS_TODAY:Q}
. endif
_CVS_DISTFILE.${_repo_}= ${PKGBASE}-cvs-${_CVS_TAG.${_repo_}}.tar.gz
.endfor
pre-extract: do-cvs-extract
@ -86,20 +112,28 @@ do-cvs-extract:
.for _repo_ in ${CVS_REPOSITORIES}
${_PKG_SILENT}${_PKG_DEBUG}set -e; \
cd ${WRKDIR}; \
if ${TEST} -f ${DISTDIR}/${_CVS_DISTFILE.${_repo_}:Q}; then \
${STEP_MSG} "Extracting cached CVS archive "${_CVS_DISTFILE.${_repo_}:Q}".";\
else \
case ${CVS_ROOT.${_repo_}:Q} in \
:pserver:*) \
if ${TEST} ! -f ${_CVS_PASSFILE:Q}; then \
${TOUCH} ${_CVS_PASSFILE:Q}; \
fi; \
${STEP_MSG} "Logging in to "${CVS_ROOT.${_repo_}:Q}"."; \
${SETENV} ${_CVS_ENV} ${_CVS_CMD} ${_CVS_FLAGS} \
-d ${CVS_ROOT.${_repo_}:Q} login \
;; \
*) ;; \
esac; \
${STEP_MSG} "Downloading "${CVS_MODULE.${_repo_}:Q}" from "${CVS_ROOT.${_repo_}:Q}"."; \
${SETENV} ${_CVS_ENV} \
${_CVS_CMD} ${_CVS_FLAGS} -d ${CVS_ROOT.${_repo_}:Q} \
checkout ${_CVS_CHECKOUT_FLAGS} \
-d ${_repo_:Q} ${CVS_MODULE.${_repo_}:Q}
checkout ${_CVS_CHECKOUT_FLAGS} ${_CVS_TAG_FLAG.${_repo_}:Q} \
-d ${_repo_:Q} ${CVS_MODULE.${_repo_}:Q}; \
${STEP_MSG} "Creating cached CVS archive "${_CVS_DISTFILE.${_repo_}:Q}"."; \
${PAX} -w -z -f ${DISTDIR}/${_CVS_DISTFILE.${_repo_}:Q} ${_repo_:Q}; \
fi
.endfor
.endif