From patchwork Thu May 2 17:42:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 10927417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6FF4E1390 for ; Thu, 2 May 2019 17:54:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 530D91FF13 for ; Thu, 2 May 2019 17:54:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 474051FF83; Thu, 2 May 2019 17:54:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ECA64202A5 for ; Thu, 2 May 2019 17:54:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hMFtS-0006hP-4s; Thu, 02 May 2019 17:53:14 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hMFtQ-0006gl-CC for xen-devel@lists.xenproject.org; Thu, 02 May 2019 17:53:12 +0000 X-Inumbo-ID: 26efc359-6d03-11e9-843c-bc764e045a96 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 26efc359-6d03-11e9-843c-bc764e045a96; Thu, 02 May 2019 17:53:11 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.60,422,1549929600"; d="scan'208";a="84983434" From: Ian Jackson To: Date: Thu, 2 May 2019 18:42:31 +0100 Message-ID: <20190502174238.23848-3-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190502174238.23848-1-ian.jackson@eu.citrix.com> References: <20190502174238.23848-1-ian.jackson@eu.citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [OSSTEST PATCH 2/9] cs-adjust-flight: Break out copy_jobs_* X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP No functional change. Signed-off-by: Ian Jackson --- 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); }); }