diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-10-05 10:39:14 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2019-10-05 10:39:14 +0200 |
commit | 675062dac763eae836ef944d9948ff5aa2068032 (patch) | |
tree | 909f60ac2b3d844b2c3008fafce8336624bbae52 | |
parent | 968d52376f6a26a7a22c622857d942e2b5570c19 (diff) | |
download | savane-gray-675062dac763eae836ef944d9948ff5aa2068032.tar.gz savane-gray-675062dac763eae836ef944d9948ff5aa2068032.tar.bz2 |
Always build CVS lockdir if it does not exist.
* backend/accounts/sv_groups (build_feature): Fix debug output.
* lib/Savane/Feature/Cvs/Basic.pm (lockdir): New method.
(build): Build lockdir if it doesn't exist, independently of
building the repo.
-rwxr-xr-x | backend/accounts/sv_groups | 4 | ||||
-rw-r--r-- | lib/Savane/Feature/Cvs/Basic.pm | 32 |
2 files changed, 26 insertions, 10 deletions
diff --git a/backend/accounts/sv_groups b/backend/accounts/sv_groups index 7af99a5..38eddfd 100755 --- a/backend/accounts/sv_groups +++ b/backend/accounts/sv_groups @@ -72,7 +72,7 @@ sub build_feature { debug("updating $ref->{unix_group_name},$feature"); if (debug_level()>1) { - debug("obj: ".Data::Dumper->new([$ref]) + debug("ref: ".Data::Dumper->new([$ref]) ->Indent(0) ->Terse(1) ->Purity(0) @@ -80,7 +80,7 @@ sub build_feature { } my $obj = backend_feature($feature, $ref); if (debug_level()>1) { - debug("ref: ".Data::Dumper->new([$obj]) + debug("obj: ".Data::Dumper->new([$obj]) ->Indent(0) ->Terse(1) ->Purity(0) diff --git a/lib/Savane/Feature/Cvs/Basic.pm b/lib/Savane/Feature/Cvs/Basic.pm index 88339d4..9bb4265 100644 --- a/lib/Savane/Feature/Cvs/Basic.pm +++ b/lib/Savane/Feature/Cvs/Basic.pm @@ -1,5 +1,5 @@ # Basic CVS layout for Savane -*- perl -*- -# Copyright (C) 2016 Sergey Poznyakoff <gray@gnu.org> +# Copyright (C) 2016, 2019 Sergey Poznyakoff <gray@gnu.org> # # This file is part of Savane. # @@ -96,13 +96,33 @@ sub commit { delete $self->{file_name}; } +sub lockdir { + my ($self) = @_; + return '/var/lock/cvs/' . $self->{group}{unix_group_name}; #FIXME +} + sub build { my $self = shift; - return $self->{status} unless $self->SUPER::build(@_); + return $self->{status} if $self->SUPER::build(@_) == FEATURE_FAIL; + return $self->{status} if $self->make_repo() == FEATURE_FAIL; + my $lockdir = $self->lockdir; + unless (-d $lockdir) { + # build the locks + $self->make_dir($lockdir); + $self->set_file_access($lockdir, $self->{group}{gidNumber}, 0777); + } + return $self->{status}; +} + +sub make_repo { + my $self = shift; + my $dir = $self->{directory}; my $group = $self->{group}; + return $self->{status} = FEATURE_UNCHANGED if -e $dir; + return $self->{status} = FEATURE_FAIL unless $self->make_dir($dir, mode => $group->{is_public} ? 02775 : 02770); @@ -111,8 +131,7 @@ sub build { unless $self->run('cvs', '-d', $dir, 'init'); $self->created("cvs $dir"); $self->{status} = FEATURE_CREATED; - - my $lockdir = '/var/lock/cvs/' . $group->{unix_group_name}; #FIXME + my $lockdir = $self->lockdir; if ($self->edit("$dir/CVSROOT/config")) { $self->append(<<EOT SystemAuth=yes @@ -158,11 +177,8 @@ EOT # history must be group writable $self->set_file_access("$dir/CVSROOT/history", $gid, 0664); - # build the locks - $self->make_dir($lockdir); - $self->set_file_access($lockdir, $gid, 0777); return $self->{status}; -} +} sub file_mtime { my ($self, $path) = @_; |