From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RFssk-0005Wb-AR for garchives@archives.gentoo.org; Mon, 17 Oct 2011 19:29:54 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6BED321C125; Mon, 17 Oct 2011 19:29:22 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 188DE21C122 for ; Mon, 17 Oct 2011 19:29:22 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 56AE61B4036 for ; Mon, 17 Oct 2011 19:29:21 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C21A18004A for ; Mon, 17 Oct 2011 19:29:20 +0000 (UTC) From: "Christian Ruppert" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Christian Ruppert" Message-ID: <2d88e08ba1e414d55e6337effd9a728de7214b50.idl0r@gentoo> Subject: [gentoo-commits] proj/gitolite-gentoo:master commit in: / X-VCS-Repository: proj/gitolite-gentoo X-VCS-Committer: idl0r X-VCS-Committer-Name: Christian Ruppert X-VCS-Revision: 2d88e08ba1e414d55e6337effd9a728de7214b50 Date: Mon, 17 Oct 2011 19:29:20 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 9aa61ec8e5e15c810a19f19301eb20d9 commit: 2d88e08ba1e414d55e6337effd9a728de7214b50 Author: Christian Ruppert gentoo org> AuthorDate: Mon Oct 17 19:03:35 2011 +0000 Commit: Christian Ruppert gentoo org> CommitDate: Mon Oct 17 19:03:35 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gitolite-gent= oo.git;a=3Dcommit;h=3D2d88e08b Merge branch 't/misc' Conflicts: src/gitolite.pm src/gl-compile-conf README.mkd | 99 +++-- conf/example.gitolite.rc | 2 +- contrib/adc/README.mkd | 2 +- contrib/adc/gl-reflog | 2 +- contrib/adc/help | 19 + contrib/adc/hub.mkd | 2 +- contrib/adc/repo-deletion.mkd | 9 +- contrib/adc/set-head | 17 - contrib/adc/symbolic-ref | 33 ++ contrib/gitweb/gitweb.conf | 2 - contrib/mirrorconf-helper.sh | 182 +++++++ contrib/mirroring-complex-example.mkd | 344 ++++++++++++ contrib/real-users/gl-shell | 70 +++ contrib/real-users/gl-shell-setup | 105 ++++ contrib/real-users/password-access.mkd | 135 +++++ doc/1-INSTALL.mkd | 147 +++--- doc/2-admin.mkd | 225 ++++++--- doc/3-faq-tips-etc.mkd | 69 ++- doc/CHANGELOG | 29 + doc/admin-defined-commands.mkd | 88 ++-- doc/big-config.mkd | 11 +- doc/delegation.mkd | 172 ++++--- doc/developer-notes.mkd | 46 +-- doc/gitolite-and-ssh.mkd | 4 +- doc/gitolite.conf.mkd | 99 +++- doc/gitolite.rc.mkd | 10 +- doc/hook-propagation.mkd | 36 +- doc/install-transcript.mkd | 279 ---------- doc/mirroring.mkd | 898 +++++++++++++++++++++++--= ------ doc/packaging.mkd | 3 - doc/progit-article.mkd | 31 +- doc/report-output.mkd | 4 - doc/shell-games.mkd | 8 +- doc/ssh-troubleshooting.mkd | 101 ++--- hooks/common/post-receive.mirrorpush | 30 +- src/gitolite.pm | 95 +++- src/gitolite_rc.pm | 12 +- src/gl-auth-command | 20 +- src/gl-compile-conf | 119 +++-- src/gl-conf-convert | 163 ++++--- src/gl-dryrun | 118 ++++ src/gl-easy-install | 655 ---------------------- src/gl-install | 2 +- src/gl-mirror-push | 83 +++ src/gl-mirror-shell | 182 ++++++- src/gl-mirror-sync | 38 -- src/gl-setup-authkeys | 24 +- src/gl-system-install | 3 +- src/gl-tool | 135 +++-- src/sshkeys-lint | 18 +- t/out/t01-repo-groups.1 | 2 +- t/out/t01-repo-groups.1b | 2 +- t/out/t01-repo-groups.1bs | 2 +- t/out/t01-repo-groups.2 | 2 +- t/out/t02-user-groups.1 | 2 +- t/out/t02-user-groups.1b | 2 +- t/out/t02-user-groups.1bs | 2 +- t/out/t02-user-groups.2 | 2 +- t/out/t02-user-groups.2bs | 2 +- t/t05a-delegation | 2 +- t/t05b-delegation-wild | 2 +- t/t53-check-info-expand-output | 6 +- t/t55-repo-configs-wild-without-CREATOR | 42 ++- t/t56-repo-configs-wild-with-CREATOR | 5 +- t/t68-include | 12 +- 65 files changed, 3033 insertions(+), 2034 deletions(-) diff --cc src/gitolite.pm index ffbd83c,e6b0948..924194f --- a/src/gitolite.pm +++ b/src/gitolite.pm @@@ -28,8 -29,9 +29,12 @@@ use Exporter 'import' wrap_open wrap_print =20 + mirror_mode + mirror_listslaves + mirror_redirectOK ++ + export_key_metadata + get_repo_umask ); @EXPORT_OK =3D qw( %repos @@@ -1222,88 -1208,49 +1249,132 @@@ sub ext_cmd_svnserv die "svnserve exec failed\n"; } =20 ++ + # ---------------------------------------------------------------------= ------- + # MIRRORING HELPERS + # ---------------------------------------------------------------------= ------- +=20 + sub mirror_mode { + my $repo =3D shift; +=20 + # 'local' is the default if the config is empty or not set + my $gmm =3D `git config --file $REPO_BASE/$repo.git/config --get gi= tolite.mirror.master` || 'local'; + chomp $gmm; + return 'local' if $gmm eq 'local'; + return 'master' if $gmm eq ( $GL_HOSTNAME || '' ); + return "slave of $gmm"; + } +=20 + sub mirror_listslaves { + my $repo =3D shift; +=20 + return ( `git config --file $REPO_BASE/$repo.git/config --get gitol= ite.mirror.slaves` || '' ); + } +=20 + # is a redirect ok for this repo from this slave? + sub mirror_redirectOK { + my $repo =3D shift; + my $slave =3D shift || return 0; + # if we don't know who's asking, the answer is "no" +=20 + my $gmrOK =3D `git config --file $REPO_BASE/$repo.git/config --get = gitolite.mirror.redirectOK` || ''; + chomp $gmrOK; + my $slavelist =3D mirror_listslaves($repo); +=20 + # if gmrOK is 'true', any valid slave can redirect + return 1 if $gmrOK eq 'true' and $slavelist =3D~ /(^|\s)$slave(\s|$= )/; + # otherwise, gmrOK is a list of slaves who can redirect + return 1 if $gmrOK =3D~ /(^|\s)$slave(\s|$)/; +=20 + return 0; +=20 + # LATER/NEVER: include a call to an external program to override a = 'true', + # based on, say, the time of day or network load etc. Cons: shelli= ng out, + # deciding the name of the program (yet another rc var?) + } +=20 +# ---------------------------------------------------------------------= ------- +# Gentoo specific stuff +# ---------------------------------------------------------------------= ------- + +# Find pubkeys recursive +sub find_pubkeys { + my $dir =3D shift; + my $name =3D shift; + my @files =3D (); + my @tmp =3D (); + + opendir(my $dir_fh, $dir) or do { print STDERR "Error opendir(): $!= '$dir'\n"; return @files; }; + foreach my $entry (readdir($dir_fh)) { + next if $entry =3D~ /^\.\.?$/; # Skip . and .. entries. + $entry =3D join("/", $dir, $entry); + + if(-f $entry and $entry =3D~ /\.pub$/) { + if(defined($name) && length($name) > 0) { + my $cmp =3D $entry; + $cmp =3D~ s(.*/)(); + $cmp =3D~ s/\.pub$//; + if($cmp eq $name) { + push(@files, $entry); + next; + } + } + else { + push(@files, $entry); + next; + } + } + if(-d $entry) { + @tmp =3D find_pubkeys($entry, $name); + @files =3D (@files, @tmp); + next; + } + } + + closedir($dir_fh); + + return sort(@files); +} + +sub export_key_metadata { + my $user =3D shift; + + my @tmp =3D find_pubkeys($GL_KEYDIR, $user); + return if $#tmp ne 0; # one pubkey only! + + my $pubkey =3D $tmp[0]; + + return if ! -f $pubkey; + + open(PUBKEY, '<', $pubkey); + while(defined(my $line =3D )) { + chomp($line); + next if $line !~ m/^\s*#/; + $line =3D~ s/^\s*#\s*//; + + my ($variable, $value) =3D split(/:\s*/, $line, 2); + + if(grep(/^\Q${variable}\E$/, @GL_METADATA)) { + if(length($value) > 0) { + $variable =3D~ s/-/_/g; + $ENV{$variable} =3D $value; + } + } + } + close(PUBKEY); +} + +sub get_repo_umask { + my $repo =3D shift; + + return $REPO_UMASK if ! $repo; + + do $GL_CONF_COMPILED if ! %repos; + + return $REPO_UMASK if ! $repos{$repo}; + return $repos{$repo}{"umask"} ? $repos{$repo}{"umask"} : $REPO_UMASK; +} + # ---------------------------------------------------------------------= --------- # per perl rules, this should be the last line in such a file: 1; diff --cc src/gitolite_rc.pm index bc57008,01bcba2..6142478 --- a/src/gitolite_rc.pm +++ b/src/gitolite_rc.pm @@@ -23,10 -23,9 +23,11 @@@ use Exporter 'import' $GL_SLAVE_MODE $GL_WILDREPOS $GL_WILDREPOS_DEFPERMS $GL_WILDREPOS_PERM_CATS $HTPASSWD_FILE $PROJECTS_LIST $REPO_BASE $REPO_UMASK $RSYNC_BASE $SVNSERVE $UPDATE_CHAINS_TO $AUTH_OPTIONS + $GL_HOSTNAME =20 $GL_HTTP_ANON_USER + + @GL_METADATA @GL_METADATA_REQUIRED ); =20 # ---------------------------------------------------------------------= --------- diff --cc src/gl-compile-conf index 2c4ac82,18d85c6..395593b --- a/src/gl-compile-conf +++ b/src/gl-compile-conf @@@ -244,32 -250,26 +250,33 @@@ sub parse_conf_lin 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 s= tanza { - $git_configs{$repo}{$key} =3D $value; - # no problem if it's a plain repo (non-pattern, non-groupna= me) - # OR wild configs are allowed - unless ( ($repo =3D~ $REPONAME_PATT and $repo !~ /^@/) or $= GL_GITCONFIG_WILD) { - my @r =3D ($repo); = # single wildpatt - @r =3D sort keys %{ $groups{$repo} } if $groups{$repo};= # or a group; get its members - do { - warn "$WARN git config set for $_ but \$GL_GITCONFI= G_WILD not set\n" unless $_ =3D~ $REPONAME_PATT - } for @r; - } + $git_configs{$repo}{$config_seq++}{$key} =3D $value; +=20 + # force entry in %repos. Without this, a repo para with ju= st a + # config line and no ACLs gets ignored in the output + $repos{$repo}{HAS_CONFIG} =3D 1; } } + # per repository umask + elsif ($line =3D~ /^umask =3D (\d{1,4})$/) { + my $umask =3D $1; + for my $repo (@{ $repos_p }) { # each repo in the current stanza + $repos{$repo}{"umask"} =3D oct($umask); + } + } - # include - elsif ($line =3D~ /^include "(.+)"/) + # include and subconf. subconf is just a special case of "include"= , + # saying that the config parse should "switch" contexts + elsif ($line =3D~ /^(include|subconf) "(.+)"/) { - my $include_glob =3D $1; - for my $file (glob($include_glob =3D~ m(^/) ? $include_glob : "= conf/$include_glob")) { - die "$ABRT $fragment attempting to include configuration\n"= if $fragment ne 'master'; - die "$ABRT included file not found: '$file'\n" unless -f $f= ile; + my $include_glob =3D $2; + my $subconf =3D ( $1 eq 'subconf' ); + die "$ABRT subconf $fragment attempting to run 'subconf'\n" if = $subconf and $fragment ne 'master'; +=20 + # substitute HOSTNAME word if GL_HOSTNAME defined, otherwise le= ave as is + $include_glob =3D~ s/\bHOSTNAME\b/$GL_HOSTNAME/ if $GL_HOSTNAME= ; +=20 + for my $file (glob($include_glob =3D~ m(^/) ? $include_glob : "= $GL_ADMINDIR/conf/$include_glob")) { + warn("$WARN included file not found: '$file'\n"), next unle= ss -f $file; =20 my $file_id =3D device_inode($file); warn("$WARN $file already included\n"), next if ($included{= $file_id}++);