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

[Xen-devel] [OSSTEST PATCH 2/9] cs-adjust-flight: Break out copy_jobs_*



No functional change.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 cs-adjust-flight | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/cs-adjust-flight b/cs-adjust-flight
index ee1d917c..badabeff 100755
--- a/cs-adjust-flight
+++ b/cs-adjust-flight
@@ -194,10 +194,8 @@ sub do_rm_job ($) {
     verbose "$dstflight.$job job deleted\n" if $count;
 }
 
-sub copy_jobs ($$) {
-    my ($srcflight, $jobs) = @_;
-    prep_rm_jobs();
-    my @job_copy_qs = map { $dbh_tests->prepare($_) }
+sub copy_jobs_qs () {
+    map { $dbh_tests->prepare($_) }
         ("INSERT INTO jobs (flight, job, recipe, status)".
          "     SELECT ?, job, recipe, 'queued'".
          "       FROM jobs".
@@ -206,12 +204,22 @@ sub copy_jobs ($$) {
          "     SELECT ?, job, name, val, 'f'".
          "       FROM runvars".
          "      WHERE flight = ? AND job = ? AND NOT synth");
+}
+sub copy_jobs_do ($$) {
+    my ($qs, $srcflight, $srcjob) = @_;
+    $_->execute($dstflight, $srcflight, $job) foreach @$qs;
+    verbose "$dstflight.$job job created from $srcflight.$job\n";
+}
+
+sub copy_jobs ($$) {
+    my ($srcflight, $jobs) = @_;
+    prep_rm_jobs();
+    my @job_copy_qs = copy_jobs_qs;
     for_jobs($dstflight, $jobs, \&do_rm_job, 1);
     for_jobs($srcflight, $jobs, \&do_rm_job);
     for_jobs($srcflight, $jobs, sub {
         my ($job) = @_;
-        $_->execute($dstflight, $srcflight, $job) foreach @job_copy_qs;
-       verbose "$dstflight.$job job created from $srcflight.$job\n";
+       copy_jobs_do(\@job_copy_qs, $srcflight, $job);
     });
 }
 
-- 
2.11.0


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

 


Rackspace

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