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

[OSSTEST PATCH v2 33/41] cs-bisection-step: Generalise qtxt_common_rev_ok



* Make it into a subref which takes a $table argument.
* Change the two references into function calls using the @{...} syntax
* Move the definition earlier in the file

No change to the generated query.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
v2: New patch.
---
 cs-bisection-step | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/cs-bisection-step b/cs-bisection-step
index 9a0fee39..5d4e179e 100755
--- a/cs-bisection-step
+++ b/cs-bisection-step
@@ -182,6 +182,14 @@ END
 sub flight_rmap ($$) {
     my ($flight, $need_urls) = @_;
 
+    my $qtxt_common_rev_ok = sub {
+       my ($table) = @_;
+       [<<END];
+                 ($table.name LIKE E'built\\_revision\\_%' OR
+                  $table.name LIKE E'revision\\_%')
+END
+    };
+
     $dbh_tests->do(<<END, {});
           CREATE TEMP TABLE tmp_build_info (
               use varchar NOT NULL,
@@ -236,10 +244,6 @@ 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(!$need_urls ? <<END_NOURLS : <<END_URLS);
         SELECT
@@ -249,7 +253,7 @@ $qtxt_common_results
 $qtxt_common_tables
 
            WHERE
-$qtxt_common_rev_condition
+@{ $qtxt_common_rev_ok->('rev') }
 
           ORDER by rev.name;
 
@@ -262,7 +266,7 @@ $qtxt_common_tables
       CROSS JOIN tmp_build_info AS url
 
            WHERE
-$qtxt_common_rev_condition
+@{ $qtxt_common_rev_ok->('rev') }
             AND  url.name LIKE E'tree\\_%'
             AND  url.use = rev.use
             AND  url.job = rev.job
-- 
2.20.1




 


Rackspace

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