From ccd0ff64f5f779df5a33a6aa56b52b4005dbfb10 Mon Sep 17 00:00:00 2001 From: Samveen Gulati Date: Mon, 10 Oct 2016 15:12:57 +0000 Subject: [PATCH] [xCAT-client]xdshbak: Use `version` sorting on hostnames --- xCAT-client/bin/xdshbak | 7 +++++-- xCAT-client/debian/control | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/xCAT-client/bin/xdshbak b/xCAT-client/bin/xdshbak index c200a185c..7084614bb 100644 --- a/xCAT-client/bin/xdshbak +++ b/xCAT-client/bin/xdshbak @@ -10,6 +10,9 @@ use xCAT::MsgUtils; use xCAT::DSHCLI; use locale; use Getopt::Std; + +eval "use Sort::Versions qw/versioncmp/; 1;" or *versioncmp = sub ($$) { ($a,$b)= @_ ; return $a cmp $b }; + ##################################################################### # # # Module: xdshbak # @@ -231,7 +234,7 @@ sub print_list local (@lines, $numhosts, $hn_string, $l_string); - foreach $hostname (sort @hs) + foreach $hostname (sort { versioncmp($a, $b) } @hs) { if (!$::opt_x) { ($num_hosts >= 1) && print "\n"; } $num_hosts++; @@ -297,7 +300,7 @@ sub print_tree ($num_hosts >= 1) && print "\n"; $num_hosts++; @wc = split(/:/, $hdr{$index}); - @wc = sort(@wc); + @wc = sort { versioncmp($a, $b) } @wc; #system "$SPMSG DSH $MSGCAT INFO511 'HOSTS '"; xCAT::MsgUtils->message("I", diff --git a/xCAT-client/debian/control b/xCAT-client/debian/control index 321fc1b19..032f70438 100644 --- a/xCAT-client/debian/control +++ b/xCAT-client/debian/control @@ -8,5 +8,6 @@ Standards-Version: 3.7.2 Package: xcat-client Architecture: all Depends: ${perl:Depends}, nmap, perl-xcat +Recommends: libsort-versions-perl Description: Core executables and data of the xCAT management project xCAT-client provides the fundamental xCAT commands (chtab, chnode, rpower, etc) helpful in administrating systems at scale, with particular attention paid to large HPC clusters.