[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 2/4] cs-bisection-step: flight_rmap Disassemble the revisions query



Break out various pieces that we are going to need to reuse for the
other version of this query (which won't have the url join).

Also, rather than retrieving the `tree_<tree>' runvar and calculating
the tree name from that, use the `[built_]revision_<tree>' runvar from
rev.

No overall functional change.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 cs-bisection-step | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/cs-bisection-step b/cs-bisection-step
index f9ef1558..b36bac05 100755
--- a/cs-bisection-step
+++ b/cs-bisection-step
@@ -227,19 +227,30 @@ END
               AND flight = ?
 END
 
-    my $sth= db_prepare(<<END);
-
-        SELECT url.val AS uval,
+    my $qtxt_common_results = <<END;
+               rev.name AS revname,
               rev.val AS rval,
               rev.job AS job,
       ${\ other_revision_job_suffix('rev.job','rev.use',' ') } AS othrev,
-              url.name AS longname
-
+END
+    my $qtxt_common_tables = <<END;
            FROM tmp_build_info AS rev
+END
+    my $qtxt_common_rev_condition = <<END;
+                 (rev.name LIKE E'built\\_revision\\_%' OR
+                  rev.name LIKE E'revision\\_%')
+END
+
+    my $sth= db_prepare(<<END);
+        SELECT
+$qtxt_common_results
+              url.val AS uval
+
+$qtxt_common_tables
       CROSS JOIN tmp_build_info AS url
 
-           WHERE (rev.name LIKE E'built\\_revision\\_%' OR
-                  rev.name LIKE E'revision\\_%')
+           WHERE
+$qtxt_common_rev_condition
             AND  url.name LIKE E'tree\\_%'
             AND  url.use = rev.use
             AND  url.job = rev.job
@@ -247,7 +258,6 @@ END
                   rev.name = 'revision_'       || substr(url.name,6))
 
           ORDER by url.val;
-         
 END
     $sth->execute();
     my $row;
@@ -255,7 +265,7 @@ END
     my (@ttreenames, @ttreeurls, @trevisions);
     while ($row= $sth->fetchrow_hashref()) {
         next if $row->{othrev} eq 'DISCARD';
-        $row->{longname} =~ m/^tree_/ or die "$row->{longname} ?";
+        $row->{revname} =~ m/^(?:built_)?revision_/ or die "$row->{revname} ?";
         my $name= $'; #'
         print DEBUG " $flight.$row->{job} uval=$row->{uval}".
             " rval=$row->{rval} name=$name othrev=\`$row->{othrev}'\n";
-- 
2.20.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.