When we detect that we are considering a job which is identically
named to one earlier in the dependency chain, it could happen that the
final referencing runvar in the job at which we break the cycle is
actually to an unqualified job name.

(This cannot happen unless the cycle has more than 2 jobs, and
therefore more than one job name, because otherwise the job we would
be copying would have a self-reference.  So it cannot occur right
now.)

So when breaking the cycle, we should update the job we are building
to refer to the exact flight and job we want it to reuse.

The most convenient way to do this is to reorganise the new recursion
suppression code: we retain the suppressed entries in $subjobs, and
filter them as appropriate.

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
---
 cs-bisection-step | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/cs-bisection-step b/cs-bisection-step
index a7e0336..05bfaa0 100755
--- a/cs-bisection-step
+++ b/cs-bisection-step
@@ -1214,20 +1214,17 @@ END
         }
     }
 
-    @$subjobs = grep {
-        if ($recursion_track{ $_->{job} }) {
-            print STDERR "Not recursively creating another $_->{job} (".
-                (
-                 join " -> ",
-                 map { $_->{Spec} }
-                 sort { $a->{Depth} <=> $b->{Depth} }
-                 values %recursion_track
-                ). " -> $_->{orgflight}.$_->{job}\n";
-            0;
-        } else {
-            1;
-        }
-    } @$subjobs;
+    foreach my $subjob (@$subjobs) {
+        next unless $recursion_track{ $subjob->{job} };
+        $subjob->{suppress} = 1;
+        print STDERR "Not recursively demanding another $subjob->{job} (".
+            (
+             join " -> ",
+             map { $_->{Spec} }
+             sort { $a->{Depth} <=> $b->{Depth} }
+             values %recursion_track
+            ). " -> $subjob->{orgflight}.$subjob->{job}\n";
+    }
 
     # See if there's a build we can reuse
 
@@ -1237,7 +1234,8 @@ END
 
     my $usejob;
 
-    if ($cache_option and $cacheok and $recipe =~ m/^build/ and !@$subjobs) {
+    if ($cache_option and $cacheok and $recipe =~ m/^build/
+        and !grep { !$_->{suppress} } @$subjobs) {
        my $reusejob= $builds_investigated{$popjob};
        if (!defined $reusejob) {
            print STDERR "Searching for $popjob (like $copyflight) to 
reuse...\n";
@@ -1309,7 +1307,13 @@ END
 END
     foreach my $subjob (@$subjobs) {
         my $target;
-        $target= preparejob($subjob->{job}, $subjob->{orgflight}, 1);
+        if ($subjob->{suppress}) {
+            $target = "$subjob->{orgflight}.$subjob->{job}";
+            print STDERR "Reusing $target for $subjob->{name}".
+                " in $popflight.$popjob\n";
+        } else {
+            $target= preparejob($subjob->{job}, $subjob->{orgflight}, 1);
+        }
         $jobsetq->execute($target, $popflight, $popjob, $subjob->{name});
     }
     $jobsetq->finish();
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to