diff mbox

[OSSTEST,10/11] cs-adjust-flight: Rework runvar-build-set new value handling

Message ID 1496857742-20191-11-git-send-email-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Jackson June 7, 2017, 5:49 p.m. UTC
Previously, if it didn't contain a `.', it would be taken as a flight
name and completed with the old job name.  (This was not documented.)

This meant that there was no way to adjust to refer to a differnet job
in the flight being manipulated without specifying the flight number
(which is not desirable, nor even possible with new:)

Instead, we adopt the convention that a trailing . completes the value
with the old job name.  Values without a . are taken literally as a
job name, resulting in intra-flight references to that job.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
v4: New patch, which helps with issues I tripped over while trying
     to ad-hoc test the livepatch series.
---
 cs-adjust-flight | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/cs-adjust-flight b/cs-adjust-flight
index 9812d12..03257a6 100755
--- a/cs-adjust-flight
+++ b/cs-adjust-flight
@@ -32,6 +32,8 @@ 
 #                   and, <old-value> is matched against a value
 #                    containing the being-manipulated flight name
 #                    even if the actual runvar value omits it
+#                   and, if <new-value> ends in ., it is
+#                    completed with the <old-value>'s job name
 #
 # <dst-flight>:
 #   <flight>
@@ -361,12 +363,11 @@  sub change__runvar_build_set {
 	return unless $name =~ m/buildjob$/;
 
 	my $oldval = $varrow->{val};
-	$oldval = flight_otherjob($dstflight,$oldval);
-	return unless $oldvalok_fn->($oldval);
+	my ($oldflt,$oldjob) = flight_otherjob($dstflight,$oldval);
+	return unless $oldvalok_fn->("$oldflt.$oldjob");
 
 	$matches++;
-	$oldval =~ s/^\d+\.//; # strip out previous flight
-	my $newval = $specval =~ m/\./ ? $specval : "$specval.$oldval";
+	my $newval = $specval =~ m/\.$/ ? "$specval$oldjob": $specval;
         runvar_set($job, $name, $newval, " (modified from \`$oldval')")
 	    if $newval ne $oldval;
     }, 'IGNORE');