14 |
|
# (encrypted) |
15 |
|
# invokecvs(@cmds) : invoke a cvs command supplied in @cmds |
16 |
|
# repository : return a string to indicate the repository |
17 |
< |
# |
18 |
< |
package CVSmodule; |
19 |
< |
require 5.001; |
17 |
> |
# |
18 |
> |
|
19 |
> |
package Utilities::CVSmodule; |
20 |
|
require Exporter; |
21 |
+ |
use Utilities::AddDir; |
22 |
+ |
require 5.004; |
23 |
|
@ISA= qw(Exporter); |
24 |
|
|
25 |
|
sub new { |
26 |
|
my $class=shift; |
27 |
< |
$self={}; |
27 |
> |
my $self={}; |
28 |
> |
bless $self, $class; |
29 |
|
$self->{myenv}={}; |
30 |
|
$self->{cvs}='cvs'; |
28 |
– |
# $self->{cvs}='/usr/local/bin/cvs'; |
31 |
|
# Reset All variables |
32 |
|
$self->{auth}=""; |
33 |
|
$self->{passkey}=""; |
34 |
|
$self->{user}=""; |
35 |
|
$self->{base}=""; |
36 |
< |
$self->{passbase}=$ENV{HOME}."/.cvspass"; |
35 |
< |
bless $self, $class; |
36 |
> |
$self->set_passbase("/tmp/".$>."CVSmodule/.cvspass"); |
37 |
|
return $self; |
38 |
|
} |
39 |
|
|
40 |
|
sub set_passbase { |
41 |
|
my $self=shift; |
42 |
< |
my $dir=shift; |
42 |
> |
my $file=shift; |
43 |
|
|
44 |
< |
$self->{passbase}=$dir; |
45 |
< |
$self->env("CVS_PASSFILE", $dir); |
44 |
> |
my $dir; |
45 |
> |
($dir=$file)=~s/(.*)\/.*/$1/; |
46 |
> |
AddDir::adddir($dir); |
47 |
> |
$self->{passbase}=$file; |
48 |
> |
$self->env("CVS_PASSFILE", $file); |
49 |
|
} |
50 |
|
|
51 |
|
sub set_passkey { |
78 |
|
$self=shift; |
79 |
|
$self->{auth}=shift; |
80 |
|
$self->{auth}=~s/^\:*(.*)\:*/\:$1\:/; |
81 |
+ |
|
82 |
|
$self->_updatecvsroot(); |
83 |
|
} |
84 |
|
|
91 |
|
sub invokecvs { |
92 |
|
$self=shift; |
93 |
|
@cmds=@_; |
94 |
< |
#make sure weve got the right environment |
94 |
> |
# make sure weve got the right environment |
95 |
|
foreach $key ( %{$self->{myenv}} ) { |
96 |
< |
$ENV{$key}=$self->{myenv}{$key} |
96 |
> |
$ENV{$key}=$self->{myenv}{$key}; |
97 |
|
} |
98 |
< |
#now perform the cvs command |
99 |
< |
#print ( join ' ', ( $self->{cvs}, "-d", $self->{cvsroot}, @cmds, "\n" )); |
95 |
< |
system( "$self->{cvs}" , "-d", "$self->{cvsroot}", @cmds ); |
98 |
> |
# now perform the cvs command |
99 |
> |
return ( system( "$self->{cvs}" ,"-Q", "-d", "$self->{cvsroot}", @cmds )); |
100 |
|
} |
101 |
|
|
102 |
|
sub _updatecvsroot { |
104 |
|
$self->{cvsroot}=$self->{auth}.$self->{user}.$self->{base}; |
105 |
|
} |
106 |
|
|
107 |
+ |
sub cvsroot { |
108 |
+ |
my $self=shift; |
109 |
+ |
return $self->{cvsroot}; |
110 |
+ |
} |
111 |
+ |
|
112 |
|
sub repository { |
113 |
|
my $self=shift; |
114 |
|
return $self->{base}; |