public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Christian Ruppert" <idl0r@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gitolite-gentoo:master commit in: /
Date: Mon, 17 Oct 2011 19:29:20 +0000 (UTC)	[thread overview]
Message-ID: <2d88e08ba1e414d55e6337effd9a728de7214b50.idl0r@gentoo> (raw)

commit:     2d88e08ba1e414d55e6337effd9a728de7214b50
Author:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 17 19:03:35 2011 +0000
Commit:     Christian Ruppert <idl0r <AT> gentoo <DOT> org>
CommitDate: Mon Oct 17 19:03:35 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gitolite-gentoo.git;a=commit;h=2d88e08b

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
  
+     mirror_mode
+     mirror_listslaves
+     mirror_redirectOK
++
 +	export_key_metadata
 +	get_repo_umask
  );
  @EXPORT_OK = qw(
      %repos
@@@ -1222,88 -1208,49 +1249,132 @@@ sub ext_cmd_svnserv
      die "svnserve exec failed\n";
  }
  
++
+ # ----------------------------------------------------------------------------
+ #       MIRRORING HELPERS
+ # ----------------------------------------------------------------------------
+ 
+ sub mirror_mode {
+     my $repo = shift;
+ 
+     # 'local' is the default if the config is empty or not set
+     my $gmm = `git config --file $REPO_BASE/$repo.git/config --get gitolite.mirror.master` || 'local';
+     chomp $gmm;
+     return 'local' if $gmm eq 'local';
+     return 'master' if $gmm eq ( $GL_HOSTNAME || '' );
+     return "slave of $gmm";
+ }
+ 
+ sub mirror_listslaves {
+     my $repo = shift;
+ 
+     return ( `git config --file $REPO_BASE/$repo.git/config --get gitolite.mirror.slaves` || '' );
+ }
+ 
+ # is a redirect ok for this repo from this slave?
+ sub mirror_redirectOK {
+     my $repo = shift;
+     my $slave = shift || return 0;
+         # if we don't know who's asking, the answer is "no"
+ 
+     my $gmrOK = `git config --file $REPO_BASE/$repo.git/config --get gitolite.mirror.redirectOK` || '';
+     chomp $gmrOK;
+     my $slavelist = mirror_listslaves($repo);
+ 
+     # if gmrOK is 'true', any valid slave can redirect
+     return 1 if $gmrOK eq 'true' and $slavelist =~ /(^|\s)$slave(\s|$)/;
+     # otherwise, gmrOK is a list of slaves who can redirect
+     return 1 if $gmrOK =~ /(^|\s)$slave(\s|$)/;
+ 
+     return 0;
+ 
+     # 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: shelling out,
+     # deciding the name of the program (yet another rc var?)
+ }
+ 
 +# ----------------------------------------------------------------------------
 +#       Gentoo specific stuff
 +# ----------------------------------------------------------------------------
 +
 +# Find pubkeys recursive
 +sub find_pubkeys {
 +    my $dir = shift;
 +    my $name = shift;
 +    my @files = ();
 +    my @tmp = ();
 +
 +    opendir(my $dir_fh, $dir) or do { print STDERR "Error opendir(): $! '$dir'\n"; return @files; };
 +    foreach my $entry (readdir($dir_fh)) {
 +        next if $entry =~ /^\.\.?$/; # Skip . and .. entries.
 +        $entry = join("/", $dir, $entry);
 +
 +        if(-f $entry and $entry =~ /\.pub$/) {
 +            if(defined($name) && length($name) > 0) {
 +                my $cmp = $entry;
 +                $cmp =~ s(.*/)();
 +                $cmp =~ s/\.pub$//;
 +                if($cmp eq $name) {
 +                    push(@files, $entry);
 +                    next;
 +                }
 +            }
 +            else {
 +                push(@files, $entry);
 +                next;
 +            }
 +        }
 +        if(-d $entry) {
 +            @tmp = find_pubkeys($entry, $name);
 +            @files = (@files, @tmp);
 +            next;
 +        }
 +    }
 +
 +    closedir($dir_fh);
 +
 +    return sort(@files);
 +}
 +
 +sub export_key_metadata {
 +    my $user = shift;
 +
 +    my @tmp = find_pubkeys($GL_KEYDIR, $user);
 +    return if $#tmp ne 0; # one pubkey only!
 +
 +    my $pubkey = $tmp[0];
 +
 +    return if ! -f $pubkey;
 +
 +    open(PUBKEY, '<', $pubkey);
 +    while(defined(my $line = <PUBKEY>)) {
 +        chomp($line);
 +        next if $line !~ m/^\s*#/;
 +        $line =~ s/^\s*#\s*//;
 +
 +        my ($variable, $value) = split(/:\s*/, $line, 2);
 +
 +        if(grep(/^\Q${variable}\E$/, @GL_METADATA)) {
 +            if(length($value) > 0) {
 +                $variable =~ s/-/_/g;
 +                $ENV{$variable} = $value;
 +            }
 +        }
 +    }
 +    close(PUBKEY);
 +}
 +
 +sub get_repo_umask {
 +	my $repo = 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
  
      $GL_HTTP_ANON_USER
 +
 +	@GL_METADATA @GL_METADATA_REQUIRED
  );
  
  # ------------------------------------------------------------------------------
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 stanza
          {
-             $git_configs{$repo}{$key} = $value;
-             # no problem if it's a plain repo (non-pattern, non-groupname)
-             # OR wild configs are allowed
-             unless ( ($repo =~ $REPONAME_PATT and $repo !~ /^@/) or $GL_GITCONFIG_WILD) {
-                 my @r = ($repo);                                        # single wildpatt
-                 @r = sort keys %{ $groups{$repo} } if $groups{$repo};   # or a group; get its members
-                 do {
-                     warn "$WARN git config set for $_ but \$GL_GITCONFIG_WILD not set\n" unless $_ =~ $REPONAME_PATT
-                 } for @r;
-             }
+             $git_configs{$repo}{$config_seq++}{$key} = $value;
+ 
+             # force entry in %repos.  Without this, a repo para with just a
+             # config line and no ACLs gets ignored in the output
+             $repos{$repo}{HAS_CONFIG} = 1;
          }
      }
 +	# per repository umask
 +	elsif ($line =~ /^umask = (\d{1,4})$/) {
 +		my $umask = $1;
 +		for my $repo (@{ $repos_p }) { # each repo in the current stanza
 +			$repos{$repo}{"umask"} = oct($umask);
 +		}
 +	}
-     # include
-     elsif ($line =~ /^include "(.+)"/)
+     # include and subconf.  subconf is just a special case of "include",
+     # saying that the config parse should "switch" contexts
+     elsif ($line =~ /^(include|subconf) "(.+)"/)
      {
-         my $include_glob = $1;
-         for my $file (glob($include_glob =~ 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 $file;
+         my $include_glob = $2;
+         my $subconf = ( $1 eq 'subconf' );
+         die "$ABRT subconf $fragment attempting to run 'subconf'\n" if $subconf and $fragment ne 'master';
+ 
+         # substitute HOSTNAME word if GL_HOSTNAME defined, otherwise leave as is
+         $include_glob =~ s/\bHOSTNAME\b/$GL_HOSTNAME/ if $GL_HOSTNAME;
+ 
+         for my $file (glob($include_glob =~ m(^/) ? $include_glob : "$GL_ADMINDIR/conf/$include_glob")) {
+             warn("$WARN included file not found: '$file'\n"), next unless -f $file;
  
              my $file_id = device_inode($file);
              warn("$WARN $file already included\n"), next if ($included{$file_id}++);



             reply	other threads:[~2011-10-17 19:29 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-17 19:29 Christian Ruppert [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-10-17 19:29 [gentoo-commits] proj/gitolite-gentoo:master commit in: / Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-10-17 19:29 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-08-30 15:46 Christian Ruppert
2011-06-16  0:45 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-06-14 12:02 Christian Ruppert
2011-03-25 20:00 [gentoo-commits] proj/gitolite-gentoo:t/ssh-key-options " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-03-25 20:00 [gentoo-commits] proj/gitolite-gentoo:t/ssh-key-options " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-03-25 20:00 [gentoo-commits] proj/gitolite-gentoo:t/export-key-metadata " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-03-25 20:00 [gentoo-commits] proj/gitolite-gentoo:t/export-key-metadata " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-03-25 20:00 Christian Ruppert
2011-03-25 20:00 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:59 Christian Ruppert
2011-03-25 19:57 [gentoo-commits] proj/gitolite-gentoo:t/misc " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-16 16:07 [gentoo-commits] proj/gitolite-gentoo:t/per_repo_umask " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-16 16:07 [gentoo-commits] proj/gitolite-gentoo:t/misc " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-16 16:07 [gentoo-commits] proj/gitolite-gentoo:t/misc " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-16 16:07 [gentoo-commits] proj/gitolite-gentoo:t/export_key_metadata-function " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-16 16:07 [gentoo-commits] proj/gitolite-gentoo:t/find_pubkeys-function " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-16 16:07 [gentoo-commits] proj/gitolite-gentoo:t/export-key-metadata " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-16 16:07 [gentoo-commits] proj/gitolite-gentoo:t/export-key-metadata " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-16 16:07 [gentoo-commits] proj/gitolite-gentoo:t/export-key-metadata " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 [gentoo-commits] proj/gitolite-gentoo:t/export-key-metadata " Christian Ruppert
2011-03-25 19:59 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-16 16:07 Christian Ruppert
2011-02-15 16:42 [gentoo-commits] proj/gitolite-gentoo:t/misc " Christian Ruppert
2011-02-16 16:07 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-15 16:42 [gentoo-commits] proj/gitolite-gentoo:t/find_pubkeys-function " Christian Ruppert
2011-02-16 16:07 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-15 16:42 [gentoo-commits] proj/gitolite-gentoo:t/export_key_metadata-function " Christian Ruppert
2011-02-16 16:07 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-15 16:42 [gentoo-commits] proj/gitolite-gentoo:t/export_key_metadata-function " Christian Ruppert
2011-02-16 16:07 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-15 16:42 [gentoo-commits] proj/gitolite-gentoo:t/export-key-metadata " Christian Ruppert
2011-02-16 16:07 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-15 16:42 [gentoo-commits] proj/gitolite-gentoo:t/export-key-metadata " Christian Ruppert
2011-02-16 16:07 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-15 16:42 [gentoo-commits] proj/gitolite-gentoo:t/export-key-metadata " Christian Ruppert
2011-02-16 16:07 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-15 16:42 [gentoo-commits] proj/gitolite-gentoo:t/export-key-metadata " Christian Ruppert
2011-02-16 16:07 ` [gentoo-commits] proj/gitolite-gentoo:master " Christian Ruppert
2011-02-15 16:42 Christian Ruppert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2d88e08ba1e414d55e6337effd9a728de7214b50.idl0r@gentoo \
    --to=idl0r@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox