2007-12-18 13:31:24 +01:00
|
|
|
# $Id: cvs-package.mk,v 1.24 2007/12/18 12:31:24 rillig Exp $
|
2004-11-10 08:14:33 +01:00
|
|
|
|
2006-01-30 03:34:18 +01:00
|
|
|
# This file provides simple access to CVS repositories, so that packages
|
2007-09-11 23:26:08 +02:00
|
|
|
# can be created from CVS instead of from released tarballs. Whenever a
|
|
|
|
# package is fetched from CVS, an archive is created from it and saved
|
|
|
|
# in ${DISTDIR}/cvs-packages, to save bandwidth.
|
2004-11-10 08:14:33 +01:00
|
|
|
#
|
2007-09-11 23:26:08 +02:00
|
|
|
# === Package-settable variables ===
|
2004-11-10 08:14:33 +01:00
|
|
|
#
|
2007-01-16 11:54:38 +01:00
|
|
|
# CVS_REPOSITORIES
|
|
|
|
# A list of unique identifiers. For each of those identifiers, the
|
|
|
|
# following variables define the details of how to access the
|
|
|
|
# CVS repository.
|
2004-11-10 08:14:33 +01:00
|
|
|
#
|
2007-01-16 11:54:38 +01:00
|
|
|
# CVS_ROOT.${id}
|
|
|
|
# The CVSROOT for the CVS repository, including anoncvs password,
|
|
|
|
# if applicable.
|
2006-03-12 16:37:29 +01:00
|
|
|
#
|
2007-01-16 11:54:38 +01:00
|
|
|
# Examples:
|
|
|
|
# ${CVS_ROOT_GNU}/emacs
|
|
|
|
# :pserver:anoncvs:@anoncvs.example.com:/cvsroot/project
|
2006-03-12 16:37:29 +01:00
|
|
|
#
|
2007-01-16 11:54:38 +01:00
|
|
|
# CVS_MODULE.${id}
|
|
|
|
# The CVS module to check out.
|
|
|
|
#
|
|
|
|
# Default value: ${id}
|
|
|
|
#
|
|
|
|
# CVS_TAG.${id}
|
|
|
|
# Overridable CVS tag for a repository.
|
2006-03-12 16:37:29 +01:00
|
|
|
#
|
2007-09-11 23:26:08 +02:00
|
|
|
# Default: ${CVS_TAG} (today at midnight)
|
|
|
|
#
|
|
|
|
# CVS_TAG
|
|
|
|
# The default CVS tag that is checked out. May be overridden by
|
|
|
|
# CVS_TAG.${id}.
|
|
|
|
#
|
|
|
|
# Default value: today at midnight.
|
|
|
|
#
|
|
|
|
# CVS_PROJECT
|
|
|
|
# The project name to be used in CVS_ROOT_SOURCEFORGE.
|
|
|
|
#
|
|
|
|
# Default: ${PKGBASE}
|
|
|
|
#
|
|
|
|
# === Variables defined here ===
|
2006-03-12 16:37:29 +01:00
|
|
|
#
|
2007-01-16 11:54:38 +01:00
|
|
|
# CVS_ROOT_GNU
|
|
|
|
# CVS_ROOT_NONGNU
|
|
|
|
# CVS_ROOT_SOURCEFORGE
|
|
|
|
# Common CVS repository locations for use in the CVS_ROOT
|
|
|
|
# variables.
|
|
|
|
#
|
2007-05-21 13:51:12 +02:00
|
|
|
# It also provides default values for the following variables, differing
|
|
|
|
# from the system-wide defaults:
|
|
|
|
#
|
|
|
|
# DISTFILES
|
|
|
|
# Is set to an empty list, since that is the right choice for most
|
|
|
|
# of the CVS packages.
|
|
|
|
#
|
|
|
|
# PKGNAME
|
|
|
|
# Is set to consist of the package name from DISTNAME, combined
|
|
|
|
# with the current date. This is useful when no CVS_TAG variables
|
|
|
|
# are defined. When they are defined (and there may be multiple
|
|
|
|
# ones), the package author should define PKGNAME explicitly.
|
|
|
|
#
|
2007-04-11 08:42:33 +02:00
|
|
|
# Keywords: cvs
|
|
|
|
#
|
2004-11-10 08:14:33 +01:00
|
|
|
|
|
|
|
.if !defined(_PKG_MK_CVS_PACKAGE_MK)
|
|
|
|
_PKG_MK_CVS_PACKAGE_MK= # defined
|
|
|
|
|
2005-05-14 01:18:38 +02:00
|
|
|
#
|
|
|
|
# defaults for user-visible input variables
|
|
|
|
#
|
|
|
|
|
|
|
|
DISTFILES?= # empty
|
2007-05-21 13:51:12 +02:00
|
|
|
PKGNAME?= ${DISTNAME:C,-[0-9].*,,}-cvs-${_CVS_PKGVERSION}
|
2005-05-14 01:18:38 +02:00
|
|
|
|
2006-04-25 02:21:12 +02:00
|
|
|
#
|
|
|
|
# definition of user-visible output variables
|
|
|
|
#
|
|
|
|
|
|
|
|
# commonly used repositories
|
2007-01-16 11:35:35 +01:00
|
|
|
CVS_ROOT_GNU= :pserver:anonymous:@cvs.savannah.gnu.org:/sources
|
2006-04-25 02:21:12 +02:00
|
|
|
CVS_ROOT_NONGNU= ${CVS_ROOT_GNU}
|
2007-04-11 08:42:33 +02:00
|
|
|
CVS_ROOT_SOURCEFORGE= :pserver:anonymous:@${CVS_PROJECT}.cvs.sourceforge.net:/cvsroot/${CVS_PROJECT}
|
|
|
|
CVS_PROJECT?= ${PKGBASE}
|
2006-04-25 02:21:12 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# End of the interface part. Start of the implementation part.
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Input validation
|
|
|
|
#
|
|
|
|
|
2006-03-12 16:37:29 +01:00
|
|
|
.if !defined(CVS_REPOSITORIES)
|
|
|
|
PKG_FAIL_REASON+= "[cvs-package.mk] CVS_REPOSITORIES must be set."
|
|
|
|
CVS_REPOSITORIES?= # none
|
|
|
|
.endif
|
|
|
|
|
2007-11-06 15:24:41 +01:00
|
|
|
.for r in ${CVS_REPOSITORIES}
|
|
|
|
. if !defined(CVS_ROOT.${r})
|
|
|
|
PKG_FAIL_REASON+= "[cvs-package.mk] CVS_ROOT.${r} must be set."
|
2006-03-12 16:37:29 +01:00
|
|
|
. endif
|
|
|
|
.endfor
|
|
|
|
|
2005-05-14 01:18:38 +02:00
|
|
|
#
|
2006-01-30 03:34:18 +01:00
|
|
|
# Internal variables
|
2005-05-14 01:18:38 +02:00
|
|
|
#
|
|
|
|
|
2006-06-10 11:41:30 +02:00
|
|
|
USE_TOOLS+= date
|
|
|
|
|
2004-11-10 08:14:33 +01:00
|
|
|
_CVS_RSH= ssh
|
|
|
|
_CVS_CMD= cvs
|
2006-01-30 03:34:18 +01:00
|
|
|
_CVS_ENV= # empty
|
2007-11-06 15:24:41 +01:00
|
|
|
_CVS_ENV+= CVS_PASSFILE=${_CVS_PASSFILE}
|
2005-05-14 01:18:38 +02:00
|
|
|
_CVS_ENV+= CVS_RSH=${_CVS_RSH:Q}
|
2004-11-10 08:14:33 +01:00
|
|
|
_CVS_FLAGS= -Q
|
2006-04-25 02:21:12 +02:00
|
|
|
_CVS_CHECKOUT_FLAGS= -P
|
2005-05-14 01:18:38 +02:00
|
|
|
_CVS_PASSFILE= ${WRKDIR}/.cvs_passwords
|
2006-06-10 11:41:30 +02:00
|
|
|
_CVS_TODAY_CMD= ${DATE} -u +'%Y-%m-%d'
|
2006-04-25 02:21:12 +02:00
|
|
|
_CVS_TODAY= ${_CVS_TODAY_CMD:sh}
|
2007-05-21 13:51:12 +02:00
|
|
|
_CVS_PKGVERSION_CMD= ${DATE} -u +'%Y.%m.%d'
|
|
|
|
_CVS_PKGVERSION= ${_CVS_PKGVERSION_CMD:sh}
|
2006-06-10 14:30:07 +02:00
|
|
|
_CVS_DISTDIR= ${DISTDIR}/cvs-packages
|
2006-04-25 02:21:12 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Generation of repository-specific variables
|
|
|
|
#
|
|
|
|
|
2007-11-06 15:24:41 +01:00
|
|
|
.for r in ${CVS_REPOSITORIES}
|
2007-12-18 13:31:24 +01:00
|
|
|
CVS_MODULE.${r}?= ${r}
|
2007-11-06 15:24:41 +01:00
|
|
|
. if defined(CVS_TAG.${r})
|
|
|
|
_CVS_TAG_FLAG.${r}= -r${CVS_TAG.${r}}
|
|
|
|
_CVS_TAG.${r}= ${CVS_TAG.${r}}
|
2006-04-25 02:21:12 +02:00
|
|
|
. elif defined(CVS_TAG)
|
2007-11-06 15:24:41 +01:00
|
|
|
_CVS_TAG_FLAG.${r}= -r${CVS_TAG}
|
|
|
|
_CVS_TAG.${r}= ${CVS_TAG}
|
2006-04-25 02:21:12 +02:00
|
|
|
. else
|
2007-11-06 15:24:41 +01:00
|
|
|
_CVS_TAG_FLAG.${r}= -D${_CVS_TODAY}T00:00+0
|
|
|
|
_CVS_TAG.${r}= ${_CVS_TODAY:Q}
|
2006-04-25 02:21:12 +02:00
|
|
|
. endif
|
2007-11-06 15:24:41 +01:00
|
|
|
_CVS_DISTFILE.${r}= ${PKGBASE}-${CVS_MODULE.${r}}-${_CVS_TAG.${r}}.tar.gz
|
2006-04-25 02:21:12 +02:00
|
|
|
.endfor
|
2006-01-30 02:18:15 +01:00
|
|
|
|
|
|
|
pre-extract: do-cvs-extract
|
|
|
|
|
2007-12-18 13:31:24 +01:00
|
|
|
do-cvs-extract: .PHONY
|
2007-11-06 15:24:41 +01:00
|
|
|
.for r in ${CVS_REPOSITORIES}
|
2007-05-21 13:51:12 +02:00
|
|
|
${RUN} cd ${WRKDIR}; \
|
2007-11-06 15:24:41 +01:00
|
|
|
if [ -f ${_CVS_DISTDIR}/${_CVS_DISTFILE.${r}:Q} ]; then \
|
|
|
|
${STEP_MSG} "Extracting cached CVS archive "${_CVS_DISTFILE.${r}:Q}"."; \
|
|
|
|
${PAX} -r -z -f ${_CVS_DISTDIR}/${_CVS_DISTFILE.${r}:Q}; \
|
2007-05-21 13:51:12 +02:00
|
|
|
exit 0; \
|
|
|
|
fi; \
|
2007-11-06 15:24:41 +01:00
|
|
|
case ${CVS_ROOT.${r}:Q} in \
|
2004-11-10 08:14:33 +01:00
|
|
|
:pserver:*) \
|
2007-11-06 15:24:41 +01:00
|
|
|
[ -f ${_CVS_PASSFILE} ] || ${TOUCH} ${_CVS_PASSFILE}; \
|
|
|
|
${STEP_MSG} "Logging in to "${CVS_ROOT.${r}:Q}"."; \
|
2006-01-30 02:18:15 +01:00
|
|
|
${SETENV} ${_CVS_ENV} ${_CVS_CMD} ${_CVS_FLAGS} \
|
2007-11-06 15:24:41 +01:00
|
|
|
-d ${CVS_ROOT.${r}:Q} login \
|
2006-01-30 02:18:15 +01:00
|
|
|
;; \
|
2004-11-10 08:14:33 +01:00
|
|
|
*) ;; \
|
|
|
|
esac; \
|
2007-11-06 15:24:41 +01:00
|
|
|
${STEP_MSG} "Downloading "${CVS_MODULE.${r}:Q}" from "${CVS_ROOT.${r}:Q}"."; \
|
2006-01-30 03:34:18 +01:00
|
|
|
${SETENV} ${_CVS_ENV} \
|
2007-11-06 15:24:41 +01:00
|
|
|
${_CVS_CMD} ${_CVS_FLAGS} -d ${CVS_ROOT.${r}:Q} \
|
|
|
|
checkout ${_CVS_CHECKOUT_FLAGS} ${_CVS_TAG_FLAG.${r}:Q} \
|
|
|
|
-d ${r} ${CVS_MODULE.${r}:Q}; \
|
|
|
|
${STEP_MSG} "Creating cached CVS archive "${_CVS_DISTFILE.${r}:Q}"."; \
|
2006-06-10 14:30:07 +02:00
|
|
|
${MKDIR} ${_CVS_DISTDIR:Q}; \
|
2007-11-06 15:24:41 +01:00
|
|
|
${PAX} -w -z -f ${_CVS_DISTDIR}/${_CVS_DISTFILE.${r}:Q} ${r}
|
2006-01-30 02:18:15 +01:00
|
|
|
.endfor
|
2004-11-10 08:14:33 +01:00
|
|
|
|
|
|
|
.endif
|