summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/rcs/rcsfreeze
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2013-10-09 17:07:20 +0000
committergjb <gjb@FreeBSD.org>2013-10-09 17:07:20 +0000
commitc5342bffee8407caeac0b651549206d534dfccb9 (patch)
treeca04a5cf90c8299963a38ecf5beb3ec437b5f1b1 /gnu/usr.bin/rcs/rcsfreeze
parentb33524a23e69ae8f48928d5b941a9a25a4609f30 (diff)
downloadFreeBSD-src-c5342bffee8407caeac0b651549206d534dfccb9.zip
FreeBSD-src-c5342bffee8407caeac0b651549206d534dfccb9.tar.gz
Revert r256095, r256120 (partial), r256121:
r256095: - Add gnu/usr.bin/rcs back to the base system. r256120: - Add WITHOUT_RCS back to src.conf.5. r256121: - Remove UPDATING entry regarding gnu/usr.bin/rcs removal. Requested by: many Approved by: re (marius) Discussed with: core
Diffstat (limited to 'gnu/usr.bin/rcs/rcsfreeze')
-rw-r--r--gnu/usr.bin/rcs/rcsfreeze/Makefile7
-rw-r--r--gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.168
-rw-r--r--gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh99
3 files changed, 174 insertions, 0 deletions
diff --git a/gnu/usr.bin/rcs/rcsfreeze/Makefile b/gnu/usr.bin/rcs/rcsfreeze/Makefile
new file mode 100644
index 0000000..1b249c7
--- /dev/null
+++ b/gnu/usr.bin/rcs/rcsfreeze/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+SCRIPTS= rcsfreeze.sh
+MAN= rcsfreeze.1
+
+.include "../../Makefile.inc"
+.include <bsd.prog.mk>
diff --git a/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.1 b/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.1
new file mode 100644
index 0000000..3f513c4
--- /dev/null
+++ b/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.1
@@ -0,0 +1,68 @@
+.de Id
+.ds Rv \\$3
+.ds Dt \\$4
+..
+.Id $FreeBSD$
+.ds r \s-1RCS\s0
+.TH RCSFREEZE 1 \*(Dt GNU
+.SH NAME
+rcsfreeze \- freeze a configuration of sources checked in under RCS
+.SH SYNOPSIS
+.B rcsfreeze
+.RI [ "name" ]
+.SH DESCRIPTION
+.B rcsfreeze
+assigns a symbolic revision
+number to a set of \*r files that form a valid configuration.
+.PP
+The idea is to run
+.B rcsfreeze
+each time a new version is checked
+in. A unique symbolic name (\c
+.BI C_ number,
+where
+.I number
+is increased each time
+.B rcsfreeze
+is run) is then assigned to the most
+recent revision of each \*r file of the main trunk.
+.PP
+An optional
+.I name
+argument to
+.B rcsfreeze
+gives a symbolic name to the configuration.
+The unique identifier is still generated
+and is listed in the log file but it will not appear as
+part of the symbolic revision name in the actual \*r files.
+.PP
+A log message is requested from the user for future reference.
+.PP
+The shell script works only on all \*r files at one time.
+All changed files must be checked in already.
+Run
+.IR rcsclean (1)
+first and see whether any sources remain in the current directory.
+.SH FILES
+.TP
+.B RCS/.rcsfreeze.ver
+version number
+.TP
+.B RCS/.rcsfreeze.log
+log messages, most recent first
+.SH AUTHOR
+Stephan v. Bechtolsheim
+.SH "SEE ALSO"
+co(1), rcs(1), rcsclean(1), rlog(1)
+.SH BUGS
+.B rcsfreeze
+does not check whether any sources are checked out and modified.
+.PP
+Although both source file names and RCS file names are accepted,
+they are not paired as usual with RCS commands.
+.PP
+Error checking is rudimentary.
+.PP
+.B rcsfreeze
+is just an optional example shell script, and should not be taken too seriously.
+See \s-1CVS\s0 for a more complete solution.
diff --git a/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh b/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh
new file mode 100644
index 0000000..be79406
--- /dev/null
+++ b/gnu/usr.bin/rcs/rcsfreeze/rcsfreeze.sh
@@ -0,0 +1,99 @@
+#! /bin/sh
+
+# rcsfreeze - assign a symbolic revision number to a configuration of RCS files
+
+# $FreeBSD$
+
+# The idea is to run rcsfreeze each time a new version is checked
+# in. A unique symbolic revision number (C_[number], where number
+# is increased each time rcsfreeze is run) is then assigned to the most
+# recent revision of each RCS file of the main trunk.
+#
+# If the command is invoked with an argument, then this
+# argument is used as the symbolic name to freeze a configuration.
+# The unique identifier is still generated
+# and is listed in the log file but it will not appear as
+# part of the symbolic revision name in the actual RCS file.
+#
+# A log message is requested from the user which is saved for future
+# references.
+#
+# The shell script works only on all RCS files at one time.
+# It is important that all changed files are checked in (there are
+# no precautions against any error in this respect).
+# file names:
+# {RCS/}.rcsfreeze.ver version number
+# {RCS/}.rscfreeze.log log messages, most recent first
+
+PATH=/bin:/usr/bin:$PATH
+export PATH
+
+DATE=`LC_ALL=C date` || exit
+# Check whether we have an RCS subdirectory, so we can have the right
+# prefix for our paths.
+if test -d RCS
+then RCSDIR=RCS/ EXT=
+else RCSDIR= EXT=,v
+fi
+
+# Version number stuff, log message file
+VERSIONFILE=${RCSDIR}.rcsfreeze.ver
+LOGFILE=${RCSDIR}.rcsfreeze.log
+# Initialize, rcsfreeze never run before in the current directory
+test -r $VERSIONFILE || { echo 0 >$VERSIONFILE && >>$LOGFILE; } || exit
+
+# Get Version number, increase it, write back to file.
+VERSIONNUMBER=`cat $VERSIONFILE` &&
+VERSIONNUMBER=`expr $VERSIONNUMBER + 1` &&
+echo $VERSIONNUMBER >$VERSIONFILE || exit
+
+# Symbolic Revision Number
+SYMREV=C_$VERSIONNUMBER
+# Allow the user to give a meaningful symbolic name to the revision.
+SYMREVNAME=${1-$SYMREV}
+echo >&2 "rcsfreeze: symbolic revision number computed: \"${SYMREV}\"
+rcsfreeze: symbolic revision number used: \"${SYMREVNAME}\"
+rcsfreeze: the two differ only when rcsfreeze invoked with argument
+rcsfreeze: give log message, summarizing changes (end with EOF or single '.')" \
+ || exit
+
+# Stamp the logfile. Because we order the logfile the most recent
+# first we will have to save everything right now in a temporary file.
+TMPLOG=/tmp/rcsfrz$$
+trap 'rm -f $TMPLOG; exit 1' 1 2 13 15
+# Now ask for a log message, continously add to the log file
+(
+ echo "Version: $SYMREVNAME($SYMREV), Date: $DATE
+-----------" || exit
+ while read MESS
+ do
+ case $MESS in
+ .) break
+ esac
+ echo " $MESS" || exit
+ done
+ echo "-----------
+" &&
+ cat $LOGFILE
+) >$TMPLOG &&
+
+# combine old and new logfiles
+cp $TMPLOG $LOGFILE &&
+rm -f $TMPLOG &&
+
+# Now the real work begins by assigning a symbolic revision number
+# to each rcs file. Take the most recent version on the default branch.
+
+# If there are any .*,v files, throw them in too.
+# But ignore RCS/.* files that do not end in ,v.
+DOTFILES=
+for DOTFILE in ${RCSDIR}.*,v
+do
+ if test -f "$DOTFILE"
+ then
+ DOTFILES="${RCSDIR}.*,v"
+ break
+ fi
+done
+
+exec rcs -q -n$SYMREVNAME: ${RCSDIR}*$EXT $DOTFILES
OpenPOWER on IntegriCloud