aboutsummaryrefslogtreecommitdiffstats
path: root/ulri
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@gmail.com>2016-02-06 18:45:09 +0000
committerPascal Terjan <pterjan@gmail.com>2016-02-06 18:45:09 +0000
commit6efca95f4de3d89c36d6d8b046b4d2004dab6a56 (patch)
treebec9e47dacfb5ef09cf3ea14866b6bba3f8bddea /ulri
parent99026841d905b58ece27a4946ba5bb96601cf669 (diff)
downloadiurt-6efca95f4de3d89c36d6d8b046b4d2004dab6a56.tar
iurt-6efca95f4de3d89c36d6d8b046b4d2004dab6a56.tar.gz
iurt-6efca95f4de3d89c36d6d8b046b4d2004dab6a56.tar.bz2
iurt-6efca95f4de3d89c36d6d8b046b4d2004dab6a56.tar.xz
iurt-6efca95f4de3d89c36d6d8b046b4d2004dab6a56.zip
Cleanup lines with only whitespace
Diffstat (limited to 'ulri')
-rwxr-xr-xulri84
1 files changed, 42 insertions, 42 deletions
diff --git a/ulri b/ulri
index b414f71..0c74450 100755
--- a/ulri
+++ b/ulri
@@ -256,21 +256,21 @@ foreach my $prefix (keys %pkg_tree) {
my $bot_conf = $config->{bot}{$arch}{$host}{$bot};
my $remote = ssh_setup($config->{ssh_options},
$bot_conf->{user}, $host);
-
+
my $prefix_dir = "$bot_conf->{packages}/$path/$prefix-$arch/";
# If our build is noarch, set arch appropriately.
#
my $lock_file =
"$todo_dir/${prefix}_$arch-noarch.$bot.$host.$date.$pid.lock";
-
+
if (-f $lock_file) {
plog('DEBUG', "$prefix is noarch");
$arch = "noarch";
} else {
$lock_file =~ s/-noarch//;
}
-
+
my $status_file = "$prefix_dir/log/status.log";
plog('INFO', "check status: $host/$arch ($bot [$pid])");
@@ -278,7 +278,7 @@ foreach my $prefix (keys %pkg_tree) {
my $success;
my $fail;
my $later;
-
+
# Check if the build bot finished on the other side
#
if ($status) {
@@ -296,27 +296,27 @@ foreach my $prefix (keys %pkg_tree) {
$fail = 1;
}
}
-
+
if (!$fail) {
my @list = split "\n", sout($remote, "ls $prefix_dir");
my $error;
my $done;
-
+
my $arch_check = join '|', $arch, if_($untranslated_arch{$arch}, @{$untranslated_arch{$arch}});
plog('MSG', "checking for $arch_check arch");
foreach my $result (@list) {
$result =~ /\.(src|$arch_check|noarch)\.rpm$/ or next;
-
+
# do not copy the initial src package
$result =~ /^$prefix/ and next;
-
+
my $result_file = "$done_dir/${prefix}_$result";
-
+
plog('OK', "build ok: $result");
if ($result =~ /\.$arch_check\.rpm$/) {
$done = 1;
}
-
+
plog('DEBUG', "copy files to done");
make_path($done_dir);
if (sget($remote, "$prefix_dir/$result",
@@ -338,7 +338,7 @@ foreach my $prefix (keys %pkg_tree) {
create_file("$done_dir/${prefix}_$arch.done", "$bot $host");
$success = 1;
}
-
+
if ($success) {
# Fetch build log and clean remote machine
make_path("$done_dir/$prefix");
@@ -353,54 +353,54 @@ foreach my $prefix (keys %pkg_tree) {
}
}
} # if ($status)
-
+
#
# Handle build failure
#
-
+
my $proc_state;
if (!$fail) {
chomp($proc_state = sout($remote, "ps h -o state $pid"));
}
-
+
my $seconds = time()-$time;
-
+
# Reasons for failure
my $timeout = $seconds > $config->{faildelay};
my $zombie = $proc_state eq 'Z';
my $ended = !$proc_state;
-
+
unless ($success || $later || $fail || $timeout || $zombie || $ended) {
next bot;
}
-
+
plog('INFO', "delete lock file for $prefix");
unlink $lock_file;
-
+
$run{bot}{$host}{$bot} = 0;
-
+
next bot if $later;
-
+
if (!$ended && !$fail) {
plog('FAIL', "$bot timed out on $host/$arch ($seconds sec) or " .
"it's dead (status $proc_state), removing lock");
$pkg_tree{$prefix}{media}{$media}{arch}{$arch} = 0;
next bot;
}
-
+
next bot if $success && !$fail;
-
+
if (!$status) {
plog('ERROR', "build bot died on $host, reschedule compilation");
next bot;
}
-
+
plog('INFO', "Failure reason: $success || $later || $fail || $timeout || $zombie || $ended");
-
+
plog('FAIL', "build failed");
create_file("$done_dir/${prefix}_$arch.fail", "$bot $host");
make_path($fail_dir);
-
+
mkdir("$fail_dir/$prefix");
if (sget($remote, "$prefix_dir/*", "$fail_dir/$prefix")) {
plog('ERROR', "copying from $host:$prefix_dir/ " .
@@ -415,10 +415,10 @@ foreach my $prefix (keys %pkg_tree) {
if ($user) {
warn_about_failure($user, $ent, $arch, $fail_dir, $path, $prefix);
}
-
+
# clean the log on the compilation machine
ssh($remote, "rm -rf $prefix_dir");
-
+
} # end bot
} # end path
} # end prefix
@@ -475,40 +475,40 @@ foreach my $prefix (sort keys %pkg_tree) {
my $path = $ent->{media}{$media}{path};
my $target = $ent->{target};
my $srpms = $ent->{srpms} or next;
-
+
my $user = get_author_email($ent->{user}) || $config->{packager};
$user =~ s/([<>])/\\$1/g;
-
+
# Local pathnames
my $done_dir = "$done/$path";
my $todo_dir = "$todo/$path";
-
+
# Make sure these exist
make_path($done_dir);
make_path($todo_dir);
-
+
#plog('DEBUG', "searching a bot to compile @$srpms");
-
+
# count noarch todos only once even if searching multiple bots
my $noarch_countflag = 0;
-
+
my $arch_list = find { ref($_) eq 'ARRAY' } $config->{arch}, (ref($config->{arch}) eq 'HASH' ? ($config->{arch}{$target}, $config->{arch}{default}) : ());
my @arch_list = $arch_list ? @$arch_list : keys %{$config->{bot}};
# need to find a bot for each arch
foreach my $arch (@arch_list) {
-
+
# Skip this arch if package is already building as noarch or for this arch
# or if it should not be built on this arch
next if $pkg_tree{$prefix}{media}{$media}{arch}{noarch};
next if $pkg_tree{$prefix}{media}{$media}{arch}{$arch};
next if $pkg_tree{$prefix}{media}{$media}{excluded_arch}{$arch};
-
+
# If all packages in a group are noarch, consider the entire group
# as noarch
#
my $noarch = 1;
$noarch = 0 if any { !check_noarch("$todo_dir/${prefix}_$_") } @$srpms;
-
+
#plog("@$srpms is noarch") if $noarch;
my $excluded = any { !check_arch("$todo_dir/${prefix}_$_", $arch) } @$srpms;
@@ -695,7 +695,7 @@ sub warn_about_failure {
my ($user, $ent, $arch, $fail_dir, $path, $prefix) = @_;
my $text = join("\n", "Build of the following packages failed:\n", map { "- $_" } @{$ent->{srpms}}) . "\n";
my $srpms = join(' ', @{$ent->{srpms}}, undef);
-
+
my $to = get_author_email($user) || "Unknown <$config->{admin}>";
my $cc;
my $fpath = "$config->{http_queue}/failure/$path/$prefix";
@@ -706,11 +706,11 @@ sub warn_about_failure {
$text .= "Reason:\n";
$text .= read_file("$fail_dir/$prefix/log/status.log");
$text .= "\nLog files generated:\n";
-
+
opendir my $DP1, "$fail_dir/$prefix/log/";
foreach my $f1 (sort(readdir($DP1))) {
next if ! -d "$fail_dir/$prefix/log/$f1" || $f1 =~ m/^\./;
-
+
opendir my $DP2, "$fail_dir/$prefix/log/$f1";
foreach my $f2 (readdir $DP2) {
next if $f2 =~ m/^\./;
@@ -719,7 +719,7 @@ sub warn_about_failure {
closedir $DP2;
}
closedir $DP1;
-
+
sendmail($to, $cc,
"Rebuild failed on $arch for $srpms", $text,
"Ulri the scheduler bot <$config->{admin}>", 0, $config);
@@ -739,7 +739,7 @@ sub get_pid_from_file {
sub create_file {
my $file = shift;
my @contents = @_;
-
+
open my $FILE, ">$file" or die "FATAL: can't open $file for writing";
print $FILE "@contents";
}
@@ -767,7 +767,7 @@ __END__
Discussion
----------
-
+
20060802 (Warly)
* I prefer creating a separate scheduler, so that it can eventually call