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 1RFstR-0005k4-7F for garchives@archives.gentoo.org; Mon, 17 Oct 2011 19:30:37 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 577F121C119; Mon, 17 Oct 2011 19:29:20 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 10C3021C10E for ; Mon, 17 Oct 2011 19:29:19 +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 A35B61B4036 for ; Mon, 17 Oct 2011 19:29:19 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 1797880057 for ; Mon, 17 Oct 2011 19:29:19 +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: 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: c4233296ae04b2733df351688e357bef07070b1a Date: Mon, 17 Oct 2011 19:29:19 +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: 0b169627d7b75cc603faa35f7ed0600a commit: c4233296ae04b2733df351688e357bef07070b1a Author: Christian Ruppert gentoo org> AuthorDate: Mon Oct 17 18:46:11 2011 +0000 Commit: Christian Ruppert gentoo org> CommitDate: Mon Oct 17 18:46:11 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gitolite-gent= oo.git;a=3Dcommit;h=3Dc4233296 Merge commit 'refs/top-bases/t/find_pubkeys-function' into t/find_pubkeys= -function Conflicts: src/gitolite.pm 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 | 96 +++- 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, 3034 insertions(+), 2034 deletions(-) diff --cc src/gitolite.pm index b02a18f,85ee660..b10da00 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@@ -1178,48 -1207,48 +1207,91 @@@ sub ext_cmd_svnserv } =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); +} + # ---------------------------------------------------------------------= --------- # per perl rules, this should be the last line in such a file: 1;