Commit 7a2ef6f1 authored by Leigh Stoller's avatar Leigh Stoller

Changes to switch from using tag to rtag. Note that this commit requires

a locally modifed version of CVS that does a couple of extra things. The
hacks are quite simple and currently on users. Briefly, there is a new
config file option to specify a program to run when the tag operation is
complete (similar to a module hook for rtag), and in tag.c I run that hook.

Check out a sandbox as before:

  cvs -d ops.emulab.net:/proj/$pid/templates/XXXXX/cvsrepo rtag mytag XXXXX

To create a new template (along the trunk), use the tag operation instead:

	cd sandbox
	cvs tag mtag

and what for the email that says the template is created. You can
continue to work along the trunk in this manner, although note that
the .template file is changing (by the backend commit), and you might
find it less distriacting to do a cvs update each time.

To work along a branch:

	cd sandbox
	cvs tag -r existing_tag -b newtag1
        cvs update -r newtag
        make changes and commits
	cvs tag newtag2

When working along branched you will want to do a cvs update to get
the .template file in sync.
parent 8371fc79
......@@ -114,7 +114,7 @@ wanlinksolve: wanlinksolve.cc
routecalc: routecalc.cc
${CXX} $< ${CXXFLAGS} -o $@ ${LIBS} -lm -lstdc++ ${LDFLAGS}
.PHONY: checkpass ns2ir nsverify plab ipassign checkup
.PHONY: checkpass ns2ir nsverify plab ipassign checkup template_cvsroot
checkpass:
@$(MAKE) -C checkpass all
......@@ -136,6 +136,9 @@ ipassign:
checkup:
@$(MAKE) -C checkup all
template_cvsroot:
@$(MAKE) -C template_cvsroot all
install: all script-install subdir-install
@echo "Don't forget to do a post-install as root"
......
......@@ -694,7 +694,7 @@ sub System($)
my ($command) = @_;
print STDERR "Running '$command'\n"
if ($system_debug);
if ($SYSTEM_DEBUG);
TBDebugTimeStamp($command);
my $retval = system($command);
......
......@@ -342,17 +342,18 @@ if (!$modify) {
print GUID "$guid\n";
close(GUID);
System("cd $cvsdir/CVSROOT; co -l modules taginfo") == 0
or fatal(-1, "Could not lock $cvsdir/CVSROOT/modules");
System("cd $cvsdir/CVSROOT; co -l config taginfo") == 0
or fatal(-1, "Could not lock $cvsdir/CVSROOT/config");
System("cp -fp $TB/lib/cvsroot/* $cvsdir/CVSROOT") == 0
or fatal(-1, "Could not copy cvsroot files to $cvsdir/CVSROOT!");
open(MODULES, ">> $cvsdir/CVSROOT/modules")
or fatal(-1, "Could not open $cvsdir/CVSROOT/modules for writing");
print MODULES "\n";
print MODULES "$guid -t $TB/sbin/rtag_commit $guid\n";
close(MODULES);
open(CONFIG, ">> $cvsdir/CVSROOT/config")
or fatal(-1, "Could not open $cvsdir/CVSROOT/config for writing");
print CONFIG "\n";
print CONFIG "# Added for Emulab Testbed; DO NOT DELETE!\n";
print CONFIG "TemplateCommit=$TB/sbin/rtag_commit\n";
close(CONFIG);
}
#
# We stick in a little cookie file so we know what template this is,
......@@ -373,14 +374,6 @@ if ($repotag) {
mkdir("$tmpdir", 0777) or
fatal(-1, "Could not mkdir $tmpdir: $!");
# Checkout ...
System("cd $tmpdir; $CVSBIN -d $cvsdir checkout -r $repotag $guid")
== 0 or fatal(-1, "Could not checkout tag '$repotag' from $cvsdir");
$inputfile = "$tmpdir/$guid/tbdata/nsfile.ns";
fatal(-1, "NS file missing from repo checkout!")
if (!-e $inputfile);
#
# Need the numeric revision corresponding to the tag. From that we can
# determine the branch tag.
......@@ -450,7 +443,30 @@ if ($repotag) {
fatal(-1, "Could not find branch tag for revision $revision!");
}
$repobase = $branchtag;
# Checkout ...
System("cd $tmpdir; $CVSBIN -d $cvsdir checkout -r $repotag $guid")
== 0 or fatal(-1, "Could not checkout '$repotag' from $cvsdir");
}
else {
# Checkout along trunk, no -r option cause then commit fails
System("cd $tmpdir; $CVSBIN -d $cvsdir checkout -r HEAD $guid")
== 0 or fatal(-1, "Could not checkout trunk from $cvsdir");
#
# Clear the default branch so that checkout gives us the trunk.
#
System("cd $tmpdir; $CVSBIN -d $cvsdir admin -b")
== 0 or fatal(-1, "Could not clear default branch in $cvsdir");
# And clear the sticky tag so later commit works.
System("cd $tmpdir/$guid; $CVSBIN -d $cvsdir update -A")
== 0 or fatal(-1, "Could not update to head trunk from $cvsdir");
}
$inputfile = "$tmpdir/$guid/tbdata/nsfile.ns";
fatal(-1, "NS file missing from repo checkout!")
if (!-e $inputfile);
}
#
......@@ -596,12 +612,14 @@ elsif ($repotag) {
System("cd $tmpdir/$guid; ".
"$CVSBIN commit " . (defined($repobase) ? "-r $repobase " : " ") .
" -m 'Update guid after modify' .template")
== 0 or fatal(-1, "Could not rtag final version in $cvsdir");
== 0 or fatal(-1, "Could not commit final version in $cvsdir");
#
# Tag the CVS repo with the current guid/vers so we can find it easily.
#
System("$CVSBIN -d $cvsdir rtag -n -r $repotag T${guid}-${vers} $guid")
System("$CVSBIN -d $cvsdir rtag -n " .
(defined($repobase) ? "-r $repobase " : " ") .
" T${guid}-${vers} $guid")
== 0 or fatal(-1, "Could not rtag final version in $cvsdir");
#
......
......@@ -6,6 +6,7 @@
#
use English;
use strict;
use File::Basename;
# un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
......@@ -30,6 +31,17 @@ while (@ARGV) {
or die("Could not open $CVSROOT/CVSROOT/tags!\n");
print TAGLOG "$tagname, $op, $rev\n";
close(TAGLOG);
if ($op eq "add") {
# Generate a marker to tell the post tag function
my $module = basename($repo);
my $id = getpgrp();
my $docommit = "/tmp/#cvs.docommit.${id}";
open(COM, ">$docommit")
or die("Could not write $docommit");
print COM "$module, $tagname\n";
close(COM);
}
last;
}
}
......
......@@ -29,6 +29,8 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
my $CVSROOT = $ENV{'CVSROOT'};
# locals
my $module;
my $tag;
my $baserev;
my $guid;
......@@ -38,12 +40,31 @@ my $guid;
use lib "@prefix@/lib";
use libtestbed;
# Two arguments; the module name and the new tag.
if (@ARGV != 2) {
die("Improper usage!\n");
if (@ARGV == 2) {
$module = $ARGV[0];
$tag = $ARGV[1];
}
elsif (!@ARGV) {
# See logtag ...
my $id = getpgrp();
my $docommit = "/tmp/#cvs.docommit.${id}";
die("Improper usage!\n")
if (! -e $docommit);
my $foo = `cat $docommit`;
if ($foo =~ /^(.+),\s*(.+)$/) {
$module = $1;
$tag = $2;
unlink($docommit);
}
else {
die("Improper usage!\n")
}
}
else {
die("Improper usage!\n")
}
my $module = $ARGV[0];
my $tag = $ARGV[1];
# See if the new tag is a branch tag. To do that, run rlog over the RCS
# file and look at the revision number. We count the dots. There is also
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment