Merge branch 'mojo' of ssh://server/scm/spider into mojo
authorDirk Koopman <djk@tobit.co.uk>
Wed, 15 Feb 2017 22:50:34 +0000 (22:50 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Wed, 15 Feb 2017 22:50:34 +0000 (22:50 +0000)
Conflicts:
Changes
perl/cluster.pl

1  2 
Changes
perl/cluster.pl

diff --combined Changes
index 60e1d87cf7f53a20d5f9fe10e997110dc77ab6da,13fa2e16b734fefd460299963369ab26175db6be..ac17a93fc41780132741c246af680446dbabd276
+++ b/Changes
@@@ -1,6 -1,5 +1,8 @@@
- 2. Fix(?) problems picking up SysVar.pm variables.  
 +15Feb17=======================================================================
 +1. Update UPGRADE.mojo a bit
++2. Add local::lib so that it can be used for non-root installations.
+ 09Jan17=======================================================================
+ 1. Fix mojo branch clean install issues (failing to find $main::data et al)
  02Jan17=======================================================================
  1. Add CTY-2615 prefixes
  2. Add rbn.pl - an experimental rbn deduplicating spot filter. 
diff --combined perl/cluster.pl
index ca73a8249e81017c3705c34689f156294d7afff8,4aa81c62e939b52467dbbe1a4bb24de4b5a69c02..054a22ca718dbde98003e13f4824ff76b738ceca
@@@ -15,16 -15,12 +15,18 @@@ package main
  require 5.10.1;
  use warnings;
  
+ use vars qw($root $is_win $systime);
  # make sure that modules are searched in the order local then perl
  BEGIN {
        umask 002;
  
 +      # take into account any local::lib that might be present
 +      eval {
 +              require local::lib;
 +      };
 +      import local::lib unless ($@);
 +
        # root of directory tree for this system
        $root = "/spider";
        $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
        die "$root/local/DXVars.pm doesn't exist, please RTFM" unless -e "$root/local/DXVars.pm";
  
        # create some directories
-       mkdir "$root/local_cmd", 02777 unless -d "$root/local_cmd";
-       mkdir "$root/local_data", 02777 unless -d "$root/local_data";
+       mkdir "$root/local_cmd", 02774 unless -d "$root/local_cmd";
+       # locally stored data lives here
+       my $local_data = "$root/local_data";
+       mkdir $local_data, 02774 unless -d $local_data;
  
        # try to create and lock a lockfile (this isn't atomic but
        # should do for now
-       $lockfn = "$root/local_data/cluster.lck";       # lock file name
+       my $lockfn = "$root/local_data/cluster.lck";       # lock file name
        if (-w $lockfn) {
                open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
                my $pid = <CLLOCK>;
  
        $is_win = ($^O =~ /^MS/ || $^O =~ /^OS-2/) ? 1 : 0; # is it Windows?
        $systime = time;
+       
  }
  
  use DXVars;
  use SysVar;
  
 -                      
+ use strict;
++
  use Mojo::IOLoop;
  
  use Msg;
@@@ -132,12 -134,9 +140,9 @@@ use Web
  
  use Local;
  
- package main;
- use strict;
- use vars qw(@inqueue $systime $starttime $lockfn @outstanding_connects
-                       $zombies $root @listeners $lang $myalias @debug $userfn $clusteraddr
-                       $clusterport $mycall $decease $is_win $routeroot $me $reqreg $bumpexisting
+ use vars qw(@inqueue $starttime $lockfn @outstanding_connects
+                       $zombies @listeners $lang $myalias @debug $userfn $clusteraddr
+                       $clusterport $mycall $decease $routeroot $me $reqreg $bumpexisting
                        $allowdxby $dbh $dsn $dbuser $dbpass $do_xml $systime_days $systime_daystart
                        $can_encode $maxconnect_user $maxconnect_node $idle_interval $log_flush_interval
                        $broadcast_debug