aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rwxr-xr-xiurt17
-rwxr-xr-xulri4
3 files changed, 15 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 2075cc1..1dfa65a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
- ulri: ignore failures when cancelling build
- iurt: kill processes before unmounting in clean_chroot
+- ulri, iurt: use SIGTERM instead of abusing ALARM and handle it to cleanup
+ in iurt
0.7.7
- ulri: only use mandatory archs for noarch builds
diff --git a/iurt b/iurt
index 7dd57f8..0a24ded 100755
--- a/iurt
+++ b/iurt
@@ -71,13 +71,10 @@ sub bug_handler {
#exit(1);
}
+my ($chroot_name, $chroot_tmp, $chroot, $chroot_ref);
+
$SIG{SEGV} = sub { bug_handler(@_, 1) };
#$SIG{__DIE__} = \&bug_handler;
-$SIG{TERM} = sub {
- warn "Got KILLED by SIGTERM at " . strftime("%c", localtime()) . " .\n";
- exit(1);
-};
-
my $program_name = 'iurt';
# sessing parameters
@@ -516,6 +513,15 @@ if (!$config->{repository}) {
die "FATAL $program_name: no repository have been defined (use --repository to specify one on the command line";
}
+$SIG{TERM} = sub {
+ warn "Got KILLED by SIGTERM at " . strftime("%c", localtime()) . " .\n";
+ if (!$run{use_old_chroot} && $chroot_tmp) {
+ print "Cleaning up before dying.\n";
+ clean_chroot($chroot_tmp, \%run, $config);
+ }
+ exit(1);
+};
+
my $urpmi = Iurt::Urpmi->new(run => \%run, config => $config, urpmi_options => "-v --no-verify-rpm --tune-rpm=all --nolock --auto --no-recommends --ignoresize $config->{urpmi_options}");
$run{urpmi} = $urpmi;
@@ -612,7 +618,6 @@ $run{done} = \%done;
my $home = $config->{local_home};
my $chroot_base = $config->{chroot_base};
-my ($chroot_name, $chroot_tmp, $chroot, $chroot_ref);
$chroot_name = "chroot_$run{distro_tag}$debug_tag.$run{my_arch}";
if (!$run{use_old_chroot}) {
$chroot_tmp = "$chroot_base/chroot_tmp";
diff --git a/ulri b/ulri
index d493eaf..d859385 100755
--- a/ulri
+++ b/ulri
@@ -299,7 +299,7 @@ foreach my $prefix (keys %pkg_tree) {
# Everything is fine, build is continuing!
# Kill it if that package had failed on a mandatory arch
if (check_if_mandatory_arch_failed($media, $ent, $config)) {
- ssh($remote, "kill -14 $pid");
+ ssh($remote, "kill -TERM $pid");
$pkg_tree{$prefix}{media}{$media}{cancelled_arch}{$arch} = 1;
create_file("$done_dir/${prefix}_$arch.cancelled", "$bot $host");
}
@@ -307,7 +307,7 @@ foreach my $prefix (keys %pkg_tree) {
}
if ($timeout) {
plog('FAIL', "$bot timed out on $host/$arch ($seconds sec), killing it");
- ssh($remote, "kill -14 $pid");
+ ssh($remote, "kill -TERM $pid");
# Give it some time to die/cleanup
if ($seconds < 1.02 * $config->{faildelay}) {
next bot;