From: Ian Jackson Subject: [OSSTEST PATCH 26/32] HostnameSortSwapWords: Make name order mangling configurable Date: Tue, 24 Mar 2015 19:02:49 +0000 Message-ID: <1427223775-8592-27-git-send-email-ian.jackson@eu.citrix.com> References: <1427223775-8592-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.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YaU6c-00007f-IX for xen-devel@lists.xenproject.org; Tue, 24 Mar 2015 19:03:14 +0000 In-Reply-To: <1427223775-8592-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 We still default to having the mangling enabled. Arguably this is wrong I'm am minimising the number of things that will be wrong for the existing Cambridge instance. Signed-off-by: Ian Jackson --- Osstest.pm | 2 ++ mg-hosts | 5 +++-- ms-planner | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Osstest.pm b/Osstest.pm index 9fbadbd..5854257 100644 --- a/Osstest.pm +++ b/Osstest.pm @@ -73,6 +73,8 @@ our %c = qw( Baud 115200 DebianNonfreeFirmware firmware-bnx2 + + HostnameSortSwapWords 1 ); $c{$_}='' foreach qw( diff --git a/mg-hosts b/mg-hosts index 497139a..a911099 100755 --- a/mg-hosts +++ b/mg-hosts @@ -439,9 +439,10 @@ END sub cmd_showflags () { die if @ARGV; + my $sortkey = !$c{HostnameSortSwapWords} ? "hostname" + : "split_part(hostname, '-', 2), hostname"; my $hostsq= $dbh_tests->prepare(<prepare(<{Events}{$reso} } ]; } - my $colheadsortkey= sub { ($_[0] =~ m/-/ ? "$' $`" : "").$_[0]; }; + my $colheadsortkey= + !$c{HostnameSortSwapWords} ? sub { $_[0]; } + : sub { ($_[0] =~ m/-/ ? "$' $`" : "").$_[0]; }; my @colheads = sort { $colheadsortkey->($a) cmp $colheadsortkey->($b) } keys %{ $plan->{Events} }; -- 1.7.10.4