Supply a 'modern' run_cron (written in perl)
[buildfarm-client.git] / run_build.pl
index d95f64527163ce637cbcd30393c9135c8fe96e09..50ae2d699ece264138abd64f684950c32e9a9b2e 100755 (executable)
@@ -313,7 +313,8 @@ foreach my $oldfile (glob("last*"))
 
 my $branch_root = getcwd();
 
-# make sure we are using GNU make
+# Normally we would require GNU Make, but allow farm
+# configuration to override this
 die "$make is not GNU Make - please fix config file"
   unless check_make();
 
@@ -505,9 +506,11 @@ $steps_completed = "";
 
 my @changed_files;
 my @changed_since_success;
+my $last_config;
 my $last_status;
 my $last_run_snap;
 my $last_success_snap;
+my $current_config;
 my $current_snap;
 my @filtered_files;
 my $savescmlog = "";
@@ -553,11 +556,20 @@ elsif (!$from_source)
     unlink "last.success";
 
     # get the timestamp data
+    $last_config = find_last('config') || 0;
     $last_status = find_last('status') || 0;
     $last_run_snap = find_last('run.snap');
     $last_success_snap = find_last('success.snap');
     $forcerun = 1 unless (defined($last_run_snap));
 
+    # If config file changed, force a rebuild
+    ($current_config) = (stat $orig_dir.'/'.$buildconf)[9];
+    if (defined $current_config && $current_config > $last_config)
+    {
+      $last_status = 0;
+      set_last('config',$current_config) unless $nostatus;
+    }
+
     # updated by find_changed to last mtime of any file in the repo
     $current_snap=0;
 
@@ -650,9 +662,9 @@ make();
 
 display_features();
 
-make_test() if (check_optional_step('make_test'));
+make_test() if (check_optional_step('test'));
 
-make_doc() if (check_optional_step('build_docs'));
+make_doc() if (check_optional_step('make-doc'));
 
 ##check_port_is_ok($buildport,'Post');
 
@@ -755,9 +767,9 @@ sub check_optional_step
         &&grep {$_ eq $wday} @{$oconf->{dow}});
 
     my $last_step = $last_status = find_last("$step") || 0;
-
-    return undef unless ($forcerun ||
-                         time >$last_step + (3600 * $oconf->{min_hours_since}));
+    ## If made it *to* these optional steps, we just run them and reset last time
+    #return undef unless ($forcerun ||
+    #                     time >$last_step + (3600 * $oconf->{min_hours_since}));
     set_last("$step") unless $nostatus;
 
     return 1;
@@ -816,6 +828,12 @@ sub display_features
     
 sub check_make
 {
+    # Allow farm member to configure non-GNU make
+    my $non_gnu_make = $EximBuild::conf{non_gnu_make};
+    if (!defined $non_gnu_make ||
+        (defined $non_gnu_make && $non_gnu_make == 1)) {
+      return 'OK';
+    }
     my @out = `$make -v 2>&1`;
     return undef unless ($? == 0 && grep {/GNU Make/} @out);
     return 'OK';
@@ -1122,7 +1140,10 @@ sub configure
         @tmp = `echo "Build Farm user info:"; id $me
           cd $exim && perl -pi -e 's/^# CONFIGURE_OWNER=\$/CONFIGURE_OWNER=$me/' $local_conf`;
         push @confout, @tmp;
-        @tmp = `cd $exim && perl -pi -e 's/^# TRUSTED_CONFIG_LIST=/TRUSTED_CONFIG_LIST=/' $local_conf`;
+        my $testdir = `cd $exim && /bin/pwd`; chomp $testdir; $testdir .= "/test";
+        my $trcf = "$testdir/trusted-configs";
+        my $tecf = "$testdir/test-config";
+        @tmp = `cd $exim && perl -pi -e "s%^# TRUSTED_CONFIG_LIST=.*%TRUSTED_CONFIG_LIST=$trcf%" $local_conf`;
         push @confout, @tmp;
         @tmp = `cd $exim && perl -pi -e 's/^# WHITELIST_D_MACROS=.*/WHITELIST_D_MACROS=DIR:EXIM_PATH:AA:ACL:ACLRCPT:ACL_MAIL:ACL_PREDATA:ACL_RCPT:AFFIX:ALLOW:ARG1:ARG2:AUTHF:AUTHS:AUTH_ID_DOMAIN:BAD:BANNER:BB:BR:BRB:CERT:COM:COMMAND_USER:CONNECTCOND:CONTROL:CREQCIP:CREQMAC:CRL:CSS:D6:DATA:DCF:DDF:DEFAULTDWC:DELAY:DETAILS:DRATELIMIT:DYNAMIC_OPTION:ELI:ERROR_DETAILS:ERT:FAKE:FALLBACK:FILTER:FILTER_PREPEND_HOME:FORBID:FORBID_SMTP_CODE:FUSER:HAI:HAP:HARDLIMIT:HEADER_LINE_MAXSIZE:HEADER_MAXSIZE:HELO_MSG:HL:HOSTS:HOSTS_AVOID_TLS:HOSTS_MAX_TRY:HVH:IFACE:IGNORE_QUOTA:INC:INSERT:IP1:IP2:LAST:LDAPSERVERS:LENCHECK:LIMIT:LIST:LOG_SELECTOR:LS:MAXNM:MESSAGE_LOGS:MSIZE:NOTDAEMON:ONCE:ONLY:OPT:OPTION:ORDER:PAH:PEX:PORT:PTBC:QDG:QOLL:QUOTA:QUOTA_FILECOUNT:QWM:RCPT_MSG:REMEMBER:REQUIRE:RETRY:RETRY1:RETRY2:RETURN:RETURN_ERROR_DETAILS:REWRITE:ROUTE_DATA:RRATELIMIT:RT:S:SELECTOR:SELF:SERVER:SERVERS:SREQCIP:SREQMAC:SRV:STD:STRICT:SUB:SUBMISSION_OPTIONS:TIMEOUTDEFER:TIMES:TRUSTED:TRYCLEAR:UL:USE_SENDER:UTF8:VALUE:WMF:X:Y/' $local_conf`;
         push @confout, @tmp;
@@ -1158,6 +1179,10 @@ sub configure
          echo 'EXIM_RELEASE_VERSION="$exim_ver"' > src/src/version.sh
          echo 'EXIM_VARIANT_VERSION=""' >> src/src/version.sh
          echo 'EXIM_COMPILE_NUMBER="0"' >> src/src/version.sh`;
+
+        # Create a trusted-configs list file
+        @tmp = `cd $exim && echo "$tecf" > "$trcf"`;
+        push @confout, @tmp;
     }
    
     print "======== configure output ===========\n",@confout