aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mgapeople.conf1
-rwxr-xr-xmkpeople53
-rw-r--r--tmpl/user.html10
3 files changed, 47 insertions, 17 deletions
diff --git a/mgapeople.conf b/mgapeople.conf
index 59d8333..865b864 100644
--- a/mgapeople.conf
+++ b/mgapeople.conf
@@ -4,4 +4,5 @@ bindpwfile: /etc/mgapeople.secret
groupbase: ou=Group,dc=mageia,dc=org
output_dir: /var/www/vhosts/mgapeople.mageia.org
tmpl_dir: /usr/share/mgapeople/tmpl
+maintdburl: http://pkgsubmit.mageia.org/data/maintdb.txt
sitename: people.mageia.org
diff --git a/mkpeople b/mkpeople
index cd21239..1cc4c7f 100755
--- a/mkpeople
+++ b/mkpeople
@@ -5,13 +5,26 @@ use Template;
use Net::LDAP;
use File::Slurp;
use YAML qw/LoadFile/;
+use LWP::UserAgent;
my $config_file = '/etc/mgapeople.conf';
my $config = LoadFile($ENV{MGAPEOPLE_CONF} ? $ENV{MGAPEOPLE_CONF} : $config_file);
+my %maintdb;
my %groups;
my %users;
+sub loadmaintdb {
+ return unless $config->{maintdburl};
+ my $ua = LWP::UserAgent->new;
+ my $r = $ua->get($config->{maintdburl});
+ return unless $r->is_success;
+ for my $line (split /^/, $r->decoded_content) {
+ my ($pkg, $user) = split ' ', $line;
+ push @{$maintdb{$user}}, $pkg;
+ }
+}
+
sub loaduser {
my ($ldap, $user) = @_;
my $m = $ldap->search(
@@ -56,19 +69,21 @@ sub output_users {
});
for my $user (keys %users) {
my $vars = {
- config => $config,
- user => $user,
- users => \%users,
- groups => \%groups,
+ config => $config,
+ user => $user,
+ users => \%users,
+ groups => \%groups,
+ maintdb => \%maintdb,
};
my $uid = $users{$user}->{uid}->[0];
$template->process("user.$extension", $vars, "$uid.$extension");
}
my $vars = {
- config => $config,
- users => \%users,
- groups => \%groups,
+ config => $config,
+ users => \%users,
+ groups => \%groups,
+ maintdb => \%maintdb,
};
$template->process("userindex.$extension", $vars, "index.$extension");
}
@@ -81,19 +96,21 @@ sub output_groups {
});
for my $group (keys %groups) {
my $vars = {
- config => $config,
- group => $group,
- users => \%users,
- groups => \%groups,
+ config => $config,
+ group => $group,
+ users => \%users,
+ groups => \%groups,
+ maintdb => \%maintdb,
};
my $cn = $groups{$group}->{cn}->[0];
$template->process("group.$extension", $vars, "$cn.$extension");
}
my $vars = {
- config => $config,
- users => \%users,
- groups => \%groups,
+ config => $config,
+ users => \%users,
+ groups => \%groups,
+ maintdb => \%maintdb,
};
$template->process("groupindex.$extension", $vars, "index.$extension");
}
@@ -105,9 +122,10 @@ sub output_index {
OUTPUT_PATH => "$config->{output_dir}",
});
my $vars = {
- config => $config,
- users => \%users,
- groups => \%groups,
+ config => $config,
+ users => \%users,
+ groups => \%groups,
+ maintdb => \%maintdb,
};
$template->process("index.$extension", $vars, "index.$extension");
}
@@ -120,6 +138,7 @@ $m = $ldap->start_tls(verify => 'none');
die $m->error if $m->is_error;
$m = $ldap->bind($config->{binddn}, password => $bindpw);
die $m->error if $m->is_error;
+loadmaintdb;
loadgroups($ldap);
output_users('html');
output_groups('html');
diff --git a/tmpl/user.html b/tmpl/user.html
index e46c468..d334738 100644
--- a/tmpl/user.html
+++ b/tmpl/user.html
@@ -20,5 +20,15 @@
[% END %]
</li>
</ul>
+ [% IF maintdb.$login %]
+ <h3>[% users.$user.cn.0 %] is maintaining [% maintdb.$login.size %] packages</h3>
+ <ul>
+ [% FOREACH pkg IN maintdb.$login %]
+ <li>
+ [% pkg %]
+ </li>
+ [% END %]
+ </ul>
+ [% END %]
</body>
</html>