aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo De Nardin <spuk@mandriva.org>2007-05-21 15:09:19 +0000
committerGustavo De Nardin <spuk@mandriva.org>2007-05-21 15:09:19 +0000
commit456bb2657b2c04fecad6210852be15582c443d48 (patch)
tree4cf47154bf2c7d96fee455375f8056e06b778a64
parent688e2df749b62ca51410a0616c3561f02034cf5b (diff)
downloadiurt-456bb2657b2c04fecad6210852be15582c443d48.tar
iurt-456bb2657b2c04fecad6210852be15582c443d48.tar.gz
iurt-456bb2657b2c04fecad6210852be15582c443d48.tar.bz2
iurt-456bb2657b2c04fecad6210852be15582c443d48.tar.xz
iurt-456bb2657b2c04fecad6210852be15582c443d48.zip
get_repsys_conf() didn't really got Repsys config, just emails from the
static file. Changed it for get_author_email(), which uses repsys command itself to get the email. Should fix bug #30904.
-rwxr-xr-xemi10
-rw-r--r--lib/Iurt/Config.pm28
-rwxr-xr-xulri13
3 files changed, 14 insertions, 37 deletions
diff --git a/emi b/emi
index 41b3c82..e1921d3 100755
--- a/emi
+++ b/emi
@@ -29,7 +29,7 @@
use strict;
use MDK::Common;
-use Iurt::Config qw(config_usage get_date config_init dump_cache init_cache get_repsys_conf);
+use Iurt::Config qw(config_usage get_date config_init dump_cache init_cache get_author_email);
use Iurt::Process qw(check_pid);
use Iurt::Mail qw(sendmail);
use Iurt::File qw(check_upload_tree);
@@ -88,10 +88,6 @@ my %config_usage = (
desc => 'User who is uploading packages',
default => 'mandrake'
},
- repsys_conf => {
- desc => 'Path of repsys.conf file with login mail corresponding',
- default => '/etc/repsys.conf'
- },
queue => {
desc => 'root directory of the various upload queues',
default => '/home/mandrake/uploads/'
@@ -113,8 +109,6 @@ if (-f $configfile) {
config_usage(\%config_usage, $config) if $run{config_usage};
config_init(\%config_usage, $config, \%run);
-my $mail = get_repsys_conf($config->{repsys_conf});
-
$run{pidfile_home} = $config->{tmp};
$run{pidfile} = "upload";
my $pidfile = check_pid(\%run);
@@ -269,7 +263,7 @@ foreach my $prefix (keys %pkg_tree) {
$rpms .= "$rpm ";
$text .= "- $rpm\n";
}
- my $to = $mail->{$user} || "$user\@mandriva.com, $user\@mandriva.org";
+ my $to = get_author_email($user) || "$user\@$config->{default_mail_domain}";
$text .= "\nUpload log available in $config->{http_queue}/rejected/$path/$prefix.youri\n";
sendmail($to, $config->{admin} , "Upload failed for $rpms", $text, "Emi the upload bot <$config->{admin}>", 0);
diff --git a/lib/Iurt/Config.pm b/lib/Iurt/Config.pm
index 9efcd24..2323481 100644
--- a/lib/Iurt/Config.pm
+++ b/lib/Iurt/Config.pm
@@ -17,7 +17,7 @@ our @EXPORT = qw(
get_maint
get_date
get_prefix
- get_repsys_conf
+ get_author_email
check_arch
check_noarch
get_package_prefix
@@ -238,25 +238,13 @@ sub get_maint {
$maint, $srpm_name;
}
-sub get_repsys_conf {
- my ($file) = @_;
- open my $fh, $file or return;
- my %mail;
- my $ok;
- local $_;
- while (<$fh>) {
- if (/\[users\]/) {
- $ok = 1;
- } elsif (/\[/) {
- $ok = 0;
- }
- $ok or next;
- my ($user, $mail) = split " = ";
- chomp $mail;
- $mail{$user} = $mail;
- $mail or next;
- }
- \%mail;
+# TODO: would be nicer (really?) to use repsys configuration directly, and
+# query the users list in there and LDAP according to it
+sub get_author_email {
+ my ($user) = @_;
+ my $authoremail = `repsys authoremail $user 2>/dev/null`;
+
+ return $authoremail;
}
sub check_noarch {
diff --git a/ulri b/ulri
index a499759..80b67a1 100755
--- a/ulri
+++ b/ulri
@@ -33,7 +33,7 @@
use strict;
use MDK::Common;
-use Iurt::Config qw(config_usage get_date config_init dump_cache init_cache get_repsys_conf check_arch check_noarch);
+use Iurt::Config qw(config_usage get_date config_init dump_cache init_cache get_author_email check_arch check_noarch);
use Iurt::Process qw(check_pid);
use Iurt::File qw(check_upload_tree);
use Iurt::Mail qw(sendmail);
@@ -122,6 +122,7 @@ my %config_usage = (
},
},
},
+ # this is weird to me, guessing email addresses? -spuk
default_mail_domain => {
desc => "Default mail domain to append",
default => 'mandriva.org'
@@ -142,10 +143,6 @@ my %config_usage = (
desc => 'Where to store the cache files',
default => "$HOME/.bugs"
},
- repsys_conf => {
- desc => 'Path of repsys.conf which includes login mail corresponding',
- default => '/etc/repsys.conf'
- },
tmp => {
desc => "Temporary directory",
default => "$HOME/tmp/"
@@ -168,8 +165,6 @@ foreach my $k (keys %{$config->{arch_translation}}) {
push @{$untranslated_arch{$v}}, $k;
}
-my $mail = get_repsys_conf($config->{repsys_conf});
-
$run{pidfile_home} = $config->{tmp};
$run{pidfile} = "upload";
my $pidfile = check_pid(\%run);
@@ -493,7 +488,7 @@ foreach my $prefix (keys %pkg_tree) {
$text .= "- $srpm\n";
}
- my $to = $mail->{$user} || "$user\@$config->{default_mail_domain}";
+ my $to = get_author_email($user) || "$user\@$config->{default_mail_domain}";
my $fpath = "$config->{http_queue}/failure/$path/$prefix";
$fpath =~ tr!/!!s; # Squash double slashes ...
$fpath =~ s!/!//!; # ... except for http://
@@ -530,7 +525,7 @@ foreach my $prefix (sort keys %pkg_tree) {
my $srpms = $ent->{srpms} or next;
my $user = $ent->{user};
if ($user) {
- $user = $mail->{$user} || $config->{packager}
+ $user = get_author_email($user) || $config->{packager};
} else {
$user = $config->{packager}
}