aboutsummaryrefslogtreecommitdiffstats
path: root/iurt2
diff options
context:
space:
mode:
Diffstat (limited to 'iurt2')
-rwxr-xr-xiurt218
1 files changed, 14 insertions, 4 deletions
diff --git a/iurt2 b/iurt2
index 399a317..973a342 100755
--- a/iurt2
+++ b/iurt2
@@ -144,7 +144,7 @@ my @wrong_rpm;
#foreach my $arch (@{$config->{supported_arch}}) {
my $rpms_dir = "$config->{repository}/$distro_version/$my_arch/media/$media/";
print "iurt: checking current packages in $rpms_dir\n";
- opendir my $rpmdir, $rpms_dir or next;
+ opendir my $rpmdir, $rpms_dir or die "Could not open $rpms_dir: $!";
foreach my $rpm (readdir $rpmdir) {
my ($rarch, $srpm) = update_srpm($rpms_dir, $rpm);
$rarch or next;
@@ -244,7 +244,7 @@ foreach my $t (@todo) {
$done{$srpm} and next;
$done{$srpm} = 1;
check_version($srpm) or next;
- $debug++ == 2 and exit;
+ if ($debug) { $debug++ == 2 and exit }
print "iurt: installing a new chroot for $srpm in $chroot\n";
-d $chroot and perform_command("sudo rm -rf $chroot",
mail => $config->{admin},
@@ -289,6 +289,7 @@ foreach my $t (@todo) {
my ($opt, $output) = @_;
print "Calling callback for $opt->{hash}\n" if $debug;
my ($missing_deps) = $output =~ /\(due to unsatisfied ([^[)]*)/;
+ $missing_deps or return;
my $other_maint = `rpmmon -p $missing_deps`;
chomp $other_maint;
print "Missing Dep: $missing_deps ($other_maint)\n";
@@ -481,12 +482,13 @@ sub perform_command {
print "Timeout $opt{timeout}\n";
# from alarm perldoc
my $output;
+ my $kill;
if ($opt{debug}) {
print "Would have rum $command with a timeout of $opt{timeout}\n";
return 1
}
eval {
- local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required
+ local $SIG{ALRM} = sub { print "Timeout!\n"; $kill = 1; die "alarm\n" }; # NB: \n required
alarm $opt{timeout};
print "$command\n";
if ($opt{log}) {
@@ -501,6 +503,11 @@ sub perform_command {
die unless $@ eq "alarm\n"; # propagate unexpected errors
return 0
} else {
+ if ($kill) {
+ $output = "Command has been killed after $opt{timeout} seconds: $command\n$output"
+ } else {
+ $output = "Command failed: $command\n$output"
+ }
if ($opt{callback}) {
$opt{callback}(\%opt, $output)
}
@@ -517,7 +524,10 @@ sub perform_command {
}
$cache->{warning}{$opt{hash}}{$my_arch}{$opt{mail}}++;
print "\n$output\n";
- die "FATAL iurt: $opt{error}." if $opt{die};
+ if ($opt{die}) {
+ dump_cache();
+ die "FATAL iurt: $opt{error}."
+ }
return 0
}
}