diff options
author | Florent Villard <warly@mandriva.com> | 2005-12-31 10:32:10 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2005-12-31 10:32:10 +0000 |
commit | 0a2162809b82d8cfd1ebfdaa20c116e747c2f752 (patch) | |
tree | 43b1f17971ccf854f11c56d9a230db57b0c26d9d /iurt2 | |
parent | 96396d2b9c1626cbb1bb4afc74a2517e51832802 (diff) | |
download | iurt-0a2162809b82d8cfd1ebfdaa20c116e747c2f752.tar iurt-0a2162809b82d8cfd1ebfdaa20c116e747c2f752.tar.gz iurt-0a2162809b82d8cfd1ebfdaa20c116e747c2f752.tar.bz2 iurt-0a2162809b82d8cfd1ebfdaa20c116e747c2f752.tar.xz iurt-0a2162809b82d8cfd1ebfdaa20c116e747c2f752.zip |
fix buggy debug mode, more info on command failure
Diffstat (limited to 'iurt2')
-rwxr-xr-x | iurt2 | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -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 } } |