X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2Fcluster.pl;h=f1eade415bc263ae5778b03dec2fcf2e8c9ad4f8;hb=4b207544da78b182bd12e94eab01451694749012;hp=b9031719718fc291e1ef18343a65b4639af872a8;hpb=2f9d089ec33dd606824c11a508dbc06a0cf8dfaa;p=spider.git diff --git a/perl/cluster.pl b/perl/cluster.pl index b9031719..f1eade41 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -18,8 +18,6 @@ package main; use vars qw($data $system $cmd $localcmd $userfn $clusteraddr $clusterport $yes $no $user_interval $lang); $lang = 'en'; # default language -$clusteraddr = '127.0.0.1'; # cluster tcp host address - used for things like console.pl -$clusterport = 27754; # cluster tcp port $yes = 'Yes'; # visual representation of yes $no = 'No'; # ditto for no $user_interval = 11*60; # the interval between unsolicited prompts if no traffic @@ -128,7 +126,6 @@ use Data::Dumper; use IO::File; use Fcntl ':flock'; use POSIX ":sys_wait_h"; -use Version; use Local; @@ -142,6 +139,9 @@ use vars qw(@inqueue $systime $starttime $lockfn @outstanding_connects $can_encode $maxconnect_user $maxconnect_node ); + +$clusteraddr //= '127.0.0.1'; # cluster tcp host address - used for things like console.pl +$clusterport //= 27754; # cluster tcp port @inqueue = (); # the main input queue, an array of hashes $systime = 0; # the time now (in seconds) $starttime = 0; # the starting time of the cluster @@ -155,6 +155,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 +320,7 @@ sub cease $l->close_server; } - LogDbg('cluster', "DXSpider V$version, build $subversion.$build (git: $gitversion) ended"); + LogDbg('cluster', "DXSpider v$version build $build (git: $gitbranch/$gitversion) using perl $^V on $^O ended"); dbgclose(); Logclose(); @@ -366,6 +368,8 @@ sub AGWrestart # ############################################################# +chdir $root; + $starttime = $systime = time; $systime_days = int ($systime / 86400); $systime_daystart = $systime_days * 86400; @@ -398,23 +402,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 --git-dir=$root/.git describe --long`}; + 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]"; + } + if (!$@) { + my @branch; - # determine the real version number - 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]"; + eval {@branch = `git --git-dir=$root/.git branch`}; + unless ($@) { + for (@branch) { + my ($star, $b) = split /\s+/; + if ($star eq '*') { + $gitbranch = $b; + last; + } } } } + $SIG{__DIE__} = $w; } @@ -424,7 +440,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 $build (git: $gitbranch/$gitversion) using perl $^V on $^O started"); dbg("Copyright (c) 1998-$year Dirk Koopman G1TLH"); # load Prefixes