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:21 +0000 (UTC)	[thread overview]
Message-ID: <3a435b0a3c586c112ea8e1b29524c6a838721984.idl0r@gentoo> (raw)

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

Merge branch 't/find_pubkeys-function'

Conflicts:
	src/gitolite.pm


 src/gitolite.pm |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --cc src/gitolite.pm
index 3cb87ab,b10da00..bb60cf7
--- a/src/gitolite.pm
+++ b/src/gitolite.pm
@@@ -1304,76 -1261,37 +1304,119 @@@ sub find_pubkeys 
      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;
 +}
 +
++# ----------------------------------------------------------------------------
++#       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);
+ }
+ 
  # ------------------------------------------------------------------------------
  # per perl rules, this should be the last line in such a file:
  1;



             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=3a435b0a3c586c112ea8e1b29524c6a838721984.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