#!/usr/bin/perl -w my($cvsRoot) = '/opt/cvsroot/'; my($exportDir) = '/opt/httpd/html/cift/'; my(@importFiles) = qw(); my(@files_to_unlink) = qw(); my(@files_to_export) = qw(); my($subDir) = ""; my($fileList) = ""; # # make argv[0] into a list of files # first token is the subdirectory # if ($ARGV[0] =~ /^(\S+?) (.+)$/) { $subDir = $1; my($rest) = $2; # in case of 'import' we have to parse input if ($rest eq "- Imported sources") { while() { chomp; if ($_ =~ /^Update of /) { # not really needed $subDir = $_; $subDir =~ s/^Update of $cvsRoot//; } elsif ($_ =~ /^(U|N) (\S+)$/) { # can lead astray for some log messages my $fname = $2; $fname =~ s|//+|/|g; push(@importFiles, $fname); } } # new (marked with N flag) files need not to be removed @files_to_unlink = @importFiles; @files_to_export = @importFiles; } elsif ($rest eq "- New directory") { # is this really needed? push(@files_to_export, $subDir); } elsif ($rest =~ /^- /) { die "Unknown argument"; } else { my(@fileInfo) = split(' ', $rest); foreach my($fileInfo) (@fileInfo) { my ($fname, $in_rev, $out_rev) = split(',', $fileInfo); unless (defined $out_rev) { $out_rev = $in_rev; undef $in_rev; } push(@files_to_unlink, $subDir . "/" . $fname) unless ($in_rev eq "NONE"); push(@files_to_export, $subDir . "/" . $fname) unless ($out_rev eq "NONE"); } } } else { die "No arguments"; } # # remove any existing versions of the files # unlink(map {$exportDir.'/'.$_ } @files_to_unlink); # # export the files # $fileList = join(' ',@files_to_export); umask 002; # umask command is available only in csh and bash shells my($output) = `cd $exportDir; /usr/bin/cvs -d $cvsRoot export -D now $fileList`;