@@ -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);
});
}
No functional change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> --- cs-adjust-flight | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)