From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH OSSTEST v2] cs-adjust-flight: Add jobs-rename command which applies a perlop to job names
Date: Tue, 19 Jan 2016 12:47:49 +0000 [thread overview]
Message-ID: <1453207669-6677-1-git-send-email-ian.campbell@citrix.com> (raw)
My intention was to allow creation of adhoc jobs based on a template
but modified e.g. to enable/disable XSM with a sequence something
like:
./cs-adjust-flight $flight copy-jobs $template test-foo-xsm
./cs-adjust-flight $flight jobs-rename test-foo-xsm 's/-xsm$//'
./cs-adjust-flight $flight runvar-set $job enable_xsm false
./cs-adjust-flight ... update %buildjob
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: s/job-rename/jobs-rename/
I left job-status alone.
---
cs-adjust-flight | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/cs-adjust-flight b/cs-adjust-flight
index a72cd88..04f5a7e 100755
--- a/cs-adjust-flight
+++ b/cs-adjust-flight
@@ -18,6 +18,7 @@
# intended-blessing <intended-blessing>
# branch-set <new-branch>
# job-status <job-spec>
+# jobs-rename <job-spec> <perl-expr>
#
# <foo-spec>:
# <foo-name>
@@ -371,6 +372,29 @@ END
});
}
+sub change__jobs_rename {
+ die unless @changes >= 2;
+ my $jobs = shift @changes;
+ my $perlop = shift @changes;
+
+ my $jobq = $dbh_tests->prepare(<<END);
+ UPDATE jobs
+ SET job = ?
+ WHERE flight = ? AND job = ?
+END
+ my $runvarq = $dbh_tests->prepare(<<END);
+ UPDATE runvars
+ SET job = ?
+ WHERE flight = ? AND job = ?
+END
+ for_jobs($dstflight, $jobs, sub {
+ my ($oldjob) = @_;
+ my $newjob = perlop_value ($oldjob, '', $perlop, $oldjob);
+ print "$oldjob renamed to $newjob\n";
+ $jobq->execute($newjob, $dstflight, $oldjob);
+ $runvarq->execute($newjob, $dstflight, $oldjob);
+ })
+}
sub changes () {
debug("CHANGES...\n");
--
2.6.1
next reply other threads:[~2016-01-19 12:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 12:47 Ian Campbell [this message]
2016-01-19 14:25 ` [PATCH OSSTEST v2] cs-adjust-flight: Add jobs-rename command which applies a perlop to job names Ian Jackson
2016-01-19 14:36 ` Ian Campbell
[not found] ` <22174.19392.695718.990474@mariner.uk.xensource.com>
2016-01-19 14:58 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453207669-6677-1-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.