From d44f5f322cdec614765763a28d7c475c06f9ba31 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Sun, 13 Apr 2014 22:40:30 +0000 Subject: Add a way to have a build waiting for others. This is a list of prefix, so if one of the builds fails dependent ones will be rejected. It would be nicer for a user perspective to specify that we want to wait for the src.rpm of foo >= XX.YY to be available, with some time limit, as it would get built if the original build fails but get submitted again, but that would be much more complicated to implement. This simple solution allows a Youri::Submit action to submit build of dependant packages while the upload is not finished yet. For example this will allow to automatically rebuild kmod-* and drakx-installer-images after a new kernel is uploaded. --- NEWS | 1 + ulri | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/NEWS b/NEWS index de84f19..96c0542 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ - close stdin when --shell is not used - add an option to discard built packages - install icecream when it is enabled +- allow to specify dependent builds 0.6.19 - fix missing used function in emi and ulri diff --git a/ulri b/ulri index 45d48da..5787fc6 100755 --- a/ulri +++ b/ulri @@ -210,6 +210,7 @@ my $compildone = {}; my $todo = "$config->{queue}/todo"; my $failure = "$config->{queue}/failure"; my $done = "$config->{queue}/done"; +my $reject = "$config->{queue}/reject"; # Raise this when the noarch package starts to build on any bot my %noarch_build; @@ -276,6 +277,20 @@ sub todo_func { 'time' => $time }; } + + if ($r =~ /(\d{14}\.\w+\.\w+\.\d+)_([\w-]+)\.(\w+)\.(\w+)\.(\d{14})\.(\d+)\.deps$/) { + my ($prefix, $arch, $bot, $host, $date, $pid) = ($1, $2, $3, $4, $5, $6); + + my @deps; + + open my $FILE, "<$todo/$f/$m/$s/$r"; + while(my $line = <$FILE>) { + chomp $line; + push @deps,$line; + } + + $pkg_tree{$prefix}{deps} = @deps; + } } sub done_func { @@ -509,6 +524,38 @@ foreach my $prefix (sort keys %pkg_tree) { next if $later{$prefix}; my $ent = $pkg_tree{$prefix}; + + my $ready = 1; + my $failed_dep = 0; + + foreach my $dep (@{$ent->{deps}}) { + if (glob "$done/*/*/*/$dep.upload") { + plog('DEBUG', "Dependent build $dep was uploaded"); + next; + } + # $dep was not uploaded yet, so it's too early to build this one + $ready = 0; + if (glob "$reject/*/*/*/$dep.youri" || glob "$done/*/*/*/${dep}_*.fail") { + plog('ERROR', "Dependent build $dep has failed"); + $failed_dep = 1; + } + } + + if ($failed_dep) { + plog('DEBUG', "Dependent build(s) failed, rejecting this one"); + foreach my $media (keys %{$ent->{media}}) { + my $path = $ent->{media}{$media}{path}; + my $target = $ent->{target}; + make_path("$reject/$path"); + foreach my $srpm (@{$ent->{srpms}}) { + move("$todo/$path/${prefix}_$srpm","$reject/$path/${prefix}_$srpm"); + } + } + next; + } + + next unless $ready; + foreach my $media (keys %{$ent->{media}}) { my $path = $ent->{media}{$media}{path}; my $target = $ent->{target}; -- cgit v1.2.1