From: Dirk Koopman Date: Tue, 19 May 2020 15:55:03 +0000 (+0100) Subject: add branch to sh/ver, rm redundant module X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?p=spider.git;a=commitdiff_plain;h=2462f5e2370ec0bdafe12deea0d131ea3718fb29 add branch to sh/ver, rm redundant module --- diff --git a/Changes b/Changes index 445b8c3f..66a2f78e 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,7 @@ 1. Convert all remaining commands and areas within the program that used the DB_File/Storable interface to DXUsers.pm to use the (hopefully) more stable JSON text file + caching interface. Here's hoping. +2. Add branch name to startup and sh/version. 16May20======================================================================= 1. Crontab can now spawn_cmd('export_users') - very safely. 15May20======================================================================= diff --git a/cmd/show/node.pl b/cmd/show/node.pl index 4e03f4ba..5fdbf103 100644 --- a/cmd/show/node.pl +++ b/cmd/show/node.pl @@ -52,9 +52,8 @@ sub generate push @call, DXUser::scan(sub { my $k = shift; - my $l = shift; # cheat, don't decode because we can easily pull it out from the json test - return $l =~ m{"sort":"[ACRSX]"} ? $k : (); + return $_[0] =~ m{"sort":"[ACRSX]"} ? $k : (); }); } 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/Version.pm b/perl/Version.pm deleted file mode 100644 index 0b96d8b2..00000000 --- a/perl/Version.pm +++ /dev/null @@ -1,16 +0,0 @@ -# -# Version information for DXSpider -# -# DO NOT ALTER THIS FILE. It is generated automatically -# and will be overwritten -# - -package main; - -use vars qw($version $build $gitversion); - -$version = '1.57'; -$build = '46'; -$gitversion = '855513b[i]'; - -1; diff --git a/perl/cluster.pl b/perl/cluster.pl index 7492368a..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; @@ -408,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(); @@ -492,6 +493,8 @@ sub setup_start import Encode; $can_encode = 1; } + $gitbranch = 'none'; + $gitversion = 'none'; eval { require Git; }; unless ($@) { import Git; @@ -509,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; @@ -520,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 diff --git a/perl/issue.pl b/perl/issue.pl deleted file mode 100755 index fd09e859..00000000 --- a/perl/issue.pl +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env perl -# -# create a version and build id for the project using git ids -# -# -# -# Copyright (c) 2007 Dirk Koopman, G1TLH -# - -# Determine the correct place to put stuff -BEGIN { - # root of directory tree for this system - $root = "/spider"; - $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'}; -} - -use strict; - -use vars qw($root); -my $fn = "$root/perl/Version.pm"; -my $desc = `git describe --long`; -my ($v, $s, $b, $g) = $desc =~ /^([\d.]+)(?:\.(\d+))?-(\d+)-g([0-9a-f]+)/; -$b++; # to account for the commit that is about to happen - -open F, ">$fn" or die "issue.pl: can't open $fn $!\n"; -print F qq(# -# Version information for DXSpider -# -# DO NOT ALTER THIS FILE. It is generated automatically -# and will be overwritten -# - -package main; - -use vars qw(\$version \$build \$gitversion); - -\$version = '$v'; -\$build = '$b'; -\$gitversion = '$g\[i]'; - -1; -); - -exit(0);