aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Matsuoka <claudio@mandriva.com>2006-11-28 20:19:45 +0000
committerClaudio Matsuoka <claudio@mandriva.com>2006-11-28 20:19:45 +0000
commitd7e3db7a643cfa90cd21b4c08bce7a55a877b427 (patch)
tree3598a7f539c5ad8a328ace69eac4bbb8829d02b8
parentb2969c5512719f60519599fe94303e1d037816fe (diff)
downloadiurt-d7e3db7a643cfa90cd21b4c08bce7a55a877b427.tar
iurt-d7e3db7a643cfa90cd21b4c08bce7a55a877b427.tar.gz
iurt-d7e3db7a643cfa90cd21b4c08bce7a55a877b427.tar.bz2
iurt-d7e3db7a643cfa90cd21b4c08bce7a55a877b427.tar.xz
iurt-d7e3db7a643cfa90cd21b4c08bce7a55a877b427.zip
Fixed pretty log in emi
-rwxr-xr-xemi31
1 files changed, 18 insertions, 13 deletions
diff --git a/emi b/emi
index 3a7270e..e55bf73 100755
--- a/emi
+++ b/emi
@@ -39,7 +39,7 @@ my $program_name = 'emi';
$run{program_name} = $program_name;
open(my $LOG, ">&STDERR");
-plog_init($program_name, $LOG);
+plog_init($program_name, $LOG, 7, 1);
$run{LOG} = $LOG;
my $HOME = $ENV{HOME};
@@ -136,7 +136,7 @@ sub done_func {
if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*\.([^.]+)\.rpm)$/) {
my ($prefix, $rpm, $arch) = ($1, $2, $3);
- plog("found rpm $rpm ($prefix)");
+ plog('DEBUG', "found rpm $rpm ($prefix)");
$pkg_tree{$prefix}{path} = "/$f/$m/$s";
$pkg_tree{$prefix}{arch}{$arch} = 1;
$pkg_tree{$prefix}{target} = $f;
@@ -149,7 +149,7 @@ sub done_func {
$cache->{arch}{$prefix}{$arch} = 1;
} elsif ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*)\.excluded$/) {
my ($prefix, $arch) = ($1, $2);
- plog("found .excluded ($prefix)");
+ plog('DEBUG', "found .excluded ($prefix)");
$cache->{arch}{$prefix}{$arch} = 1;
$excluded{$prefix}{$arch} = 1;
}
@@ -160,7 +160,7 @@ sub todo_func {
if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_(.*\.([^.]+)\.rpm)$/) {
my ($prefix, $rpm, $arch) = ($1, $2, $3);
- plog("found todo rpm $rpm ($prefix)");
+ plog('DEBUG', "found todo rpm $rpm ($prefix)");
push @{$pkg_tree{$prefix}{todo}}, $rpm;
}
}
@@ -182,7 +182,8 @@ foreach my $prefix (keys %pkg_tree) {
my $section = $pkg_tree{$prefix}{section};
my %missing;
- plog("processing $prefix in $path");
+ plog('MSG', "processing $prefix");
+ plog('DEBUG', "... in $path");
my $ok = 1;
foreach my $m (@{$config->{mandatory_arch}}, 'src') {
$excluded{$prefix}{$m} and next;
@@ -196,11 +197,11 @@ foreach my $prefix (keys %pkg_tree) {
$x = "yes (in cache)";
}
}
- plog(" mandatory architecture $m present: $x");
+ plog('INFO', " mandatory architecture $m present: $x");
}
unless ($ok) {
- plog(0, "WARNING: mandatory arch", join(' ', keys %missing),
+ plog('INFO', "mandatory arch", join(' ', keys %missing),
"missing, waiting");
next;
}
@@ -212,17 +213,20 @@ foreach my $prefix (keys %pkg_tree) {
my @packages;
my ($user) = $prefix =~ /\d{14}\.(\w+)\.\w+\.\d+$/;
+ plog('OK', "all archs done: $prefix");
foreach my $rpm (@{$pkg_tree{$prefix}{rpms}}) {
- push @packages, "$done/$path/${prefix}_$rpm"
+ push @packages, "$done/$path/${prefix}_$rpm";
+ plog('OK', " uploading $rpm");
}
$user ||= $config->{upload_user};
+
my $command = "/usr/bin/sudo -H -u $config->{upload_user} /usr/bin/perl -I/usr/local/lib/perl/ /usr/local/bin/youri-submit --verbose --config /etc/youri/submit-queue.conf --define user=$user --define prefix=$prefix --define section=$section $target @packages &> $done/$path/$prefix.youri";
- plog("running $command");
+ plog('DEBUG', "running $command");
if (!system($command)) {
- plog("upload succeeded.");
+ plog('INFO', "upload succeeded");
# now check if we need to keep the current srpm in todo
my $all_uploaded = 1;
@@ -240,10 +244,10 @@ foreach my $prefix (keys %pkg_tree) {
}
} else {
# should send a mail or something
- plog("upload failed ($!), rejecting files in $reject/$path/");
+ plog('ERR', "upload failed ($!), rejecting files in $reject/$path/");
foreach my $rpm (@{$pkg_tree{$prefix}{rpms}}) {
my $err = link "$done/$path/${prefix}_$rpm", "$reject/$path/${prefix}_$rpm";
- plog("ERROR: link of $rpm failed ($!)");
+ plog('ERR', "ERROR: link of $rpm failed ($!)");
}
link "$done/$path/$prefix.youri", "$reject/$path/$prefix.youri";
@@ -258,6 +262,7 @@ foreach my $prefix (keys %pkg_tree) {
}
my $to = $mail->{$user} || "$user\@mandriva.com, $user\@mandriva.org";
$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)
}
@@ -273,7 +278,7 @@ foreach my $prefix (keys %pkg_tree) {
# unlink the sources rpm, other arch will be able to grab it into
# the repository
foreach (@{$pkg_tree{$prefix}{todo}}) {
- plog("unlink $todo/$path/${prefix}_$_");
+ plog('DEBUG', "unlink $todo/$path/${prefix}_$_");
unlink "$todo/$path/${prefix}_$_";
}
}