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-0005Wc-CE 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 8E13F21C128; 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 4E1C921C123 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 ACAA01B4042 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 23D9080057 for ; Mon, 17 Oct 2011 19:29:21 +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: <3a435b0a3c586c112ea8e1b29524c6a838721984.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: 3a435b0a3c586c112ea8e1b29524c6a838721984 Date: Mon, 17 Oct 2011 19:29:21 +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: dbb3dc03650472a91beab3a03a59bdf9 commit: 3a435b0a3c586c112ea8e1b29524c6a838721984 Author: Christian Ruppert gentoo org> AuthorDate: Mon Oct 17 19:05:35 2011 +0000 Commit: Christian Ruppert gentoo org> CommitDate: Mon Oct 17 19:05:35 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gitolite-gent= oo.git;a=3Dcommit;h=3D3a435b0a 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=20 my @tmp =3D (); =20 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_UMAS= K; +} + ++# ---------------------------------------------------------------------= ------- ++# 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); +=20 + 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; + } + } +=20 + closedir($dir_fh); +=20 + return sort(@files); + } +=20 # ---------------------------------------------------------------------= --------- # per perl rules, this should be the last line in such a file: 1;