[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: CVS



Jason Gunthorpe wrote:
> 
> CVS has moved to va. I have asked Tim to update cvs.debian.org [and he
> just did] but the CVS root has also moved:
>   ":pserver:jgg@cvs.debian.org:/cvs/deity"
> (used to be /var/cvs).
> 
> Read-only is provided with the anonymous user and an empty password, that
> used to be debian.

The script I sent you (Jason) as an attachment can be used to easily
make that change to source that is already checked out.  (You will find
that that will need to be changed in every CVS/Root file).

I will attach it here for everyone else.

Behan

-- 
Behan Webster     mailto:behanw@verisim.com
+1-613-224-7547   http://www.verisim.com/
#! /usr/bin/perl
#
# Change files using perl patterns
#
# Written by: Behan Webster <behanw@pobox.com>
#

use Getopt::Long;

#
# Help file
#
($cmd) = ( $0 =~ m|^.*?([^/]+)$| );
sub usage {
	print "Usage: $cmd [--test] <perl command> [--find] <files>\n";
	print "    --find   Do a 'find -name <file>' for each file listed\n";
	print "    --test   Print changed files instead of writting them to disk\n";
	print "\n";
	print "    Example: $cmd 's/\\.verisim\\./.ott.verisim./' --find Root\n";
	exit 0;
}

#
# Set defaults
#
%opt = (
);
@args	= ( "help", "debug", "test", "find" );

#
# Include rc file
#
$rcfile = "$ENV{HOME}/.".$cmd."rc";
if(-f $rcfile) {
	require $rcfile;
}

#
# Parse options
#
usage if !GetOptions(\%opt, @args);
usage if $opt{"help"};
usage if !@ARGV;

#
# Read pattern
#
my $pattern = shift;

#
# Make list
#
my @list;
if( $opt{find} ) {
	foreach ( @ARGV ) {
		@_ = `find -name $_`;
		chomp @_;
		push( @list, @_ );
	}
} else {
	@list = @ARGV;
}

#
# change each file
#
foreach ( @list ) {
	my $buffer;
	slurp( \$buffer, $_ );
	$blah = "\$buffer =~ $pattern;";
	eval $blah;
	if( $opt{test} ) {
		print "--- $_ ---\n";
		print $buffer;
	} else {
		open( FILE, ">$_") || die "$_:$!\n"; 
		print FILE $buffer;
		close( FILE );
	}
}

exit 0;

###########################################################################

###########################################################################
# Slurp in a file
#
sub slurp {
	my ($buffer, @files) = @_;

	my $eol = $/; undef $/;			# delete the EOL character

	#
	# Slurp in file
	#
	$$buffer = "";
	push( @files, "-" ) if !@files;	# Read STDIN
	foreach (@files) {
		open(FILE, "<$_") || die "$_: $!\n";
		$$buffer .= <FILE>;			# slurp in the file
	}

	$/ = $eol;						# restore the EOL character
}


Reply to: