Index: /usr/ports/Mk/bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.409 diff -u -r1.409 bsd.port.mk --- /usr/ports/Mk/bsd.port.mk 4 Apr 2002 10:06:00 -0000 1.409 +++ /usr/ports/Mk/bsd.port.mk 22 Apr 2002 14:42:00 -0000 @@ -553,7 +570,13 @@ CHMOD?= /bin/chmod CHOWN?= /usr/sbin/chown CP?= /bin/cp +CPIO?= /usr/bin/cpio CUT?= /usr/bin/cut +.if defined(NO_CVS) +CVS?= ${LOCALBASE}/bin/cvs +.else +CVS?= /usr/bin/cvs +.endif DC?= /usr/bin/dc EGREP?= /usr/bin/egrep EXPR?= /bin/expr @@ -3423,6 +3446,66 @@ @${DO_NADA} .endif .endif + +# +# Create a local cvs repository for this port. +# This target also makes the work source be checked out from this repository, +# so cvs diff works directly, and it runs 'make patch' for you. +# The normal use for a cvs port would be 'make cvs && make install' rather +# than 'make install' directly'. +# +cvs: + @(cd ${MASTERDIR} && ${MAKE} cvs-baseline && ${MAKE} patch && \ + ${MAKE} cvs-patched) + +# +# Build the baseline for a port - this is an initialized CVS repository, with +# a vendor branch named 'VIRGIN' that contains an unmodified version of the +# source code for the port. +# NOTE: This use 'cvs import', and is thus not graceful towards removal of +# files. +# +# ${WRKSRC} is changed to be a checkout from the vendor branch in the +# port-local CVS repository, and the old source code is stored in +# ${WRKSRC}.orig +# +# This should be a suitable state for applying the active FreeBSD patches for +# the port, and finishing them off for a new version of the port. +# +_CVSTAG!=echo ${PORTVERSION} | tr '.' '_' +cvs-baseline: extract + @# We do NOT allow anything beyond extract to have happened + @(if [ -e ${PATCH_COOKIE} ]; then \ + echo ">>> Please clean out the port before creating cvs repository."; \ + exit 1; \ + fi) + ${CVS} -d ${MASTERDIR}/cvstree init + @# Import the source code available + (cd ${WRKSRC} && \ + ${CVS} -Q -d ${MASTERDIR}/cvstree import \ + -m"Virgin import of ${PORTVERSION}" cvssrc VIRGIN V${_CVSTAG}) + @# The following will cause an error if WRKSRC ends with a /. Oh, well. + ${MV} ${WRKSRC} ${WRKSRC}.orig + ${CVS} -Q -d ${MASTERDIR}/cvstree checkout -d ${WRKSRC} -kb -rVIRGIN cvssrc + +# +# Import the data presently in the tree on the HEAD branch (the main +# development line) for this CVS tree. +# This makes it possible to reproduce the patch set for the port with +# cvs diff -rVIRGIN +# in ${WRKSRC}. +# ${WRKSRC} is also changed to be a checked out copy of HEAD instead of the +# vendor branch that was left from 'make cvs'. +# +# This should be a suitable state for doing further development of the code in +# the port itself, for submission back to the authors of the package. +# +cvs-patched: ${PATCH_COOKIE} + ${CVS} -d ${MASTERDIR}/cvstree -Q checkout -d ${WRKDIR}/cleanhead cvssrc + (cd ${WRKDIR}/cleanhead && ${FIND} . -path '*/CVS/*' -type f | \ + ${CPIO} --quiet -o -H crc | (cd ${WRKSRC} && ${CPIO} --quiet -i)) + ${RM} -rf ${WRKDIR}/cleanhead + (cd ${WRKSRC} && ${CVS} commit -m"Add patches for ${PORTVERSION}") # Depend is generally meaningless for arbitrary ports, but if someone wants # one they can override this. This is just to catch people who've gotten into