diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | README | 17 | ||||
-rw-r--r-- | lib/MGA/Git.pm | 13 |
3 files changed, 25 insertions, 6 deletions
@@ -1,4 +1,5 @@ - soft_repo.gl: Put maintainer nick in square brackets +- allow non-ldap group definitions Version 0.10 @@ -5,7 +5,7 @@ How it works mgagit takes : - an ldap directory containing groups, and users with ssh keys - - repositories definitions + - repositories and non-ldap groups definitions And generate the corresponding gitolite configuration and keys directory. @@ -77,12 +77,21 @@ The following configuration options are available : directory containing repos definitions (see repos_config) repos_config: - list of repos definition directories. Use something like - this to include a directory containing repos definitions : + list of repos and / or group definition directories. Use + something like this to include a directory containing repos or + groups definitions : prefix: - prefix in the repos tree + prefix in the repos tree. In case of git_url or include_dir, + this is also used to indicate that the included directory + defines repos (*.repo files). + group_prefix: + This value is prefixed to the defined group names. This is also + used to indicate that the included directory can contain groups + definitions (*.group files). If you don't want to have a prefix, + but still want to define groups, set an empty string. + git_url: url of a git repository containing definitions, that will be cloned and pulled, in 'repodef_dir' diff --git a/lib/MGA/Git.pm b/lib/MGA/Git.pm index c46dc4e..f87e9af 100644 --- a/lib/MGA/Git.pm +++ b/lib/MGA/Git.pm @@ -35,15 +35,24 @@ sub load_gitrepos_dir { if (-d "$infos->{include_dir}/$file") { next if $file =~ m/^\./; my %i = %$infos; - $i{prefix} .= '/' . $file; + $i{prefix} .= '/' . $file if $i{prefix}; $i{include_dir} .= '/' . $file; load_gitrepos_dir($r, \%i); - } elsif ($file =~ m/(.+)\.repo$/) { + } elsif ($file =~ m/(.+)\.repo$/ && $infos->{prefix}) { my $bname = $1; my $name = "$infos->{prefix}/$bname"; $r->{repos}{$name} = LoadFile("$infos->{include_dir}/$file"); $r->{repos}{$name}{name} = $bname; @{$r->{repos}{$name}}{keys %$infos} = values %$infos; + } elsif ($file =~ m/(.+)\.group$/ && exists $infos->{group_prefix}) { + my $bname = $1; + my $name = $infos->{group_prefix} . $bname; + if (exists $r->{groups}{$name}) { + print STDERR "Warning: Redifinition of $name group.\n"; + next; + } + $r->{groups}{$name} = [ read_file("$infos->{include_dir}/$file") ]; + chomp @{$r->{groups}{$name}}; } } closedir $dh; |