From: Dirk Koopman Date: Wed, 20 May 2020 15:24:56 +0000 (+0100) Subject: show git branch on show/version X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=4b7dbe2c98c3694692b28584f096ae0c479a3174;p=spider.git show git branch on show/version --- diff --git a/Changes b/Changes index 8003beed..c6d7e678 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,7 @@ mojo branch. Running this program just *BEFORE* doing your next update of the mojo branch *should* ensure a seemless transition to the Storable & DB_File free version of the users file. +1. Alter show/version to show the current git branch we are running on. 24Apr20======================================================================= 1. Add CTY-3008 prefixes 22Apr20======================================================================= diff --git a/cmd/show/version.pl b/cmd/show/version.pl index 7107570d..0b0f0cfb 100644 --- a/cmd/show/version.pl +++ b/cmd/show/version.pl @@ -6,10 +6,26 @@ # # +my ($self, $line) = @_; my @out; -my ($year) = (gmtime($main::systime))[5]; -$year += 1900; -push @out, "DX Spider Cluster version $main::version (build $main::subversion.$main::build git: $main::gitversion) on \u$^O"; -push @out, "Copyright (c) 1998-$year Dirk Koopman G1TLH"; +my @in = map {uc} split /\s+/, $line; + +if ($self->priv > 5 && @in) { +# $DB::single=1; + + my $q = $in[0] eq 'ALL' ? '.*' : join('|', @in); + my @n = sort {$a->call cmp $b->call} grep {$_->call =~ /^(?:$q)/} Route::Node::get_all(); + push @out, " Node Version Build PC9X via PC92"; + foreach my $n (@n) { + push @out, sprintf " %-10s %5d %5s %3s %3s", $n->call, $n->version, $n->build, yesno($n->do_pc9x), yesno($n->via_pc92); + } + push @out, ' ' . scalar @n . " Nodes found"; +} else { + my ($year) = (gmtime($main::systime))[5]; + $year += 1900; + push @out, "DX Spider Cluster version $main::version (build $main::build git: $main::gitbranch/$main::gitversion) on \u$^O"; + push @out, "Copyright (c) 1998-$year Dirk Koopman G1TLH"; +} + return (1, @out); diff --git a/perl/DXProtout.pm b/perl/DXProtout.pm index fc116f8e..d829fc37 100644 --- a/perl/DXProtout.pm +++ b/perl/DXProtout.pm @@ -130,7 +130,7 @@ sub pc17 sub pc18 { my $flags = shift; - return "PC18^DXSpider Version: $main::version Build: $main::subversion.$main::build Git: $main::gitversion$flags^$DXProt::myprot_version^"; + return "PC18^DXSpider Version: $main::version Build: $main::subversion.$main::build Git: $main::gitbranch/$main::gitversion$flags^$DXProt::myprot_version^"; } # diff --git a/perl/cluster.pl b/perl/cluster.pl index b9031719..9c47042b 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -128,7 +128,6 @@ use Data::Dumper; use IO::File; use Fcntl ':flock'; use POSIX ":sys_wait_h"; -use Version; use Local; @@ -155,6 +154,8 @@ $maxconnect_node = 0; # Ditto but for nodes. In either case if a new incoming # takes the no of references in the routing table above these numbers # then the connection is refused. This only affects INCOMING connections. +use vars qw($version $subversion $build $gitversion $gitbranch); + # send a message to call on conn and disconnect sub already_conn { @@ -318,7 +319,7 @@ sub cease $l->close_server; } - LogDbg('cluster', "DXSpider V$version, build $subversion.$build (git: $gitversion) ended"); + LogDbg('cluster', "DXSpider V$version, build $subversion.$build (git: $gitbranch/$gitversion) ended"); dbgclose(); Logclose(); @@ -403,6 +404,8 @@ if (DXSql::init($dsn)) { import Git; # determine the real version number + $gitbranch = 'none'; + $gitversion = 'none'; my $repo = Git->repository(Directory => "$root/.git"); if ($repo) { my $desc = $repo->command_oneline(['describe'], STDERR => 0); @@ -414,6 +417,15 @@ if (DXSql::init($dsn)) { $gitversion = "$g\[r]"; } } + my @branch = $repo->command([qw{branch}], STDERR=>0); + for (@branch) { + my ($star, $b) = split /\s+/; + if ($star eq '*') { + $gitbranch = $b; + last; + } + } + } $SIG{__DIE__} = $w; } @@ -424,7 +436,7 @@ DXXml::init(); # banner my ($year) = (gmtime)[5]; $year += 1900; -LogDbg('cluster', "DXSpider V$version, build $subversion.$build (git: $gitversion) started"); +LogDbg('cluster', "DXSpider V$version, build $subversion.$build (git: $gitbranch/$gitversion) started"); dbg("Copyright (c) 1998-$year Dirk Koopman G1TLH"); # load Prefixes