]> dxcluster.org Git - spider.git/commitdiff
Removed perl Git package dependency
authorDirk Koopman <djk@tobit.co.uk>
Sat, 11 Dec 2021 12:51:37 +0000 (12:51 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Sat, 11 Dec 2021 12:51:37 +0000 (12:51 +0000)
Changes
perl/cluster.pl

diff --git a/Changes b/Changes
index 1c67d0afc3fe0938a205b08772620dc34427a38e..53295332b93e44cde0ef23780c4cc3e0c15bc95d 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+11Dec21=======================================================================
+1. Removed dependency on perl Git package.
 10Dec21=======================================================================
 1. Fix the output of set/dxgrid, set/usstate and set/dxcq or set/dxitu to how
    it was always supposed to be since 2003.
index 9c47042b396ac0e13d12a6f3d02b82a7e093bd18..3c02e0386a0ab4a6f958dbe04b0f72bc0de127d2 100755 (executable)
@@ -319,7 +319,7 @@ sub cease
                $l->close_server;
        }
 
-       LogDbg('cluster', "DXSpider V$version, build $subversion.$build (git: $gitbranch/$gitversion) ended");
+       LogDbg('cluster', "DXSpider V$version, build $subversion.$build (git: $gitbranch/$gitversion) on $^O ended");
        dbgclose();
        Logclose();
 
@@ -399,34 +399,35 @@ if (DXSql::init($dsn)) {
                import Encode;
                $can_encode = 1;
        }
-       eval { require Git; };
-       unless ($@) {
-               import Git;
+       
+       $gitbranch = 'none';
+       $gitversion = 'none';
+
+       # determine the real Git build number and branch
+       my $desc;
+       eval {$desc = `git describe --long`};
+       if (!$@ && $desc) {
+               my ($v, $s, $b, $g) = $desc =~ /^([\d.]+)(?:\.(\d+))?-(\d+)-g([0-9a-f]+)/;
+               $version = $v;
+               my $subversion = $s || 0;
+               $build = $b || 0;
+               $gitversion = "$g\[r]";
+       }
+    if (!$@) {
+               my @branch;
                
-               # 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);
-                       if ($desc) {
-                               my ($v, $s, $b, $g) = $desc =~ /^([\d.]+)(?:\.(\d+))?-(\d+)-g([0-9a-f]+)/;
-                               $version = $v;
-                               $subversion = $s || 0;
-                               $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;
+               eval {@branch = `git branch`};
+               unless ($@) {
+                       for (@branch) {
+                               my ($star, $b) = split /\s+/;
+                               if ($star eq '*') {
+                                       $gitbranch = $b;
+                                       last;
+                               }
                        }
                }
-
        }
+
        $SIG{__DIE__} = $w;
 }
 
@@ -436,7 +437,7 @@ DXXml::init();
 # banner
 my ($year) = (gmtime)[5];
 $year += 1900;
-LogDbg('cluster', "DXSpider V$version, build $subversion.$build (git: $gitbranch/$gitversion) started");
+LogDbg('cluster', "DXSpider V$version, build $subversion.$build (git: $gitbranch/$gitversion) on $^O started");
 dbg("Copyright (c) 1998-$year Dirk Koopman G1TLH");
 
 # load Prefixes