Add a hook to version METALOG using rcs(1).

This commit is contained in:
uebayasi 2011-02-16 05:18:35 +00:00
parent 7c272055e8
commit 70e2a9ceac
2 changed files with 91 additions and 1 deletions

View File

@ -1,4 +1,8 @@
# $NetBSD: Makefile,v 1.80 2010/08/15 07:27:33 mrg Exp $
# $NetBSD: Makefile,v 1.81 2011/02/16 05:18:35 uebayasi Exp $
# Experimental RCS METALOG versioning
# (Needs host's rcs(1) commands)
#RCSMETALOG=1
# The `all' target must appear before bsd.own.mk is pulled in.
all:
@ -120,13 +124,26 @@ ${METALOG}.sanitised: ${METALOG}
${TOOL_MTREE} -CSM -k all -N ${NETBSDSRCDIR}/etc <${METALOG} \
>${METALOG}.new
mv ${METALOG}.new ${METALOG}.sanitised
.if defined(RCSMETALOG)
. ./metalog.subr; \
xrcs_descr="build distribution METALOG"; \
xrcs_msg="$$(date)"; \
xrcs_cur=${METALOG}.sanitised; \
xrcs update
.endif
.if ${MKUPDATE} == "no" || !exists(${METALOG})
clean_METALOG: .PHONY
rm -f ${METALOG} ${METALOG}.*
.else # MKUPDATE
clean_METALOG: .PHONY ${METALOG}.sanitised
mv ${METALOG}.sanitised ${METALOG}
.if defined(RCSMETALOG)
mv ${METALOG}.sanitised,v ${METALOG},v
.endif
rm -f ${METALOG}.*
.if defined(RCSMETALOG)
mv ${METALOG},v ${METALOG}.sanitised,v
.endif
.endif # MKUPDATE
.endif # MKUNPRIVED

73
distrib/sets/metalog.subr Normal file
View File

@ -0,0 +1,73 @@
# $NetBSD: metalog.subr,v 1.1 2011/02/16 05:18:35 uebayasi Exp $
#
# xrcs add
# xrcs update
# xrcs remove
#
# RCS wrapper for non-interactive scripts.
# Excerpted from /etc/security.
#
xrcs_descr=
xrcs_msg=
xrcs_cur=
xrcs_new=
xrcs_unlock()
{
rcs -q -u -U -M ${xrcs_cur}
}
xrcs_ci()
{
ci -q -f -u -t-"$xrcs_descr" -m"$xrcs_msg" ${xrcs_cur}
rcs -q -kb -U ${xrcs_cur}
}
xrcs_co()
{
co -q -f -u ${xrcs_cur}
}
xrcs_init()
{
if [ -f ${xrcs_cur},v ]; then
xrcs_unlock
fi
if [ -f ${xrcs_cur} ]; then
if [ ! -f ${xrcs_cur},v ]; then
xrcs_ci
xrcs_co
fi
fi
}
xrcs_add()
{
xrcs_init
cp -p $1 ${xrcs_cur}
xrcs_ci
xrcs_co
}
xrcs_update()
{
xrcs_init
xrcs_ci
xrcs_co
}
xrcs_remove()
{
xrcs_init
cp /dev/null ${xrcs_cur}
xrcs_ci
rm ${xrcs_cur}
}
xrcs()
{
eval xrcs_$1
}