Subject: Re: Generating a package from a CVS checkout
To: Lars Nordlund <lars.nordlund@hem.utfors.se>
From: Roland Illig <roland.illig@gmx.de>
List: tech-pkg
Date: 11/08/2004 00:11:34
This is a multi-part message in MIME format.
--------------070708030506080101030903
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Lars Nordlund wrote:
> My first project would be to create a gtk-gnutella snapshot package. To
> make it checkout from sf.net, patch, build and install. Perhaps the
> PLIST could be automatically generated or perhaps have a hardcoded PLIST
> and take the hit every time a new file is added or removed from the
> distribution.

Here is my attempt to solve the problem.

Roland

--------------070708030506080101030903
Content-Type: text/plain;
 name="cvs-package.mk"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="cvs-package.mk"

# $NetBSD$

# Written by:
#    Roland Illig <roland.illig@gmx.de>, 2004.
#
# A package using this file shall define the following variables:
# CVS_REPOSITORY:	the CVS repository, including anoncvs password
# CVS_MODULE:		the CVS module to check out
#
# It can use the following predefined variables:
#
# CVS_REPOSITORY_SOURCEFORGE
# CVS_REPOSITORY_GNU
# CVS_REPOSITORY_NONGNU

.if !defined(_PKG_MK_CVS_PACKAGE_MK)
_PKG_MK_CVS_PACKAGE_MK=	# defined

# commonly used repositories
CVS_REPOSITORY_SOURCEFORGE= :pserver:anonymous:@cvs.sourceforge.net:/cvsroot/
CVS_REPOSITORY_GNU=	:ext:anoncvs@cvs.gnu.org:/cvsroot/
CVS_REPOSITORY_NONGNU=	${CVS_REPOSITORY_GNU}

# default values (internal)
_CVS_RSH=		ssh
_CVS_CMD=		cvs
_CVS_ENV=		CVS_PASSFILE="${_CVS_PASSFILE}"
_CVS_ENV+=		CVS_RSH="${_CVS_RSH}"
_CVS_ENV+=		CVSROOT="${_CVS_ROOT}"
_CVS_FLAGS=		-Q
_CVS_CHECKOUT_FLAGS=	-P -d ${DISTNAME}
_CVS_PASSFILE=		${WRKDIR}/.cvspass
.if defined(CVS_REPOSITORY)
_CVS_ROOT=		${CVS_REPOSITORY}
.  if defined(CVS_MODULE)
_CVS_MODULE=		${CVS_MODULE}
.  else
PKG_FAIL_REASON=	"No CVS module specified."
.  endif
.else
PKG_FAIL_REASON=	"No CVS repository specified."
.endif

# default values (public)
DISTFILES?=		# empty
NO_FETCH?=		yes

do-extract:
	${_PKG_DEBUG}${_PKG_SILENT}set -e;				\
	cd ${WRKDIR};							\
	case "${CVS_REPOSITORY}" in					\
	  :pserver:*)							\
	    if ${TEST} ! -f "${_CVS_PASSFILE}"; then			\
	      ${TOUCH} "${_CVS_PASSFILE}";				\
	    fi;								\
	    ${ENV} ${_CVS_ENV} ${_CVS_CMD} ${_CVS_FLAGS} login;;	\
	  *) ;;								\
	esac;								\
	${ENV} ${_CVS_ENV} ${_CVS_CMD} ${_CVS_FLAGS} checkout ${_CVS_CHECKOUT_FLAGS} ${_CVS_MODULE}

.endif

--------------070708030506080101030903--