From 1677d04c53393c6bb42f20821ff64f8979f73bf9 Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Thu, 9 Mar 2006 13:10:08 +0000 Subject: now use a subdir for each srpm logging info --- iurt2 | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/iurt2 b/iurt2 index e168bc0..19314a3 100755 --- a/iurt2 +++ b/iurt2 @@ -202,6 +202,7 @@ my %config_usage = ( local_upload => { desc => 'Where to store build packages and log', default => '' }, log_size_limit => { desc => 'Maximum authorized size for a log file', default => '100M' }, log_size_date => { desc => 'Number of days log should be kept', default => '30' }, + log_url => { desc => 'Where the log can be seen', default => '' }, minimum_package_number => { "Minimum number of packages in a synthesis file to consider it valid", default => 1000 }, no_mail => { desc => 'Hash table with people mail address where we should not send any mails', default => {} }, packager => { desc => 'Name of the build bot', default => 'Iurt' }, @@ -237,7 +238,7 @@ if ($run{distro} ne 'cooker') { $config->{upload} =~ s/cooker/contrib/g; } -if ($run{upload} && !-d $config->{upload}) { usage($program_name, \@params, "$config->{upload} does not exist") } +-d $config->{upload} or usage($program_name, \@params, "$config->{upload} does not exist"); if (!$run{debug} && $run{media} || $run{chroot}) { $run{pidfile_home} = "$config->{cache_home}/"; @@ -354,6 +355,7 @@ foreach (my $i ; $i < @{$run{todo}}; $i++) { check_version($srpm) or next; if ($run{debug}) { $run{debug}++ == 2 and exit } $done++; + mkdir "$local_spool/log/$srpm"; print {$run{LOG}} "iurt: packages $srpm [$done/$to_compile]\n"; # FIXME unfortunately urpmi stalls quite often retry: @@ -433,13 +435,14 @@ retry: error => "[REBUILD] install of build dependencies of $srpm failed on $run{my_arch}", hash => "install_deps_$srpm", timeout => 600, + srpm => $srpm, freq => 1, #cc => $cc, debug_mail => $run{debug}, error_regexp => 'cannot be installed', wait_regexp => 'database locked', wait_callback => sub { $wait_limit++; if ($wait_limit > 10) { $wait_limit = 0; system(qq{sudo pkill -9 urpmi &>/dev/null}) } }, - log => "$local_spool/log/", + log => "$local_spool/log/$srpm/", callback => sub { my ($opt, $output) = @_; print {$run{LOG}} "calling callback for $opt->{hash}\n" if $run{debug}; @@ -472,7 +475,7 @@ retry: hash => "rpm_qa_$srpm", timeout => 60, debug_mail => $run{debug}, - log => "$local_spool/log/"); # or next; As this failed quite often, do not stop + log => "$local_spool/log/$srpm/"); # or next; As this failed quite often, do not stop print {$run{LOG}} "Compiling $srpm\n" if $run{verbose}; my $command = "rpm --rebuild /home/builder/rpm/SRPMS/$srpm"; if ($run{stop}) { @@ -484,9 +487,10 @@ retry: error => "[REBUILD] $srpm from $run{distro_tag} does not build correctly on $run{my_arch}", hash => "build_$srpm", timeout => 18000, + srpm => $srpm, debug_mail => $run{debug}, cc => $cc, - log => "$local_spool/log/", + log => "$local_spool/log/$srpm/", error_regexp => 'rror.*ailed|Bad exit status|RPM build error', callback => sub { my ($opt, $output) = @_; @@ -533,11 +537,12 @@ retry: mail => $maintainer, error => "[REBUILD] binaries packages generated from $srpm do not install correctly", hash => "binary_test_$srpm", + srpm => $srpm, timeout => 300, debug_mail => $run{debug}, freq => 1, error_regexp => 'unable to access', - log => "$local_spool/log/")) { + log => "$local_spool/log/$srpm/")) { $cache->{failure}{$srpm} = 1; next } @@ -643,7 +648,7 @@ sub clean_process { sub clean_mnt { my ($mount_point, $verbose) = @_; - return clean($mount_point, "fuser", "sudo fuser -k", $verbose); + return clean($mount_point, "/sbin/fuser", "sudo /sbin/fuser -k", $verbose); } sub clean { @@ -673,7 +678,7 @@ sub clean_unionfs { my $d = "$unionfs_dir/$t.$run.$union_id"; my $last; while (check_mounted($d, $t)) { - system("sudo fuser -k $d &> /dev/null"); + system("sudo /sbin/fuser -k $d &> /dev/null"); print {$run{LOG}} "iurt: umounting $d\n" if $run{verbose} > 2; if (system(qq{sudo umount $d &> /dev/null})) { print {$run{LOG}} "WARNING iurt: could not umount $d ($!)\n" if $run{verbose} > 1; @@ -937,6 +942,9 @@ sub perform_command { return 0 } if ($kill || $err || $opt{error_regexp} && $output =~ /$opt{error_regexp}/) { + if ($opt{log} && $config->{log_url}) { + $output = qq|See $config->{log_url}/$run{distro_tag}/$run{my_arch}/log/$opt{srpm}/\n\n$output| + } if ($opt{mail} && $config->{sendmail} && !$config->{no_mail}{$opt{mail}}) { if (! ($cache->{warning}{$opt{hash}}{$opt{mail}} % $opt{freq})) { my $cc = join ',', grep { !$config->{no_mail}{$_} } split ',', $opt{cc}; -- cgit v1.2.1