From: Dirk Koopman Date: Wed, 20 May 2020 15:10:02 +0000 (+0100) Subject: show git branch in show/version X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=d9a5a954acbdca08db5c0d138e77329574cc4d52;p=spider.git show git branch in show/version --- diff --git a/Changes b/Changes index 103343ed..1af58d83 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. +2. Show git branch in show/version. 17May20======================================================================= 1. Backport DXSubprocess to change serialisations. Currently the internals of Mojo::IOLoop::Subprocess defaults to diff --git a/cmd/show/version.pl b/cmd/show/version.pl index 31acc5ca..0b0f0cfb 100644 --- a/cmd/show/version.pl +++ b/cmd/show/version.pl @@ -23,7 +23,7 @@ if ($self->priv > 5 && @in) { } else { my ($year) = (gmtime($main::systime))[5]; $year += 1900; - push @out, "DX Spider Cluster version $main::version (build $main::build git: $main::gitversion) on \u$^O"; + 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"; } diff --git a/perl/cluster.pl b/perl/cluster.pl index 6c0ff3d6..5baf0297 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -153,9 +153,10 @@ use Data::Dumper; use IO::File; use Fcntl ':flock'; use POSIX ":sys_wait_h"; -use Version; use Web; +use vars qw($version $build $gitversion $gitbranch); + use Local; @@ -380,7 +381,6 @@ sub cease $SIG{'INT'} = 'IGNORE'; } - DXUser::sync; if (defined &Local::finish) { eval { @@ -409,7 +409,7 @@ sub cease $l->close_server; } - LogDbg('cluster', "DXSpider V$version, build $build (git: $gitversion) ended"); + LogDbg('cluster', "DXSpider V$version, build $build (git: $gitbranch/$gitversion) ended"); dbg("bye bye everyone - bye bye"); dbgclose(); Logclose(); @@ -493,6 +493,8 @@ sub setup_start import Encode; $can_encode = 1; } + $gitbranch = 'none'; + $gitversion = 'none'; eval { require Git; }; unless ($@) { import Git; @@ -510,6 +512,14 @@ sub setup_start $build = $b || 0; $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; @@ -521,7 +531,7 @@ sub setup_start # banner my ($year) = (gmtime)[5]; $year += 1900; - LogDbg('cluster', "DXSpider V$version, build $build (git: $gitversion) started"); + LogDbg('cluster', "DXSpider V$version, build $build (git: $gitbranch/$gitversion) started"); dbg("Copyright (c) 1998-$year Dirk Koopman G1TLH"); # load Prefixes @@ -536,7 +546,7 @@ sub setup_start # initialise User file system dbg("loading user file system ..."); - DXUser::init(1); + DXUser::init(4); # version 4 == json format # look for the sysop and the alias user and complain if they aren't there {