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 v1 2/5] mg-show-flight-runvars: move collection into a sub
Date: Mon, 1 Feb 2016 14:28:29 +0000 [thread overview]
Message-ID: <1454336912-28503-2-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1454336890.28781.99.camel@citrix.com>
This will make it easier to collect more rows.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
mg-show-flight-runvars | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/mg-show-flight-runvars b/mg-show-flight-runvars
index 820c577..0995430 100755
--- a/mg-show-flight-runvars
+++ b/mg-show-flight-runvars
@@ -43,29 +43,35 @@ for (;;) {
die unless @ARGV==1 && $ARGV[0] =~ m/^\w+$/;
-our ($flight) = @ARGV;
our @cols = qw(job name val);
our @rows;
+our @colws;
-$flight =~ m/^\d+/ or $flight = "'$flight'";
-my $qfrom = "FROM runvars WHERE flight=$flight AND $synthcond";
+sub collect ($) {
+ my ($flight) = @_;
-my @colws = $dbh_tests->selectrow_array
- ("SELECT ".(join ',', map { "max(length($_))" } @cols)." $qfrom");
+ $flight =~ m/^\d+/ or $flight = "'$flight'";
+ my $qfrom = "FROM runvars WHERE flight=$flight AND $synthcond";
-my $q = $dbh_tests->prepare
- ("SELECT synth, ".(join ',', @cols)." $qfrom ORDER BY synth, name, job");
-$q->execute();
+ @colws = $dbh_tests->selectrow_array
+ ("SELECT ".(join ',', map { "max(length($_))" } @cols)." $qfrom");
-$colws[1] += length $synthsufx;
+ my $q = $dbh_tests->prepare
+ ("SELECT synth, ".(join ',', @cols)." $qfrom ORDER BY synth, name, job");
+ $q->execute();
-while (my (@row) = $q->fetchrow_array()) {
- my $synth = shift @row;
- $row[1] .= $synthsufx if $synth && $synth ne 'f'; # sqlite3 is typeless
- push @rows, \@row;
+ while (my (@row) = $q->fetchrow_array()) {
+ my $synth = shift @row;
+ $row[1] .= $synthsufx if $synth && $synth ne 'f'; # sqlite3 is typeless
+ push @rows, \@row;
+ }
}
+$colws[1] += length $synthsufx;
+
+collect($ARGV[0]);
+
foreach my $row (@rows) {
printf "%-*s %-*s %-*s\n", map { $colws[$_], $row->[$_] } qw(0 1 2)
or die $!;
--
2.6.1
next prev parent reply other threads:[~2016-02-01 14:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-01 14:28 [PATCH OSSTEST v1 0/5] mg-show-flight-runvars: recursively follow buildjob runvars Ian Campbell
2016-02-01 14:28 ` [PATCH OSSTEST v1 1/5] mg-show-flight-runvars: collect rows into @rows, output in second step Ian Campbell
2016-02-01 14:42 ` Ian Jackson
2016-02-01 14:28 ` Ian Campbell [this message]
2016-02-01 14:55 ` [PATCH OSSTEST v1 2/5] mg-show-flight-runvars: move collection into a sub Ian Jackson
2016-02-01 14:28 ` [PATCH OSSTEST v1 3/5] mg-show-flight-runvars: calculate @colsw from @rows not via SQL Ian Campbell
2016-02-01 14:56 ` Ian Jackson
2016-02-01 14:28 ` [PATCH OSSTEST v1 4/5] mg-show-flight-runvars: include $flight. prefix on job name if -r (recurse) Ian Campbell
2016-02-01 15:19 ` Ian Jackson
2016-02-01 14:28 ` [PATCH OSSTEST v1 5/5] mg-show-flight-runvars: recurse on buildjobs upon request Ian Campbell
2016-02-01 15:19 ` Ian Jackson
2016-02-01 16:16 ` Ian Campbell
2016-02-01 16:53 ` Ian Jackson
2016-02-03 9:48 ` [PATCH OSSTEST 5/5 v2] " Ian Campbell
2016-02-03 12:01 ` Ian Jackson
2016-02-03 12:37 ` [PATCH OSSTEST 5/5 v3] " Ian Campbell
2016-02-08 16:12 ` Ian Jackson
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=1454336912-28503-2-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 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).