ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Utilities/cvsmodule.pm
Revision: 1.2
Committed: Fri Dec 17 10:24:09 1999 UTC (25 years, 5 months ago) by williamc
Content type: text/plain
Branch: MAIN
CVS Tags: V1_pre0, ProtoEnd, HEAD
Branch point for: SCRAM_V1_BRANCH
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Log Message:
replace with CVSmodule.pm

File Contents

# User Rev Content
1 williamc 1.1 package cvsmodule;
2     require Exporter;
3     @ISA= qw(Exporter);
4    
5     sub new {
6     $self={};
7     $self->{myenv}={};
8     $self->{cvs}='cvs';
9     bless $self;
10     return $self;
11     }
12    
13     sub set_passkey {
14     use Utilities::SCRAMUtils;
15     $self=shift;
16     $self->{passkey}=shift;
17     SCRAMUtils::updatelookup($ENV{HOME}."/.cvspass",
18     $self->{cvsroot}." ", $self->{passkey});
19     }
20    
21     sub set_base {
22     $self=shift;
23     $self->{base}=shift;
24     $self->_updatecvsroot;
25     }
26     sub get_base {
27     }
28     sub set_user {
29     $self=shift;
30     $self->{user}=shift;
31     if ( $self->{user} ne "" ) {
32     $self->{user}= $self->{user}.'@';
33     }
34     $self->_updatecvsroot;
35     }
36     sub set_auth {
37     $self=shift;
38     $self->{auth}=shift;
39     $self->{auth}=~s/^\:*(.*)\:*/\:\1\:/;
40     $self->_updatecvsroot;
41     }
42    
43     sub env {
44     $self=shift;
45     my $name=shift;
46     $self->{myenv}{$name}=shift;
47     }
48    
49     sub invokecvs {
50     $self=shift;
51     @cmds=@_;
52     #make sure weve got the right environment
53     foreach $key ( %{$self->{myenv}} ) {
54     $ENV{$key}=$self->{myenv}{$key}
55     }
56     #now perform the cvs command
57     print ( join ' ', ( $self->{cvs}, "-d", $self->{cvsroot}, @cmds ));
58     system( $self->{cvs}, "-d", $self->{cvsroot}, @cmds );
59     }
60    
61     sub _updatecvsroot {
62     $self=shift;
63     $self->{cvsroot}=$self->{auth}.$self->{user}.$self->{base};
64     }