xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [OSSTEST PATCH 3/4] cs-ajust-flight: Provide runvar-build-set
Date: Fri, 2 Dec 2016 11:55:39 +0000	[thread overview]
Message-ID: <1480679740-32372-3-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1480679740-32372-1-git-send-email-ian.jackson@eu.citrix.com>

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 cs-adjust-flight | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/cs-adjust-flight b/cs-adjust-flight
index 33ff9df..45c1420 100755
--- a/cs-adjust-flight
+++ b/cs-adjust-flight
@@ -14,6 +14,7 @@
 #   runvar-del <job-spec> <var-spec>
 #   runvar-change <job-spec> <var-spec> <old-value> <new-value>
 #   runvar-perlop <job-spec> <var-spec> <perl-expr>
+#   runvar-build-set <job-spec> <var-spec> <old-value> <flight>[.<job>]
 #   recipe-set <job-spec> <new-value>
 #   intended-blessing <intended-blessing>
 #   branch-set <new-branch>
@@ -26,6 +27,12 @@
 #   ^<pcre>           means $foo =~ m/^<pcre>/
 #   /<pcre>           means $foo =~ m/<pcre>/
 #
+# runvar-build-set  always only affects runvars m/buildjob$/
+#                    and may be further limited by <var-spec>;
+#                   and, <old-value> is matched against a value
+#                    containing the being-manipulated flight name
+#                    even if the actual runvar value omits it
+#
 # <dst-flight>:
 #   <flight>
 #   new:<intended-blessing>
@@ -335,6 +342,39 @@ sub change__runvar_perlop {
     }, 'IGNORE');
 }
 
+sub change__runvar_build_set {
+    die unless @changes >= 4;
+    my $jobs = shift @changes;
+    my $vars = shift @changes;
+    my $specoldval = shift @changes;
+    my $specval = shift @changes;
+
+    my $matches=0;
+
+    my ($oldvalok_fn) = notspec_exfn(
+        "RUNVAR-BUILD-SET '$jobs' '$vars' SPECOLDVAL",
+				     $specoldval);
+
+    for_runvars($jobs, $vars, sub {
+        my ($job, $name, $varrow) = @_;
+	return unless $name =~ m/buildjob$/;
+
+	my $oldval = $varrow->{val};
+	$oldval = flight_otherjob($dstflight,$oldval);
+	return unless $oldvalok_fn->($oldval);
+
+	$matches++;
+	$oldval =~ s/^\d+\.//; # strip out previous flight
+	my $newval = $specval =~ m/\./ ? $specval : "$specval.$oldval";
+        runvar_set($job, $name, $newval, " (modified from \`$oldval')")
+	    if $newval ne $oldval;
+    }, 'IGNORE');
+
+    print STDERR
+	"runvar-build-set '$jobs' '$vars' '$specoldval' matched nothing!\n"
+	unless $matches;
+}
+
 sub change__recipe_set {
     die unless @changes >= 2;
     my $jobs = shift @changes;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-12-02 11:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 11:55 [OSSTEST PATCH 1/4] cs-ajust-flight: Use qr{} syntax Ian Jackson
2016-12-02 11:55 ` [OSSTEST PATCH 2/4] cs-adjust-flight: Lift notspec_exfn out of for_things Ian Jackson
2016-12-02 11:55 ` Ian Jackson [this message]
2016-12-02 11:55 ` [OSSTEST PATCH 4/4] ts-xtf-*: Provide for host specs on command line Ian Jackson
2016-12-02 11:57   ` Wei Liu
2017-02-05 16:42   ` Wei Liu

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=1480679740-32372-3-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).