From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Jackson Subject: [OSSTEST PATCH 17/27] mg-show-flight-runvars: Decorate synth runvar names with ~ Date: Wed, 16 Sep 2015 14:35:20 +0100 Message-ID: <1442410530-9665-18-git-send-email-ian.jackson@eu.citrix.com> References: <1442410530-9665-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZcCsQ-0000oZ-N7 for xen-devel@lists.xenproject.org; Wed, 16 Sep 2015 13:35:58 +0000 In-Reply-To: <1442410530-9665-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Make mg-show-flight-runvars -a append ~ to the names of synth runvars. (This is consistent with the new syntax in cs-job-create.) We do this by editing $row->[1] (and $colws[1]) so we can avoid disturbing the general column format calcuation and printing; this means we have to copy $row (because the value in the DB $row is readonly). We have to check for $synth eq 'f' as well as $synth being boolean false, because SQLite's typeless nature (or, to put it another way, DBD::SQLite's failure to look at the schema) means that a boolean field's value of 'f' or 't' is simply returned as a string to Perl. But of course "f" is trueish in Perl. Signed-off-by: Ian Jackson --- mg-show-flight-runvars | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mg-show-flight-runvars b/mg-show-flight-runvars index 62d5cba..aa4cc25 100755 --- a/mg-show-flight-runvars +++ b/mg-show-flight-runvars @@ -26,6 +26,7 @@ use Osstest; csreadconfig(); my $synthcond = '(NOT synth)'; +my $synthsufx = ''; for (;;) { last unless @ARGV; @@ -33,7 +34,7 @@ for (;;) { $_ = shift @ARGV; last if m/^\-\-?$/; if (m/^-a$/) { - $synthcond = 'TRUE'; + $synthsufx = '~'; } else { die "$_ ?"; } @@ -52,10 +53,15 @@ my @colws = $dbh_tests->selectrow_array ("SELECT ".(join ',', map { "max(length($_))" } @cols)." $qfrom"); my $q = $dbh_tests->prepare - ("SELECT ".(join ',', @cols)." $qfrom ORDER BY name, job"); + ("SELECT synth, ".(join ',', @cols)." $qfrom ORDER BY synth, name, job"); $q->execute(); +$colws[1] += length $synthsufx; + while (my $row = $q->fetchrow_arrayref()) { + $row = [ @$row ]; + my $synth = shift @$row; + $row->[1] .= $synthsufx if $synth && $synth ne 'f'; # sqlite3 is typeless printf "%-*s %-*s %-*s\n", map { $colws[$_], $row->[$_] } qw(0 1 2) or die $!; } -- 1.7.10.4