aboutsummaryrefslogtreecommitdiffstats
path: root/iurt2
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2005-12-12 09:44:55 +0000
committerFlorent Villard <warly@mandriva.com>2005-12-12 09:44:55 +0000
commitdd6f2018aa2d2f2d7229108f522811f380e1644f (patch)
treed3284a5bff2f94e34093f4cfcad57cf30b1694cd /iurt2
parent34fbb3c7221a2d3beec3c7d15c6021fbab897ebc (diff)
downloadiurt-dd6f2018aa2d2f2d7229108f522811f380e1644f.tar
iurt-dd6f2018aa2d2f2d7229108f522811f380e1644f.tar.gz
iurt-dd6f2018aa2d2f2d7229108f522811f380e1644f.tar.bz2
iurt-dd6f2018aa2d2f2d7229108f522811f380e1644f.tar.xz
iurt-dd6f2018aa2d2f2d7229108f522811f380e1644f.zip
add logging feature to perform_command
Diffstat (limited to 'iurt2')
-rwxr-xr-xiurt222
1 files changed, 15 insertions, 7 deletions
diff --git a/iurt2 b/iurt2
index f64ae5b..17ea7e2 100755
--- a/iurt2
+++ b/iurt2
@@ -203,7 +203,8 @@ perform_command("sudo ~warly/files/cvs//mdk/soft/rpm-rebuilder/install-chroot-ta
if (!-d "$local_home/$distro_tag/$my_arch/") {
mkdir "$local_home/$distro_tag";
if (!-d "$local_home/$distro_tag/$my_arch") {
- mkdir "$local_home/$distro_tag/$my_arch"
+ mkdir "$local_home/$distro_tag/$my_arch";
+ mkdir "$local_home/$distro_tag/log"
}
}
@@ -232,17 +233,17 @@ foreach my $t (@todo) {
print "Installing build dependencies of $srpm...\n";
# FIXME unfortunately urpmi stalls quite often
system(qq{sudo pkill -9 -u root -f "urpmi --root $chroot"});
- perform_command("sudo urpmi --root $chroot --no-verify-rpm -s --auto $dir/$srpm", $maintainer, "[REBUILD] install of build dependencies of $srpm failed on $my_arch", "build_deps_$srpm", 0, 600, $cc) or next;
+ perform_command("sudo urpmi -v --root $chroot --no-verify-rpm -s --auto $dir/$srpm", $maintainer, "[REBUILD] install of build dependencies of $srpm failed on $my_arch", "build_deps_$srpm", 0, 600, $cc, "$local_home/$distro_tag/log/") or next;
print "Copying $srpm to $chroot\n";
perform_command("sudo cp $dir/$srpm $chroot/home/builder/rpm/SRPMS/", 'warly@mandriva.com', "[REBUILD] cannot copy $srpm to $chroot", "copy_$srpm", 1);
print "Compiling $srpm\n";
#system(qq{sudo chroot $chroot /bin/su builder -c "mkdir rpm/RPMS/x86_64 rpm/RPMS/noarch"});
- if (!perform_command(qq{TMP=/home/builder/tmp/ sudo chroot $chroot /bin/su builder -c "rpm --rebuild /home/builder/rpm/SRPMS/$srpm"}, $maintainer, "[REBUILD] $srpm from $distro_tag does not build correctly on $my_arch", $srpm, 0, 18000, $cc)) {
+ if (!perform_command(qq{TMP=/home/builder/tmp/ sudo chroot $chroot /bin/su builder -c "rpm --rebuild /home/builder/rpm/SRPMS/$srpm"}, $maintainer, "[REBUILD] $srpm from $distro_tag does not build correctly on $my_arch", $srpm, 0, 18000, $cc, 0, 1)) {
$::failure->{$srpm}{$my_arch} = 1;
next
}
# FIXME try to install the packages afterwards
- if (!perform_command("sudo urpmi --root $chroot --no-verify-rpm --auto $chroot/home/builder/rpm/RPMS/*/*.rpm", $maintainer, "[REBUILD] binaries packages generated from $srpm do not install correctly", "binary_test_$srpm", 0, 300)) {
+ if (!perform_command("sudo urpmi --root $chroot --no-verify-rpm --auto $chroot/home/builder/rpm/RPMS/*/*.rpm", $maintainer, "[REBUILD] binaries packages generated from $srpm do not install correctly", "binary_test_$srpm", 0, 300, 0, 0, 1)) {
$::failure->{$srpm}{$my_arch} = 1;
next
}
@@ -370,19 +371,26 @@ sub fix_srpm_name {
}
sub perform_command {
- my ($command, $mail, $error, $hash, $die, $timeout, $cc) = @_;
+ my ($command, $mail, $error, $hash, $die, $timeout, $cc, $log, $freq) = @_;
$timeout ||= 300;
+ $freq ||= 24;
print "Timeout $timeout\n";
my $p_pid = $$;
my $pid = fork;
my $stat;
if ($pid) {
print "$command\n";
- my $output = `$command 2>&1`;
+ my $output;
+ if ($log) {
+ my $t = gmtime;
+ $output = `$command 2>&1 | tee $log/$hash.$t`;
+ } else {
+ $output = `$command 2>&1`;
+ }
# FIXME process goes in defunct always, kill -14 should unsleep it, but not
kill 9, $pid;
if ($?) {
- if ($::warning->{$hash}{$my_arch}{$mail} % 24) {
+ if ($::warning->{$hash}{$my_arch}{$mail} % $freq) {
sendmail($mail, $cc , $error , $output, 0, 0);
} else {
sendmail('warly@mandriva.com', '' , $error, $output, 0, 0);