add branch to sh/ver, rm redundant module
authorDirk Koopman <djk@tobit.co.uk>
Tue, 19 May 2020 15:55:03 +0000 (16:55 +0100)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 19 May 2020 15:55:03 +0000 (16:55 +0100)
Changes
cmd/show/node.pl
cmd/show/version.pl
perl/Version.pm [deleted file]
perl/cluster.pl
perl/issue.pl [deleted file]

diff --git a/Changes b/Changes
index 445b8c3f66ba05146855a82024fe5e1ff8f3239e..66a2f78ebd62fd7c78128a0e7ba559fc17852af3 100644 (file)
--- 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=======================================================================
index 4e03f4bad712596388a233b09764e8cf14400c09..5fdbf103113c36c34b00eb4f6e74273366c6dc5e 100644 (file)
@@ -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 : ();
                                                                  });
        }
 
index 31acc5caddcd10a5d425003d4a9857d316cde9a0..0b0f0cfb66df9645b7675af023173a2810f48c22 100644 (file)
@@ -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 (file)
index 0b96d8b..0000000
+++ /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;
index 7492368a9da75b1a78797be9e1381bc4ae7f16bb..5baf02973ac49a4c385c95d7fc1dcf8121febd09 100755 (executable)
@@ -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 (executable)
index fd09e85..0000000
+++ /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);