(data format change) fix misnamed 'repo_config' to 'git_configs'

this change includes a minor data format change.  This should be mostly
transparent for upgrades though.
This commit is contained in:
Sitaram Chamarty 2011-01-01 11:32:58 +05:30
parent 27081ad1c1
commit 7fc1e9459f
9 changed files with 23 additions and 23 deletions

View file

@ -43,9 +43,9 @@ our $ADC_CMD_ARGS_PATT=qr(^[0-9a-zA-Z._\@/+:-]*$);
our ($REPO_UMASK, $GL_WILDREPOS, $GL_PACKAGE_CONF, $GL_PACKAGE_HOOKS, $REPO_BASE, $GL_CONF_COMPILED, $GL_BIG_CONFIG, $GL_PERFLOGT, $PROJECTS_LIST, $GL_ALL_INCLUDES_SPECIAL, $GL_SITE_INFO, $GL_GET_MEMBERSHIPS_PGM, $GL_WILDREPOS_PERM_CATS); our ($REPO_UMASK, $GL_WILDREPOS, $GL_PACKAGE_CONF, $GL_PACKAGE_HOOKS, $REPO_BASE, $GL_CONF_COMPILED, $GL_BIG_CONFIG, $GL_PERFLOGT, $PROJECTS_LIST, $GL_ALL_INCLUDES_SPECIAL, $GL_SITE_INFO, $GL_GET_MEMBERSHIPS_PGM, $GL_WILDREPOS_PERM_CATS);
our %repos; our %repos;
our %groups; our %groups;
our %repo_config; our %git_configs;
our $data_version; our $data_version;
our $current_data_version = '1.6'; our $current_data_version = '1.7';
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# convenience subs # convenience subs
@ -453,14 +453,14 @@ sub get_set_desc
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# set/unset repo configs # set/unset git configs
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
sub setup_repo_configs sub setup_git_configs
{ {
my ($repo, $repo_config_p) = @_; my ($repo, $git_configs_p) = @_;
while ( my ($key, $value) = each(%{ $repo_config_p->{$repo} }) ) { while ( my ($key, $value) = each(%{ $git_configs_p->{$repo} }) ) {
if ($value) { if ($value) {
$value =~ s/^"(.*)"$/$1/; $value =~ s/^"(.*)"$/$1/;
system("git", "config", $key, $value); system("git", "config", $key, $value);
@ -588,7 +588,7 @@ sub parse_acl
$repos{$dr}{DELETE_IS_D} = 1 if $repos{$r}{DELETE_IS_D}; $repos{$dr}{DELETE_IS_D} = 1 if $repos{$r}{DELETE_IS_D};
$repos{$dr}{CREATE_IS_C} = 1 if $repos{$r}{CREATE_IS_C}; $repos{$dr}{CREATE_IS_C} = 1 if $repos{$r}{CREATE_IS_C};
$repos{$dr}{NAME_LIMITS} = 1 if $repos{$r}{NAME_LIMITS}; $repos{$dr}{NAME_LIMITS} = 1 if $repos{$r}{NAME_LIMITS};
$repo_config{$dr} = $repo_config{$r} if $repo_config{$r}; $git_configs{$dr} = $git_configs{$r} if $git_configs{$r};
for my $u ('@all', "$gl_user - wild", @user_plus, keys %perm_cats) { for my $u ('@all', "$gl_user - wild", @user_plus, keys %perm_cats) {
my $du = $gl_user; $du = '@all' if $u eq '@all' or ($perm_cats{$u} || '') eq '@all'; my $du = $gl_user; $du = '@all' if $u eq '@all' or ($perm_cats{$u} || '') eq '@all';

View file

@ -37,7 +37,7 @@ our ($GL_LOGT, $GL_CONF_COMPILED, $REPO_BASE, $GIT_PATH, $REPO_UMASK, $GL_ADMIND
our ($R_COMMANDS, $W_COMMANDS, $REPONAME_PATT, $REPOPATT_PATT, $ADC_CMD_ARGS_PATT); our ($R_COMMANDS, $W_COMMANDS, $REPONAME_PATT, $REPOPATT_PATT, $ADC_CMD_ARGS_PATT);
our %repos; our %repos;
our %groups; our %groups;
our %repo_config; our %git_configs;
# the common setup module is in the same directory as this running program is # the common setup module is in the same directory as this running program is
my $bindir = $0; my $bindir = $0;
@ -239,7 +239,7 @@ if ($perm =~ /C/) {
new_repo($repo, "$GL_ADMINDIR/hooks/common", $user); new_repo($repo, "$GL_ADMINDIR/hooks/common", $user);
# note pwd is now the bare "repo.git"; new_repo does that... # note pwd is now the bare "repo.git"; new_repo does that...
wrap_print("gl-perms", "$GL_WILDREPOS_DEFPERMS\n") if $GL_WILDREPOS_DEFPERMS; wrap_print("gl-perms", "$GL_WILDREPOS_DEFPERMS\n") if $GL_WILDREPOS_DEFPERMS;
&setup_repo_configs($repo, \%repo_config); &setup_git_configs($repo, \%git_configs);
&setup_daemon_access($repo); &setup_daemon_access($repo);
&add_del_line ("$repo.git", $PROJECTS_LIST, &setup_gitweb_access($repo, '', '')); &add_del_line ("$repo.git", $PROJECTS_LIST, &setup_gitweb_access($repo, '', ''));
wrap_chdir($ENV{HOME}); wrap_chdir($ENV{HOME});

View file

@ -105,8 +105,8 @@ our $current_data_version; # this comes from gitolite.pm
# catch usernames<->pubkeys mismatches; search for "lint" below # catch usernames<->pubkeys mismatches; search for "lint" below
my %user_list = (); my %user_list = ();
# repo configurations # repo specific 'git config' stuff
our %repo_config = (); our %git_configs = ();
# gitweb descriptions and owners; plain text, keyed by "$repo.git" # gitweb descriptions and owners; plain text, keyed by "$repo.git"
my %desc = (); my %desc = ();
@ -274,7 +274,7 @@ sub parse_conf_line
} }
} }
} }
# configuration # repo specific 'git config' stuff
elsif ($line =~ /^config (.+) = ?(.*)/) elsif ($line =~ /^config (.+) = ?(.*)/)
{ {
my ($key, $value) = ($1, $2); my ($key, $value) = ($1, $2);
@ -283,7 +283,7 @@ sub parse_conf_line
die "$ABRT git config $key not allowed\ncheck GL_GITCONFIG_KEYS in the rc file for how to allow it\n" if (@matched < 1); die "$ABRT git config $key not allowed\ncheck GL_GITCONFIG_KEYS in the rc file for how to allow it\n" if (@matched < 1);
for my $repo (@{ $repos_p }) # each repo in the current stanza for my $repo (@{ $repos_p }) # each repo in the current stanza
{ {
$repo_config{$repo}{$key} = $value; $git_configs{$repo}{$key} = $value;
# no problem if it's a plain repo (non-pattern, non-groupname) # no problem if it's a plain repo (non-pattern, non-groupname)
# OR wild configs are allowed # OR wild configs are allowed
unless ( ($repo =~ $REPONAME_PATT and $repo !~ /^@/) or $GL_GITCONFIG_WILD) { unless ( ($repo =~ $REPONAME_PATT and $repo !~ /^@/) or $GL_GITCONFIG_WILD) {
@ -402,7 +402,7 @@ my $compiled_fh = wrap_open( ">", "$GL_CONF_COMPILED.new" );
my $data_version = $current_data_version; my $data_version = $current_data_version;
print $compiled_fh Data::Dumper->Dump([$data_version], [qw(*data_version)]); print $compiled_fh Data::Dumper->Dump([$data_version], [qw(*data_version)]);
my $dumped_data = Data::Dumper->Dump([\%repos], [qw(*repos)]); my $dumped_data = Data::Dumper->Dump([\%repos], [qw(*repos)]);
$dumped_data .= Data::Dumper->Dump([\%repo_config], [qw(*repo_config)]) if %repo_config; $dumped_data .= Data::Dumper->Dump([\%git_configs], [qw(*git_configs)]) if %git_configs;
# the dump uses single quotes, but we convert any strings containing $creator # the dump uses single quotes, but we convert any strings containing $creator
# and $gl_user to double quoted strings. A bit sneaky, but not too much... # and $gl_user to double quoted strings. A bit sneaky, but not too much...
$dumped_data =~ s/'(?=[^']*\$(?:creator|gl_user))~?(.*?)'/"$1"/g; $dumped_data =~ s/'(?=[^']*\$(?:creator|gl_user))~?(.*?)'/"$1"/g;
@ -555,9 +555,9 @@ for my $repo (keys %repo_patts) {
# calls (setup daemon or gitweb). The reason is that they call # calls (setup daemon or gitweb). The reason is that they call
# "can_read", which eventually calls parse_acl with the right "creator" # "can_read", which eventually calls parse_acl with the right "creator"
# set for the *current* repo, which in turn stores translated values for # set for the *current* repo, which in turn stores translated values for
# $creator in the repo_config hash, which, (phew!) is needed for a match # $creator in the git_configs hash, which, (phew!) is needed for a match
# that eventually gets you a valid $repo_config{} below # that eventually gets you a valid $git_configs{} below
&setup_repo_configs($repo, \%repo_config) if $repo_config{$repo}; &setup_git_configs($repo, \%git_configs) if $git_configs{$repo};
} }
# write out the project list # write out the project list

View file

@ -1,4 +1,4 @@
$data_version = '1.6'; $data_version = '1.7';
%repos = ( %repos = (
'aa' => { 'aa' => {
'R' => { 'R' => {

View file

@ -1,4 +1,4 @@
$data_version = '1.6'; $data_version = '1.7';
%repos = ( %repos = (
'aa' => { 'aa' => {
'R' => { 'R' => {

View file

@ -1,4 +1,4 @@
$data_version = '1.6'; $data_version = '1.7';
%repos = ( %repos = (
'@g1' => { '@g1' => {
'@g1' => [ '@g1' => [

View file

@ -1,4 +1,4 @@
$data_version = '1.6'; $data_version = '1.7';
%repos = ( %repos = (
'aa' => { 'aa' => {
'R' => { 'R' => {

View file

@ -1,4 +1,4 @@
$data_version = '1.6'; $data_version = '1.7';
%repos = ( %repos = (
'aa' => { 'aa' => {
'R' => { 'R' => {

View file

@ -1,4 +1,4 @@
$data_version = '1.6'; $data_version = '1.7';
%repos = ( %repos = (
'aa' => { 'aa' => {
'@g1' => [ '@g1' => [