diff -x CVS -x wntmsci3 -x wntmsci7 -x wntmsci8 -urN ooo_SRC680_m239_src.orig/solenv/bin/build.pl ooo_SRC680_m239_src.buildtool02/solenv/bin/build.pl
--- ooo_SRC680_m239_src.orig/solenv/bin/build.pl	2007-12-07 11:40:31.000000000 +0100
+++ ooo_SRC680_m239_src.buildtool02/solenv/bin/build.pl	2007-12-17 14:48:17.000000000 +0100
@@ -54,9 +54,10 @@
         require CopyPrj; import CopyPrj;
     };
     if (defined $ENV{CWS_WORK_STAMP}) {
-        require Cws; import Cws;
-        require CwsConfig; import CwsConfig;
-        require CvsModule; import CvsModule;
+        eval{   require Cws; import Cws;
+                require CwsConfig; import CwsConfig;
+                require CvsModule; import CvsModule;
+        };
         require GenInfoParser; import GenInfoParser;
         require IO::Handle; import IO::Handle;
     };
@@ -90,9 +91,6 @@
 #                       #
 #########################
 
-    if (defined $ENV{CWS_WORK_STAMP}) {
-        $vcsid = CwsConfig->new()->vcsid();
-    };
     $modules_number++;
     $perl = "";
     $remove_command = "";
@@ -121,9 +119,9 @@
     $show = 0;
     $checkparents = 0;
     $deliver = 0;
-    $pre_custom_job = 0;
-    $custom_job = 0;
-    $post_custom_job = 0;
+    $pre_custom_job = '';
+    $custom_job = '';
+    $post_custom_job = '';
     %LocalDepsHash = ();
     %BuildQueue = ();
     %PathHash = ();
@@ -161,7 +159,7 @@
     @possible_build_lists = ('build.lst', 'build.xlist'); # build lists names
     %build_lists_hash = (); # hash of arrays $build_lists_hash{$module} = \($path, $xml_list_object) 
     $pre_job = 'announce'; # job to add for not-single module build
-    $post_job = 'deliver'; # -"-
+    $post_job = '';        # -"-
     %windows_procs = ();
     @warnings = (); # array of warnings to be shown at the end of the process
     @errors = (); # array of errors to be shown at the end of the process
@@ -264,8 +262,8 @@
     }
     if (scalar keys %broken_build) {
         cancel_build();
-    } elsif (!$custom_job && $post_custom_job) {
-        do_post_custom_job(CorrectPath($StandDir.$CurrentPrj));
+#    } elsif (!$custom_job && $post_custom_job) {
+#        do_post_custom_job(CorrectPath($StandDir.$CurrentPrj));
     };
     if (scalar @warnings) {
         print STDERR $_ foreach (@warnings);
@@ -420,7 +418,6 @@
         };
         while ($Prj = PickPrjToBuild(\%global_deps_hash)) {
             if (!defined $dead_parents{$Prj}) {              
-                print $new_line;
                 if (scalar keys %broken_build) {
                     print $echo . "Skipping project $Prj because of error(s)\n";
                     RemoveFromDependencies($Prj, \%global_deps_hash);
@@ -474,12 +471,13 @@
     $jobs_hash{$BuildDir}->{START_TIME} = time();
     $jobs_hash{$BuildDir}->{STATUS} = 'building';
     if ($BuildDir =~ /(\s)/o) {
-        do_pre_job($`) if ($' eq $pre_job);
-        $error_code = do_post_job($`, $BuildDir) if ($' eq $post_job);
-        RemoveFromDependencies($BuildDir, \%LocalDepsHash);
-        html_store_dmake_dir_info(\%LocalDepsHash, $BuildDir, $error_code);
+        $error_code = do_custom_job($BuildDir, \%LocalDepsHash);
+#        do_pre_job($`, $pre_job) if ($' eq $pre_job);
+#        $error_code = do_post_job($`, $', \%LocalDepsHash) if ($' eq $post_job);
+#        RemoveFromDependencies($BuildDir, \%LocalDepsHash);
+#        html_store_job_info(\%LocalDepsHash, $BuildDir, $error_code);
     } else {
-        html_store_dmake_dir_info(\%LocalDepsHash, $BuildDir);
+        html_store_job_info(\%LocalDepsHash, $BuildDir);
         print_error("$BuildDir not found!!\n") if (!-d $BuildDir);
         if (!-d $BuildDir) {
             $new_BuildDir = $BuildDir;
@@ -502,22 +500,24 @@
         };
         RemoveFromDependencies($BuildDir, \%LocalDepsHash) if (!$child);
         return if ($cmd_file || $show);
-        chdir $BuildDir;
-        getcwd();
-        if ($html) {
-            my $log_file = $jobs_hash{$BuildDir}->{LONG_LOG_PATH};
-            my $log_dir = File::Basename::dirname($log_file);
-            if (!-d $log_dir) {
-                 system("$perl $mkout");
-            };
-            $error_code = system ("$dmake > $log_file 2>&1");
-            if (!$grab_output && -f $log_file) {
-                system("cat $log_file");
-            };
-        } else {
-            $error_code = system ("$dmake");
-        };
-        html_store_dmake_dir_info(\%LocalDepsHash, $BuildDir, $error_code) if (!$child);
+        $error_code = run_job($dmake, $BuildDir);
+#        chdir $BuildDir;
+#        getcwd();
+#        if ($html) {
+#            my $log_file = $jobs_hash{$BuildDir}->{LONG_LOG_PATH};
+#            my $log_dir = File::Basename::dirname($log_file);
+#            if (!-d $log_dir) {
+#                 system("$perl $mkout");
+#            };
+#            $error_code = system ("$dmake > $log_file 2>&1");
+#           if (!$grab_output && -f $log_file) {
+#                system("cat $log_file");
+#            };
+#        } else {
+#            $error_code = system ("$dmake");
+#        };
+        
+        html_store_job_info(\%LocalDepsHash, $BuildDir, $error_code) if (!$child);
     };
     if ($error_code && $ignore) {
         push(@ignored_errors, $BuildDir);
@@ -528,7 +528,11 @@
         $| = 1;
         select $oldfh;
         $| =1;
-        _exit($? >> 8) if ($? && ($? != -1));
+        if ($error_code) {
+            _exit($error_code >> 8);
+        } else {
+            _exit($? >> 8) if ($? && ($? != -1));
+        };
         _exit(0);
     } elsif ($error_code && ($error_code != -1)) {
         print_error("Error $? occurred while making $BuildDir");
@@ -641,13 +645,18 @@
     %DeadDependencies = ();
     $module_to_build = shift;
     my $dependencies_hash = shift;
-    if ($deliver || $custom_job) {
-        add_pre_job($dependencies_hash, $module_to_build);
-        add_post_job($dependencies_hash, $module_to_build) if ($modules_types{$module_to_build} ne 'lnk');
+    if ($custom_job) {
+        if ($modules_types{$module_to_build} ne 'lnk') {
+            add_prerequisite_job($dependencies_hash, $module_to_build, $pre_custom_job);
+            add_prerequisite_job($dependencies_hash, $module_to_build, $pre_job);
+            add_dependent_job($dependencies_hash, $module_to_build, $custom_job);
+            add_dependent_job($dependencies_hash, $module_to_build, $post_job);
+            add_dependent_job($dependencies_hash, $module_to_build, $post_custom_job);
+        };
         return;
     };
     if ( defined $modules_types{$module_to_build} && $modules_types{$module_to_build} ne 'mod') {
-        add_pre_job($dependencies_hash, $module_to_build);
+        add_prerequisite_job($dependencies_hash, $module_to_build, $pre_job);
         return;
     };
 
@@ -722,36 +731,39 @@
 #    check_deps_hash($dependencies_hash);
     resolve_aliases($dependencies_hash, \%PathHash);
     if (!$prepare) {
-        add_pre_job($dependencies_hash, $module_to_build);
-        add_post_job($dependencies_hash, $module_to_build) if ($module_to_build ne $CurrentPrj);
+        add_prerequisite_job($dependencies_hash, $module_to_build, $pre_custom_job);
+        add_prerequisite_job($dependencies_hash, $module_to_build, $pre_job);
+        add_dependent_job($dependencies_hash, $module_to_build, $custom_job);
+        add_dependent_job($dependencies_hash, $module_to_build, $post_job) if ($module_to_build ne $CurrentPrj);
+        add_dependent_job($dependencies_hash, $module_to_build, $post_custom_job);
     };
     store_weights($dependencies_hash);
 };
 
 #
-# procedure adds $pre_job to each module's dependancy hash
+# procedure adds which is independent from anothers, but anothers are dependent from it
 #
-sub add_pre_job {
-    my ($dependencies_hash, $module) = @_;
-    my $job = "$module $pre_job";
-    # $pre_job is independent while all other jobs are dependent from it
+sub add_prerequisite_job {
+    my ($dependencies_hash, $module, $job) = @_;
+    return if (!$job);
+    $job = "$module $job";
     foreach (keys %$dependencies_hash) {
         $deps_hash = $$dependencies_hash{$_};
         $$deps_hash{$job}++;
     };
     $$dependencies_hash{$job} = {};
-    
 };
 
 #
-# procedure adds $post_job to each module's dependancy hash
+# procedure adds a job wich is dependent from all already registered jobs
 #
-sub add_post_job {
+sub add_dependent_job {
     # $post_job is dependent from all jobs
-    my ($dependencies_hash, $module) = @_;
+    my ($dependencies_hash, $module, $job) = @_;
+    return if (!$job);
     my %deps_hash = ();
     $deps_hash{$_}++ foreach (keys %$dependencies_hash);
-    $$dependencies_hash{"$module $post_job"} = \%deps_hash;
+    $$dependencies_hash{"$module $job"} = \%deps_hash;
 };
 
 #
@@ -921,7 +933,7 @@
     return 1 if (($ENV{GUI} eq 'UNX') && ($Platform eq 'u'));
     return 1 if (($ENV{GUI} eq 'OS2') && ($Platform eq 'p'));
     return 1 if (($ENV{GUI} eq 'WNT') &&
-                       (($Platform eq 'w') || ($Platform eq 'n')));
+                 (($Platform eq 'w') || ($Platform eq 'n')));
     return 0;
 };
 
@@ -938,16 +950,6 @@
     foreach $Prj (keys %$Dependencies) {
         my $prj_deps_hash = $$Dependencies{$Prj};
         delete $$prj_deps_hash{$ExclPrj} if (defined $$prj_deps_hash{$ExclPrj});
-#        foreach (keys %$prj_deps_hash) {print ("$_ ")};
-        
-#        foreach $i (0 .. $#{$$Dependencies{$Prj}}) {
-#            if ((${$$Dependencies{$Prj}}[$i] eq $ExclPrj) ||
-#                (${$$Dependencies{$Prj}}[$i] eq $ExclPrj_orig)) {
-#                splice (@{$$Dependencies{$Prj}}, $i, 1);
-#                $i = 0;
-#                last;
-#            };
-#        };
     };
 };
 
@@ -990,7 +992,13 @@
                     };
                     $log_name = $string;
                     if ($log_name eq "$module $custom_job") {
-                        $log_name = "$module custom_job";
+                        $log_name = "custom_job";
+                    };
+                    if ($log_name eq "$module $pre_custom_job") {
+                        $log_name = "pre_custom_job";
+                    };
+                    if ($log_name eq "$module $post_custom_job") {
+                        $log_name = "post_custom_job";
                     };
                     $log_name =~ s/\\|\//\./g;
                     $log_name =~ s/\s/_/g;
@@ -1275,7 +1283,8 @@
         $cmd_file = '';
     };
     print_error('Switches --job and --deliver collision') if ($custom_job && $deliver);
-    $post_job = $custom_job if ($custom_job);
+    $custom_job = 'deliver' if $deliver; 
+    $post_job = 'deliver' if (!$custom_job);
     $incompatible = scalar keys %incompatibles;
     if ($prepare && !$incompatible) {
         print_error("--prepare is for use with --from switch only!\n");
@@ -1449,7 +1458,7 @@
                             $folders_hashes{$child_nick});
     };
     my $module = $module_by_hash{$folders_hashes{$child_nick}};
-    html_store_dmake_dir_info($folders_hashes{$child_nick}, $child_nick, $error_code);
+    html_store_job_info($folders_hashes{$child_nick}, $child_nick, $error_code);
     $running_children{$folders_hashes{$child_nick}}--;
     delete $processes_hash{$pid};
     $only_dependent = 0;
@@ -1510,24 +1519,25 @@
     $jobs_hash{$job_dir}->{STATUS} = 'building';
     if ($job_dir =~ /(\s)/o) {
         my $error_code = undef;
-        do_pre_job($`) if ($' eq $pre_job);
-        $error_code = do_post_job($`, $job_dir) if ($' eq $post_job);
-        html_store_dmake_dir_info($dependencies_hash, $job_dir, $error_code);
-        if ($error_code) {
-            # give windows (4nt) one more chance 
-            if ($ENV{GUI} eq 'WNT' && !$cygwin) {
-                $error_code = do_post_job($`, $job_dir);
-            };
-            if ($error_code) {
-                $broken_modules_hashes{$dependencies_hash}++;
-                $broken_build{$job_dir} = $error_code;
-            }
-        } else {
-            RemoveFromDependencies($job_dir, $dependencies_hash);
-        };
+#        do_pre_job($`, $pre_job) if ($' eq $pre_job);
+        $error_code = do_custom_job($job_dir, $dependencies_hash);
+#        $error_code = do_post_job($`, $', $dependencies_hash) if ($' eq $post_job);
+#        html_store_job_info($dependencies_hash, $job_dir, $error_code);
+#        if ($error_code) {
+#            # give windows (4nt) one more chance 
+#            if ($ENV{GUI} eq 'WNT' && !$cygwin) {
+#                $error_code = do_post_job($`, $post_job, $dependencies_hash);
+#            };
+#            if ($error_code) {
+#                $broken_modules_hashes{$dependencies_hash}++;
+#                $broken_build{$job_dir} = $error_code;
+#            }
+#        } else {
+#            RemoveFromDependencies($job_dir, $dependencies_hash);
+#        };
         return;
     };
-    html_store_dmake_dir_info($dependencies_hash, $job_dir);
+    html_store_job_info($dependencies_hash, $job_dir);
     my $pid = undef;
     my $children_running;
     my $oldfh = select STDOUT;
@@ -1602,9 +1612,9 @@
 
 sub mp_success_exit {
 #    close_server_socket();
-    if (!$custom_job && $post_custom_job) {
-        do_post_custom_job(CorrectPath($StandDir.$CurrentPrj));
-    };
+#    if (!$custom_job && $post_custom_job) {
+#        do_post_custom_job(CorrectPath($StandDir.$CurrentPrj));
+#    };
     print "\nMultiprocessing build is finished\n";
     print "Maximal number of processes run: $maximal_processes\n";
     do_exit(0);
@@ -1645,27 +1655,80 @@
     } while (!are_all_dependent($build_queue));
 };
 
+sub run_job {
+    my ($job, $path, $registered_name) = @_;
+    my $job_to_do = $job;
+    $job_to_do = $deliver_command if ($job eq $post_job);
+    $registered_name = $path if (!defined $registered_name);
+    chdir $path;
+    getcwd();
+    
+    if ($html) {
+        my $log_file = $jobs_hash{$registered_name}->{LONG_LOG_PATH};
+        my $log_dir = File::Basename::dirname($log_file);
+        if (!-d $log_dir) {
+             system("$perl $mkout");
+        };
+        $error_code = system ("$job_to_do > $log_file 2>&1");
+        if (!$grab_output && -f $log_file) {
+            system("cat $log_file");
+        };
+    } else {
+        $error_code = system ("$job_to_do");
+    };
+    return $error_code;
+};
 
-sub do_pre_job {
-    my $module = shift;
-    announce_module($module);
-    if ($pre_custom_job && defined $modules_types{$module} && ($modules_types{$module} eq 'mod')) {
-        my $module_path = CorrectPath($StandDir.$module);
-        chdir $module_path;
-        getcwd();
-        my $cj_error_code = system ("$pre_custom_job");
-        print_error("Cannot run pre job \"$pre_custom_job\"") if ($cj_error_code);
+sub do_custom_job {
+    my ($module_job, $dependencies_hash) = @_;
+    $module_job =~ /(\s)/o;
+    my $module = $`;
+    my $job = $';
+    html_store_job_info($dependencies_hash, $module_job);
+    my $error_code = 0;
+    if ($job eq $pre_job) {
+        announce_module($module);
+#        html_store_job_info($dependencies_hash, $job_dir);
+        RemoveFromDependencies($module_job, $dependencies_hash);
+    } else {
+        $error_code = run_job($job, CorrectPath($StandDir.$module), $module_job);
+        if ($error_code) {
+            # give windows (4nt) one more chance 
+            if ($ENV{GUI} eq 'WNT' && !$cygwin) {
+                $error_code = run_job($job, CorrectPath($StandDir.$module), $module_job);
+            };
+        };
+        if ($error_code) {
+            $broken_modules_hashes{$dependencies_hash}++;
+            $broken_build{$module} = $error_code;
+        } else {
+            RemoveFromDependencies($module_job, $dependencies_hash);
+        };
     };
+    html_store_job_info($dependencies_hash, $module_job, $error_code);
+    return $error_code;
 };
 
+#sub do_pre_job {
+#    my $module = shift;
+#    announce_module($module);
+#    if ($pre_custom_job && defined $modules_types{$module} && ($modules_types{$module} eq 'mod')) {
+#        my $module_path = CorrectPath($StandDir.$module);
+#        chdir $module_path;
+#        getcwd();
+#        my $cj_error_code = system ("$pre_custom_job");
+#        print_error("Cannot run pre job \"$pre_custom_job\"") if ($cj_error_code);
+#    };
+#};
 
-sub do_post_custom_job {
-    my $module_path = shift;
-    chdir $module_path;
-    getcwd();
-    my $cj_error_code = system ("$post_custom_job");
-    print_error("Cannot run post job \"$post_custom_job\"") if ($cj_error_code);
-};
+
+#sub do_post_custom_job {
+#    my $module_path = shift;
+#    chdir $module_path;
+#    getcwd();
+#    my $cj_error_code = system ("$post_custom_job");
+#    print_error("Cannot run post job \"$post_custom_job\"") if ($cj_error_code);
+#};
 
 #
 # Print announcement for module just started
@@ -1693,6 +1756,7 @@
     } else {
         $text = "Building module $Prj\n";
     };
+    print $new_line;
     print $echo . "=============\n";
     print $echo . $text;
     print $echo . "=============\n";
@@ -1871,6 +1935,9 @@
     my $cws    = shift;
     my $module = shift;
     my $cvsroot = get_link_cvs_root($module);
+    if (defined $ENV{CWS_WORK_STAMP}) {
+        $vcsid = CwsConfig->new()->vcsid();
+    };
     if (!$cvsroot) {
         my $master = $cws->master();
 
@@ -2485,51 +2552,51 @@
     exit($exit_code);
 };
 
-sub get_post_job {
-    my $job = $deliver_command;
-    $job = $custom_job if ($custom_job);
-    return $job;
-};
+#sub get_post_job {
+#    my $job = $deliver_command;
+#    $job = $custom_job if ($custom_job);
+#    return $job;
+#};
 
-sub do_post_job {
-    my $job = get_post_job();
-    if ($show) {
-        print $job . "\n";
-        return;
-    }
-    my $module = shift;
-    my $post_job_name = shift;
-    delete $build_in_progress{$module};
-    $module_path = CorrectPath($StandDir.$module);
-    my $error_code = undef;
-    if ($cmd_file) {
-        print "cd $module_path\n";
-        print "$job\n";
-    } else {
-        chdir $module_path;
-        getcwd();
-        if ($html) {
-            # tested on Linux only!!
-            my $log_file = $jobs_hash{$post_job_name}->{LONG_LOG_PATH};
-            my $log_dir = File::Basename::dirname($log_file);
-            if (!-d $log_dir) {
-                eval {mkpath($log_dir)};
-                print_error("Cannot create log directory $log_dir") if ($@);
-            };
-            $error_code = system ("$job > $log_file 2>&1");
-            if (!$grab_output && -f $log_file) {
-                system("cat $log_file");
-            };
-        } else {
-            $error_code = system ("$job");
-        }
-    };
-    $build_is_finished{$module}++ if (!defined $modules_with_errors{$module});
-    if (!$error_code && $post_custom_job) {
-        do_post_custom_job(CorrectPath($StandDir.$module));
-    };
-    return $error_code;
-};
+#sub do_post_job {
+#    my $job = get_post_job();
+#    if ($show) {
+#        print $job . "\n";
+#        return;
+#    }
+#    my $module = shift;
+#    my $post_job_name = shift;
+#    delete $build_in_progress{$module};
+#    $module_path = CorrectPath($StandDir.$module);
+#    my $error_code = undef;
+#    if ($cmd_file) {
+#        print "cd $module_path\n";
+#        print "$job\n";
+#    } else {
+#        chdir $module_path;
+#        getcwd();
+#        if ($html) {
+#            # tested on Linux only!!
+#            my $log_file = $jobs_hash{$post_job_name}->{LONG_LOG_PATH};
+#            my $log_dir = File::Basename::dirname($log_file);
+#            if (!-d $log_dir) {
+#                eval {mkpath($log_dir)};
+#                print_error("Cannot create log directory $log_dir") if ($@);
+#            };
+#            $error_code = system ("$job > $log_file 2>&1");
+#            if (!$grab_output && -f $log_file) {
+#                system("cat $log_file");
+#            };
+#        } else {
+#            $error_code = system ("$job");
+#        }
+#    };
+#    $build_is_finished{$module}++ if (!defined $modules_with_errors{$module});
+#    if (!$error_code && $post_custom_job) {
+#        do_post_custom_job(CorrectPath($StandDir.$module));
+#    };
+#    return $error_code;
+#};
 
 #
 # Procedure sorts module in user-frendly order
@@ -2857,6 +2924,7 @@
     print HTML '        document.write("</div>");' . "\n";
     print HTML '        document.write("    </frameset>");' . "\n";
     print HTML '        document.write("</body></html>");' . "\n";
+    print HTML '        top.frames[0].clearInterval(IntervalID);' . "\n";
     print HTML '        IntervalID = top.frames[0].setInterval("updateInnerFrame()", UpdateRate * 1000);' . "\n";
     print HTML '    } else if (urlquery[1] == "initInnerPage") {' . "\n";
     print HTML '        document.write("<html><head>");' . "\n";
@@ -2999,7 +3067,7 @@
 #
 # This procedure stores the dmake result in %html_info
 #
-sub html_store_dmake_dir_info {
+sub html_store_job_info {
     return if (!$html);
     my ($deps_hash, $build_dir, $error_code) = @_;
     my $force_update = 0;
@@ -3011,12 +3079,10 @@
     my $module = $module_by_hash{$deps_hash};
     my $module_info_hash = $html_info{$module};
 #    $$module_info_hash{BUILD_TIME} += $jobs_hash{$build_dir}->{FINISH_TIME} - $jobs_hash{$build_dir}->{START_TIME};
+    my $dmake_array;
     if (defined $error_code) {
         $jobs_hash{$build_dir}->{FINISH_TIME} = time();
         $$module_info_hash{BUILD_TIME} += $jobs_hash{$build_dir}->{FINISH_TIME} - $jobs_hash{$build_dir}->{START_TIME};
-    }
-    my $dmake_array;
-    if (defined $error_code) {
         if ($error_code) {
             $jobs_hash{$build_dir}->{STATUS} = 'error';
             $dmake_array = $$module_info_hash{ERRORFUL};
@@ -3228,13 +3294,15 @@
             return '' if (!$job_dir);
             $jobs_hash{$job_dir}->{START_TIME} = time();
             $jobs_hash{$job_dir}->{STATUS} = 'building';
-            if ($job_dir =~ /(\s)/o) {
-                if ($' eq $pre_job) {
-                    do_pre_job($`);
-                    html_store_dmake_dir_info($dependencies_hash, $job_dir, undef);
-                    RemoveFromDependencies($job_dir, $dependencies_hash);
-                    $job_dir = '';
-                };
+            if ($job_dir =~ /(\s)$pre_job/o) {
+                do_custom_job($job_dir, $dependencies_hash);
+                $job_dir = '';
+#                if ($' eq $pre_job) {
+#                    do_pre_job($`, $pre_job);
+#                    html_store_job_info($dependencies_hash, $job_dir, undef);
+#                    RemoveFromDependencies($job_dir, $dependencies_hash);
+#                    $job_dir = '';
+#                };
             };
         } while (!$job_dir);
     } else {
@@ -3248,13 +3316,14 @@
             return '' if (!$job_dir);
             $jobs_hash{$job_dir}->{START_TIME} = time();
             $jobs_hash{$job_dir}->{STATUS} = 'building';
-            if ($job_dir =~ /(\s)/o) {
-                if ($' eq $pre_job) {
-                    do_pre_job($`);
-                    html_store_dmake_dir_info($dependencies_hash, $job_dir, undef);
-                    RemoveFromDependencies($job_dir, $dependencies_hash);
+            if ($job_dir =~ /(\s)$pre_job/o) {
+#                if ($' eq $pre_job) {
+                    do_custom_job($job_dir, $dependencies_hash);
+#                    do_pre_job($`, $pre_job);
+#                    html_store_job_info($dependencies_hash, $job_dir, undef);
+#                    RemoveFromDependencies($job_dir, $dependencies_hash);
                     $job_dir = '';
-                }
+#                }
             };
         } while (!$job_dir);
     };
@@ -3264,8 +3333,9 @@
     my $log_file = $jobs_hash{$job_dir}->{LONG_LOG_PATH};
 #    $jobs_hash{$job_dir}->{CLIENT} = $pid;
     my $full_job_dir = $job_dir;
-    if (($job_dir =~ /(\s)/o) && ($' eq $post_job)) {
-        $job = get_post_job();
+    if ($job_dir =~ /(\s)/o) {
+        $job = $';
+        $job = $deliver_command if ($job eq $post_job);
         $full_job_dir = CorrectPath($StandDir.$`);
     }
     my $log_dir = File::Basename::dirname($log_file);
