aboutsummaryrefslogtreecommitdiffstats
path: root/iurt2
diff options
context:
space:
mode:
authorFlorent Villard <warly@mandriva.com>2006-06-19 05:59:07 +0000
committerFlorent Villard <warly@mandriva.com>2006-06-19 05:59:07 +0000
commitcff1e729b9fe60a0de6867765ba502f8c67dea33 (patch)
tree1a782cce049a74c552c0a6b986390089cc136f34 /iurt2
parent280a6e0c648961b49ee745ac5fb7eeb388767291 (diff)
downloadiurt-cff1e729b9fe60a0de6867765ba502f8c67dea33.tar
iurt-cff1e729b9fe60a0de6867765ba502f8c67dea33.tar.gz
iurt-cff1e729b9fe60a0de6867765ba502f8c67dea33.tar.bz2
iurt-cff1e729b9fe60a0de6867765ba502f8c67dea33.tar.xz
iurt-cff1e729b9fe60a0de6867765ba502f8c67dea33.zip
- add a new max_command_retry to limit the number of time iurt will try to perform a command (in perform_command)
- try to fix the maintainer allocation in the 'needed' cache section - try to migrate old cache needed structure from tables to hashes (will need a cleaning mechanism someday) - send less mail - remove the chroot tar after one week
Diffstat (limited to 'iurt2')
-rwxr-xr-xiurt237
1 files changed, 27 insertions, 10 deletions
diff --git a/iurt2 b/iurt2
index 28ddab9..9f78e2e 100755
--- a/iurt2
+++ b/iurt2
@@ -266,6 +266,7 @@ my %config_usage = (
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 },
+ max_command_retry => { "Maximum number of retry Iurt will perform for a given command", fault => 20 },
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' },
repository => { desc => 'Prefix of the repositories', default => '/mnt/BIG/dis/' },
@@ -540,7 +541,7 @@ do {
my ($srpm_name) = $srpm =~ /(.*)-[^-]+-[^-]+\.src\.rpm$/ or next;
my ($maintainer, $cc);
if (!$run{warn}) {
- $maintainer = get_maint(\%run, $srpm);
+ ($maintainer) = get_maint(\%run, $srpm);
$cc = "$maint{$srpm}";#, maintainers\@mandriva.com";
chomp $maintainer;
if (!$maintainer || $maintainer eq 'NOT_FOUND') {
@@ -575,7 +576,6 @@ do {
# installed packages, retrying several time to be sure something is really broken
if (!perform_command("sudo $run{urpmi_command} $path_srpm/$srpm",
\%run, $config,
- mail => $config->{admin},
error => "[REBUILD] install of build dependencies of $srpm failed on $run{my_arch}",
hash => "install_deps_$srpm",
timeout => 900,
@@ -616,7 +616,7 @@ do {
} else {
$missing_package = ''
}
- my $other_maint = get_maint(\%run, $p);
+ my ($other_maint) = get_maint(\%run, $p);
print {$run{LOG}} "missing dep: $missing_deps ($other_maint) missing_package $missing_package ($first_maint)\n";
foreach my $m ($first_maint, $other_maint) {
if ($other_maint && $other_maint ne 'NOT_FOUND') {
@@ -961,8 +961,20 @@ sub check_needed {
my ($srpm, $cache, $provides) = @_;
if (!defined $cache->{needed}{$srpm} && !ref $cache->{needed}{$srpm}) { return 1 }
my $ok = 1;
- foreach my $name (keys %{$cache->{needed}{$srpm}}) {
- my ($package, $version, $maint) = @{$cache->{needed}{$srpm}{$name}}{'package', 'version','maint'};
+ # migrate old cache format
+ my $ent = $cache->{needed}{$srpm};
+ if (ref $ent eq 'ARRAY') {
+ my $table = $ent;
+ foreach my $t (@$table) {
+ my ($missing, $version, $maint) = @$t;
+ $cache->{needed}{$srpm}{$missing} = {
+ version => $version,
+ maint => $maint
+ }
+ }
+ }
+ foreach my $name (keys %$ent) {
+ my ($package, $version, $maint) = @{$ent->{$name}}{'package', 'version','maint'};
# if packages does not exist anymore, it may have been rebuild, then try to recompute the build dependencies
last if $package && !$provides->{$package};
my ($p_version) = $provides->{$name};
@@ -972,7 +984,7 @@ sub check_needed {
}
$ok = 0;
if ($version) {
- $cache->{needed}{$srpm}{$name}{version} = $version;
+ $ent->{$name}{version} = $version;
}
my $v ||= $version;
if ($package) {
@@ -1141,6 +1153,7 @@ sub perform_command {
my $call_ret = 1;
my ($err, $pid, $try);
my $logfile = "$opt{log}/$opt{hash}.$run->{run}.log";
+ my $max_retry = $config->{max_command_retry} < $retry ? $retry : $config->{max_command_retry};
while ($retry) {
$try++;
if ($opt{retry} > 1) {
@@ -1227,11 +1240,11 @@ sub perform_command {
if ($output =~ /$wr/m) {
$inc = $opt{wait_regexp}{$wr}(\%opt, $output) if ref $opt{wait_regexp}{$wr};
print {$run->{LOG}} "ERROR iurt: $wr !\n";
- sendmail($config->{admin}, '' , "$opt{hash} on $run->{my_arch} for $run->{media}: could not proceed", "$wr\n\n$comment\n$output", 0, 0, $opt{debug_mail});
+ sendmail($config->{admin}, '' , "$opt{hash} on $run->{my_arch} for $run->{media}: could not proceed", "$wr\n\n$comment\n$output", 0, 0, $opt{debug_mail}) if $opt{wait_mail}
}
}
}
- if ($inc) {
+ if ($inc && $try < $max_retry) {
$retry += $inc
} elsif ($call_ret && !$kill && !$err && !$opt{error_regexp} || $fulloutput !~ /$opt{error_regexp}/) {
$retry = 0
@@ -1294,9 +1307,14 @@ sub check_chroot {
print {$run{LOG}} "iurt: checking basesystem tar\n" if $run{verbose};
system(qq{sudo pkill -9 -u root -f "urpmi $urpmi_options --root $chroot" &> /dev/null});
if (!clean_chroot($chroot, $run, 1)) {
- print "ERROR iurt: Could no prepare initial chroot";
+ print {$run{LOG}} "ERROR iurt: Could no prepare initial chroot";
return
}
+ my (@stat) = stat $chroot_tar;
+ if (time - $stat[9] > 604800) {
+ print {$run{LOG}} "iurt check_chroot: tar chroot is more than one week old, forcing the rebuild\n";
+ system("sudo rm -rf $chroot_tar $chroot");
+ }
perform_command("sudo $config->{install_chroot_binary} $config->{basesystem_media_root} $config->{basesystem_media_root}/media/$config->{basesystem_media} $chroot_tar $chroot 501 basesystem tar rpm-build rpm-mandriva-setup-build",
$run, $config,
mail => $config->{admin},
@@ -1604,7 +1622,6 @@ sub add_packages {
my $f;
if (!perform_command("sudo $run{urpmi_command} @packages",
$run, $config,
- mail => $config->{admin},
timeout => 300,
freq => 1,
retry => 2,