diff options
author | Martin Schlemmer <azarah@gentoo.org> | 2002-09-16 22:23:12 +0000 |
---|---|---|
committer | Martin Schlemmer <azarah@gentoo.org> | 2002-09-16 22:23:12 +0000 |
commit | 3a1f7973f97b1065885ec02362f5a6aa25c948ed (patch) | |
tree | 5873ea50c85dcf74aed650f3de6b0cf0458a6d3c /app-office | |
parent | fixor (diff) | |
download | gentoo-2-3a1f7973f97b1065885ec02362f5a6aa25c948ed.tar.gz gentoo-2-3a1f7973f97b1065885ec02362f5a6aa25c948ed.tar.bz2 gentoo-2-3a1f7973f97b1065885ec02362f5a6aa25c948ed.zip |
fixor
Diffstat (limited to 'app-office')
-rw-r--r-- | app-office/openoffice/files/1.0.1/openoffice-1.0.1-parallel-build.patch | 908 |
1 files changed, 0 insertions, 908 deletions
diff --git a/app-office/openoffice/files/1.0.1/openoffice-1.0.1-parallel-build.patch b/app-office/openoffice/files/1.0.1/openoffice-1.0.1-parallel-build.patch deleted file mode 100644 index febeb479afc0..000000000000 --- a/app-office/openoffice/files/1.0.1/openoffice-1.0.1-parallel-build.patch +++ /dev/null @@ -1,908 +0,0 @@ -Index: oo_cvs/solenv/bin/build.pl -=================================================================== -RCS file: /cvs/oo/tools/solenv/bin/build.pl,v -retrieving revision 1.41 -retrieving revision 1.61 -diff -u -3 -p -u -r1.41 -r1.61 ---- oo_cvs/solenv/bin/build.pl 2002/01/10 17:18:59 1.41 -+++ oo_cvs/solenv/bin/build.pl 2002/07/05 12:54:19 1.61 -@@ -1,13 +1,13 @@ - : --eval 'exec perl -wS $0 ${1+"$@"}' -+eval 'exec perl -S $0 ${1+"$@"}' - if 0; - #************************************************************************* - # - # $RCSfile: build.pl,v $ - # --# $Revision: 1.41 $ -+# $Revision: 1.61 $ - # --# last change: $Author: vg $ $Date: 2002/01/10 17:18:59 $ -+# last change: $Author: vg $ $Date: 2002/07/05 12:54:19 $ - # - # The Contents of this file are made available subject to the terms of - # either of the following licenses -@@ -67,61 +67,115 @@ eval 'exec perl -wS $0 ${1+"$@"}' - # build - build entire project - # - -+use Config; -+use POSIX; - use Cwd; - - #### script id ##### - - ( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/; - --$id_str = ' $Revision: 1.41 $ '; -+$id_str = ' $Revision: 1.61 $ '; - $id_str =~ /Revision:\s+(\S+)\s+\$/ - ? ($script_rev = $1) : ($script_rev = "-"); - - print "$script_name -- version: $script_rev\n"; - -+if ($ENV{GUI} eq 'UNX') { -+ use Cwd 'chdir'; -+}; -+ - ######################### - # # - # Globale Variablen # - # # - ######################### - $QuantityToBuild = 0; -+# delete $pid when not needed -+%projects_deps_hash = (); # hash of undependent projects, -+ # that could be built now -+%broken_build = (); # hash of hashes of the modules, -+ # where build was broken (error occurred) -+%folders_hashes = (); -+%running_children = (); -+$dependencies_hash = 0; -+$handler_set = 0; -+$cmd_file = ''; - $BuildAllParents = 0; - $show = 0; - $deliver = 0; - %LocalDepsHash = (); --%DepsArchive = (); - %BuildQueue = (); - %PathHash = (); - %PlatformHash = (); --%DeadDependencies = (); - %AliveDependencies = (); - %ParentDepsHash = (); # hash of dependencies of the current project - @UnresolvedParents = (); - @dmake_args = (); - %DeadParents = (); - $CurrentPrj = ''; -+$no_projects = 0; -+$only_dependent = 0; - $StandDir = &get_stand_dir(); - $build_from = ''; - $build_from_opt = ''; - $build_since = ''; -+$dlv_switch = ''; -+$child = 0; -+%processes_hash = (); -+%module_annonced = (); -+ - &get_options; -+ -+$deliver_commando = $ENV{DELIVER}; -+$deliver_commando .= ' '. $dlv_switch if ($dlv_switch); - $ENV{mk_tmp}++; - %prj_platform = (); -- -+$check_error_string = ''; -+$dmake = ''; -+$echo = ''; -+$new_line = "\n"; - #### main #### - --$dmake = &GetDmakeCommando(); -+&get_commands(); -+unlink ($cmd_file); -+if ($cmd_file) { -+ if (open (CMD_FILE, ">>$cmd_file")) { -+ select CMD_FILE; -+ $echo = 'echo '; -+ $new_line = $echo."\"\"\n"; -+ print "\@$echo off\npushd\n" if ($ENV{GUI} ne 'UNX'); -+ } else { -+ &print_error ("Cannot open file $cmd_file"); -+ }; -+} elsif ($show) { -+ select STDERR; -+}; -+ -+print $new_line; -+ - &BuildAll(); - @TotenEltern = keys %DeadParents; - if ($#TotenEltern != -1) { - my ($DeadPrj); -- print "\nWARNING! Project(s):\n\n"; -+ print $new_line.$new_line; -+ print $echo."WARNING! Project(s):\n"; - foreach $DeadPrj (@TotenEltern) { -- print "$DeadPrj\n"; -+ print $echo."$DeadPrj\n"; - }; -- print "\nnot found and couldn't be built. Correct build.lsts.\n"; -+ print $new_line; -+ print $echo."not found and couldn't be built. Correct build.lsts.\n"; -+ print $new_line; -+}; -+if (($ENV{GUI} ne 'UNX') && $cmd_file) { -+ print "popd\n"; - }; - $ENV{mk_tmp} = ''; -+if ($cmd_file) { -+ close CMD_FILE; -+ print STDOUT "Script $cmd_file generated\n"; -+}; -+exit(0); - - ######################### - # # -@@ -171,6 +225,10 @@ sub BuildAll { - if ($build_from) { - &remove_extra_prjs(\%ParentDepsHash); - }; -+ if ($QuantityToBuild) { -+ &build_multiprocessing; -+ return; -+ }; - while ($Prj = &PickPrjToBuild(\%ParentDepsHash)) { - if ($build_from_opt) { - if ($build_from_opt ne $Prj) { -@@ -189,56 +247,62 @@ sub BuildAll { - }; - next; - }; -- print "\n=============\n"; -- print "Building project $Prj\n"; -- print "=============\n"; -+ print $new_line; -+ print $echo. "=============\n"; -+ print $echo. "Building project $Prj\n"; -+ print $echo. "=============\n"; - $PrjDir = &CorrectPath($StandDir.$Prj); -- if ($ENV{GUI} eq "UNX") { -- use Cwd 'chdir'; -+ &get_deps_hash($PrjDir, \%LocalDepsHash); -+ &BuildDependent(\%LocalDepsHash); -+ if ($cmd_file) { -+ print "$deliver_commando\n"; -+ } else { -+ system ("$deliver_commando") if (!$show && ($Prj ne $CurrentPrj)); - }; -- chdir $PrjDir; -- cwd(); -- &BuildPrj($PrjDir) if (!$deliver); -- system ("$ENV{DELIVER}") if (!$show); -+ print $check_error_string; - &RemoveFromDependencies($Prj, \%ParentDepsHash); -+ $no_projects = 0; - }; - } else { -- &BuildPrj('.'); -+ &get_deps_hash('.', \%LocalDepsHash); -+ &BuildDependent(\%LocalDepsHash); - }; - }; - - # - # Start build given project - # --sub MakeDir { -- my ($DirToBuild, $BuildDir, $error); -- $DirToBuild = shift; -- $BuildDir = &CorrectPath($StandDir.$PathHash{$DirToBuild}); -- if ($ENV{GUI} eq 'UNX') { -- use Cwd 'chdir'; -- }; -- if (chdir ($BuildDir)) { -- print "$BuildDir\n"; -+sub dmake_dir { -+ my ($folder_nick, $BuildDir); -+ $folder_nick = shift; -+ $BuildDir = &CorrectPath($StandDir . $PathHash{$folder_nick}); -+ &print_error("\n$BuildDir not found!!\n") if (!(-d $BuildDir)); -+ if ($cmd_file) { -+ print "cd $BuildDir\n"; -+ print $check_error_string; -+ print $echo.$BuildDir."\n"; -+ print "$dmake\n"; -+ print $check_error_string; - } else { -- &print_error("\n$BuildDir not found!!\n"); -- exit (1); -+ print "$BuildDir\n"; - }; -- cwd(); -- if (!$show) { -- $error = system ("$dmake"); -- if (!$error) { -- &RemoveFromDependencies($DirToBuild, \%LocalDepsHash); -- } else { -- &print_error("Error $error occurred while making $BuildDir"); -- $ENV{mk_tmp} = ''; -- exit(1); -+ &RemoveFromDependencies($folder_nick, \%LocalDepsHash) if (!$child); -+ if (!$cmd_file && !$show) { -+ chdir $BuildDir; -+ cwd(); -+ system ("$dmake"); -+ if ($? && ($? != -1) && (!$child)) { -+ &print_error("Error $? occurred while making $BuildDir"); - }; -- } else { -- &RemoveFromDependencies($DirToBuild, \%LocalDepsHash); - }; -+ if ($child) { -+ my $oldfh = select STDERR; -+ $| = 1; -+ _exit($? >> 8) if ($? && ($? != -1)); -+ _exit(0); -+ }; - }; - -- - # - # Get string (list) of parent projects to build - # -@@ -246,10 +310,8 @@ sub GetParentsString { - my ($PrjDir); - $PrjDir = shift; - $PrjDir = '.' if ($PrjDir eq $CurrentPrj); -- if (!open (PrjBuildFile, $PrjDir.'/prj/build.lst')) { -- return ''; -- }; -- while (<PrjBuildFile>) { -+ return '' if (!open (BUILD_LST, $PrjDir.'/prj/build.lst')); -+ while (<BUILD_LST>) { - if ($_ =~ /#/) { - if ($`) { - $_ = $`; -@@ -259,11 +321,11 @@ sub GetParentsString { - }; - s/\r\n//; - if ($_ =~ /\:+\s+/) { -- close PrjBuildFile; -+ close BUILD_LST; - return $'; - }; - }; -- close PrjBuildFile; -+ close BUILD_LST; - return 'NULL'; - }; - -@@ -272,37 +334,45 @@ sub GetParentsString { - # - sub get_prj_platform { - my ($prj_alias, $line); -- while(<PrjBuildFile>) { -+ while(<BUILD_LST>) { - s/\r\n//; - $line++; - if ($_ =~ /nmake/) { - if ($' =~ /\s+-\s+(\w+)[,\S+]*\s+(\S+)/ ) { - my $platform = $1; - my $alias = $2; -- if ($alias eq 'NULL') { -- &print_error ("There is no correct alias set in the line $line!"); -- exit (1); -- }; -+ &print_error ("There is no correct alias set in the line $line!") if ($alias eq 'NULL'); - &mark_platform($alias, $platform); - } else { - &print_error("Misspelling in line: \n$_"); -- exit(1); - }; - }; - }; -- seek(PrjBuildFile, 0, 0); -+ seek(BUILD_LST, 0, 0); - }; - - # - # Getting hashes of all internal dependencies and additional - # infos for given project - # --sub BuildPrj { -+sub get_deps_hash { - my ($dummy, $PrjToBuild); -+ %DeadDependencies = (); - $PrjToBuild = shift; -- open (PrjBuildFile, 'prj/build.lst'); -+ my $dependencies_hash = shift; -+ chdir $PrjToBuild; -+ cwd(); -+ if ($deliver) { -+ if ($cmd_file) { -+ print "$deliver_commando\n"; -+ } else { -+ system ("$deliver_commando") if (!$show); -+ }; -+ return; -+ }; -+ open (BUILD_LST, 'prj/build.lst'); - &get_prj_platform; -- while (<PrjBuildFile>) { -+ while (<BUILD_LST>) { - if ($_ =~ /#/) { - if ($`) { - $_ = $`; -@@ -331,22 +401,20 @@ sub BuildPrj { - }; - $PlatformHash{$DirAlias}++; - $Dependencies = $'; -- @Array = GetDependenciesArray($Dependencies); -- $LocalDepsHash{$DirAlias} = [@Array]; -+ @Array = &GetDependenciesArray($Dependencies); -+ $$dependencies_hash{$DirAlias} = [@Array]; - $BuildQueue{$DirAlias}++; - $PathHash{$DirAlias} = $Dir; - }; - }; -- close PrjBuildFile; -- %DepsArchive = %LocalDepsHash; -+ close BUILD_LST; - foreach $Dir (keys %DeadDependencies) { - next if defined $AliveDependencies{$Dir}; - if (!&IsHashNative($Dir)) { -- &RemoveFromDependencies($Dir, \%LocalDepsHash); -+ &RemoveFromDependencies($Dir, $dependencies_hash); - delete $DeadDependencies{$Dir}; - }; - }; -- &BuildDependent(); - }; - - # -@@ -361,33 +429,40 @@ sub mark_platform { - }; - }; - -- - # - # Convert path from abstract (with '\' and/or '/' delimiters) - # to system-independent - # - sub CorrectPath { - $_ = shift; -- s/\\/\//g; -+ if (($ENV{GUI} ne 'UNX') && $cmd_file) { -+ s/\//\\/g; -+ } else {; -+ s/\\/\//g; -+ }; - return $_; - }; - - - # --# Get platform-dependent dmake commando -+# Get platform-dependent commands - # --sub GetDmakeCommando { -- my ($dmake, $arg); -- -+sub get_commands { -+ my $arg = ''; - # Setting alias for dmake - $dmake = 'dmake'; - while ($arg = pop(@dmake_args)) { - $dmake .= ' '.$arg; - }; -- return $dmake; -+ if ($cmd_file) { -+ if ($ENV{GUI} eq 'UNX') { -+ $check_error_string = "if \"\$?\" != \"0\" exit\n"; -+ } else { -+ $check_error_string = "if \"\%?\" != \"0\" quit\n"; -+ }; -+ }; - }; - -- - # - # Procedure prooves if current dir is a root dir of the drive - # -@@ -408,7 +483,6 @@ sub IsRootDir { - }; - }; - -- - # - # Procedure retrieves list of projects to be built from build.lst - # -@@ -420,33 +494,21 @@ sub get_stand_dir { - my ($StandDir); - do { - $StandDir = cwd(); -- if (open(PrjBuildFile, 'prj/build.lst')) { -+ if (open(BUILD_LST, 'prj/build.lst')) { - $StandDir =~ /(\w+$)/; - $StandDir = $`; - $CurrentPrj = $1; -- close(PrjBuildFile); -+ close(BUILD_LST); - return $StandDir; - } elsif (&IsRootDir($StandDir)) { - $ENV{mk_tmp} = ''; - &print_error ('Found no project to build'); -- exit (1); - }; - } - while (chdir '..'); - }; - - # --# Build the entire project according to queue of dependencies --# --sub BuildDependent { -- my ($Dir); -- while ($Dir = &PickPrjToBuild(\%LocalDepsHash)) { -- &MakeDir($Dir); -- $Dir = ''; -- }; --}; -- --# - # Removes projects which it is not necessary to build - # - sub remove_extra_prjs { -@@ -467,11 +529,11 @@ sub PickPrjToBuild { - my ($Prj, $DepsHash); - $DepsHash = shift; - $Prj = &FindIndepPrj($DepsHash); -- delete $$DepsHash{$Prj}; -+ delete $$DepsHash{$Prj} if (defined $$DepsHash{$Prj}); -+ #print "$Prj removed from dependencies hash\n"; - return $Prj; - }; - -- - # - # Make a decision if the project should be built on this platform - # -@@ -487,7 +549,7 @@ sub CheckPlatform { - return 1; - } elsif (($ENV{GUI} eq 'UNX') && ($Platform eq 'u')) { - return 1; -- } elsif (($ENV{GUI} eq 'MACOSX') && ($Platform eq 'm')) { -+ } elsif (($ENV{GUI} eq 'MAC') && ($Platform eq 'm')) { - return 1; - } elsif (($ENV{GUI} eq 'OS2') && ($Platform eq 'p')) { - return 1; -@@ -495,7 +557,6 @@ sub CheckPlatform { - return 0; - }; - -- - # - # Remove project to build ahead from dependencies and make an array - # of all from given project dependent projects -@@ -515,12 +576,13 @@ sub RemoveFromDependencies { - }; - }; - -- - # - # Find undependent project - # - sub FindIndepPrj { - my ($Prj, @Prjs, @PrjDeps, $Dependencies, $i); -+ my $children = &children_number; -+ return '' if ($children && ($children >= $QuantityToBuild)); - $Dependencies = shift; - @Prjs = keys %$Dependencies; - if ($#Prjs != -1) { -@@ -528,21 +590,19 @@ sub FindIndepPrj { - if (&IsHashNative($Prj)) { - next; - }; -- if (!(defined $$Dependencies{$Prj})) { -- return $Prj; -- }; - @PrjDeps = @{$$Dependencies{$Prj}}; -- if ($#PrjDeps == -1) { -- return $Prj; -- }; -+ return $Prj if ($#PrjDeps == -1); - }; - # If there are only dependent projects in hash - generate error -- return '' if ($build_from); -+ return '' if ($BuildAllParents); -+ if ($children) { -+ $only_dependent = 1; -+ return ''; -+ }; - print STDERR "\nError: projects"; -- DeadPrjLoop: - foreach $Prj (keys %$Dependencies) { -- if (IsHashNative($Prj)) { -- next DeadPrjLoop; -+ if (&IsHashNative($Prj)) { -+ next; - }; - $i = 0; - print STDERR "\n$Prj depends on:"; -@@ -551,12 +611,12 @@ sub FindIndepPrj { - }; - }; - &print_error ("\nhave dead or circular dependencies\n"); -- $ENV{mk_tmp} = ''; -- exit (1); -- }; -+ } else { -+ $no_projects = 1; -+ return ''; -+ }; - }; - -- - # - # Check if given entry is HASH-native, that is not a user-defined data - # -@@ -570,7 +630,6 @@ sub IsHashNative { - }; - }; - -- - # - # Getting array of dependencies from the string given - # -@@ -581,10 +640,7 @@ sub GetDependenciesArray { - $string = $DepString; - $prj = shift; - while (!($DepString =~ /^NULL/)) { -- if (!$DepString) { -- &print_error("Project $prj has wrong written dependencies string:\n $string"); -- exit (1); -- }; -+ &print_error("Project $prj has wrong written dependencies string:\n $string") if (!$DepString); - $DepString =~ /(\S+)\s*/; - $ParentPrj = $1; - $DepString = $'; -@@ -593,17 +649,13 @@ sub GetDependenciesArray { - if (($prj_platform{$ParentPrj} ne $1) && - ($prj_platform{$ParentPrj} ne 'all')) { - &print_error ("$ParentPrj\.$1 is a wrong dependency identifier!\nCheck if it is platform dependent"); -- exit (1); - }; -- if (&CheckPlatform($1)) { -- $AliveDependencies{$ParentPrj}++; -- } -+ $AliveDependencies{$ParentPrj}++ if (&CheckPlatform($1)); - push(@Dependencies, $ParentPrj); - } else { - if ((exists($prj_platform{$ParentPrj})) && - ($prj_platform{$ParentPrj} ne 'all') ) { - &print_error("$ParentPrj is a wrong used dependency identifier!\nCheck if it is platform dependent"); -- exit (1); - }; - push(@Dependencies, $ParentPrj); - }; -@@ -624,59 +676,284 @@ sub GetDirectoryList { - return @DirectoryList; - }; - -+sub print_error { -+ my $message = shift; -+ print STDERR "\nERROR: $message\n"; -+ $ENV{mk_tmp} = ''; -+ close CMD_FILE if ($cmd_file); -+ unlink ($cmd_file); -+ exit(1) if (!$child); -+}; -+ -+sub usage { -+ print STDERR "\nbuild\n"; -+ print STDERR "Syntax: build [--help|-all|-from|-from_opt|since prj_name|-file file_name|-PP processes|-dlv[_switch] dlvswitch] \n"; -+ print STDERR "Example: build -from sfx2\n"; -+ print STDERR " - build all projects including current one from sfx2\n"; -+ print STDERR "Example: build -from_opt sfx2\n"; -+ print STDERR " - the same as -from, but skip all projects that could have been built (no secure way, use ONLY when -all or -from is already been run and there no external dependencies\' changes occurred)\n"; -+ print STDERR "Keys: -all - build all projects from very beginning till current one\n"; -+ print STDERR " -from - build all projects beginning from the specified till current one\n"; -+ print STDERR " -from_opt - build all projects beginning from the specified till current one (optimized version)\n"; -+ print STDERR " -since - build all projects beginning from the specified till current one (optimized version, skips specified project)\n"; -+ print STDERR " -show - show what is going to be built\n"; -+ print STDERR " -file - generate command file file_name\n"; -+ print STDERR " -deliver - only deliver, no build (usable for \'-all\' and \'-from\' keys)\n"; -+ print STDERR " -PP - start multiprocessing build, with number of processes passed (UNIXes only)\n"; -+ print STDERR " -dlv[_switch] - use deliver with the switch specified\n"; -+ print STDERR " --help - print help info\n"; -+ print STDERR "Default: - build current project\n"; -+ print STDERR "Keys that are not listed above would be passed to dmake\n"; -+}; -+ - # - # Get all options passed - # - sub get_options { - my $arg; -- #&usage() && exit(0) if ($#ARGV == -1); -- #$QuantityToBuild - while ($arg = shift @ARGV) { -- $arg =~ /^PP$/ and $QuantityToBuild = shift @ARGV and next; -+ $arg =~ /^-PP$/ and $QuantityToBuild = shift @ARGV and next; -+ $arg =~ /^-PP(\d+)$/ and $QuantityToBuild = $1 and next; - $arg =~ /^-all$/ and $BuildAllParents = 1 and next; - $arg =~ /^-show$/ and $show = 1 and next; - $arg =~ /^-deliver$/ and $deliver = 1 and next; -+ $arg =~ /^-dlv_switch$/ and $dlv_switch = &get_switch_options and next; -+ $arg =~ /^-dlv$/ and $dlv_switch = &get_switch_options and next; -+ $arg =~ /^-file$/ and $cmd_file = shift @ARGV and next; - $arg =~ /^-from$/ and $BuildAllParents = 1 - and $build_from = shift @ARGV and next; - $arg =~ /^-from_opt$/ and $BuildAllParents = 1 - and $build_from_opt = shift @ARGV and next; - -- $arg =~ /^-since$/ and $BuildAllParents = 1 -+ $arg =~ /^-since$/ and $BuildAllParents = 1 - and $build_since = shift @ARGV and next; -- $arg =~ /^-help$/ and &usage and exit(0); -+ $arg =~ /^--help$/ and &usage and exit(0); - push (@dmake_args, $arg); -- }; -- if ($build_from && $build_from_opt) { -- &print_error('Switches -from an -from_opt collision'); -- exit(1); - }; -+ &print_error('Switches -from and -from_opt collision') if ($build_from && $build_from_opt); - -- if ($build_from && $build_since) { -- &print_error('Switches -from an -since collision'); -- exit(1); -- }; -+ &print_error('Switches -from and -since collision') if ($build_from && $build_since); - @ARGV = @dmake_args; -+ $cmd_file = '' if ($show); -+ if (($ENV{GUI} eq 'WNT') && $QuantityToBuild) { -+ $QuantityToBuild = 0; -+ &print_error('-PP switch is unusable under windows!\n'); -+ }; - }; - --sub print_error { -- my $message = shift; -- print STDERR "\nERROR: $message\n"; -+# -+# get all options without '-' -+# -+sub get_switch_options { -+ my $string = ''; -+ my $option = ''; -+ while ($option = shift @ARGV) { -+ if (!($option =~ /^-/)) { -+ $string .= '-' . $option; -+ $string .= ' '; -+ } else { -+ unshift(@ARGV, $option); -+ last; -+ }; -+ }; -+ $string =~ s/\s$//; -+ return $string; - }; - --sub usage { -- print STDERR "\nbuild\n"; -- print STDERR "Syntax: build [-help|-all|-from|-from_opt|since prj_name] \n"; -- print STDERR "Example: build -from sfx2\n"; -- print STDERR " - build all projects including current one from sfx2\n"; -- print STDERR "Example: build -from_opt sfx2\n"; -- print STDERR " - the same as -from, but skip all projects that could have been built (no secure way, use ONLY when -all or -from is already been run and there no external dependensies\' changes occurred)\n"; -- print STDERR "Keys: -all - build all projects from very beginning till current one\n"; -- print STDERR " -from - build all projects beginning from the specified till current one\n"; -- print STDERR " -from_opt - build all projects beginning from the specified till current one (optimized version)\n"; -- print STDERR " -since - build all projects beginning from the specified till current one (optimized version, skips specified project)\n"; -- print STDERR " -show - show what is gonna be built\n"; -- print STDERR " -deliver - only deliver, no build (usable for \'-all\' and \'-from\' keys)\n"; -- print STDERR " -help - print help info\n"; -- print STDERR "Default: - build current project\n"; -- print STDERR "Keys that are not listed above would be passed to dmake\n"; -+# -+# cancel build when one of children has error exit code -+# -+sub cancel_build { -+ while (&children_number) {sleep(1)}; -+ print STDERR "\n"; -+ foreach (keys %broken_build) { -+ print STDERR "ERROR: error $_ occurred while making ", $broken_build{$_}, "\n"; -+ }; -+ exit(1); -+}; -+ -+# -+# Function for storing error in multiprocessing AllParents build -+# -+sub store_error { -+ my ($pid, $error_code) = @_; -+ my $child_nick = $processes_hash{$pid}; -+ $broken_build {$error_code} = &CorrectPath($StandDir . $PathHash{$child_nick}); - }; -+ -+# -+# child handler (clears (or stores info about) the terminated child) -+# -+sub handle_dead_child { -+ my $pid = 0; -+ foreach (keys %processes_hash) { -+ if (($pid = waitpid($_, &WNOHANG)) > 0) { -+ &store_error($pid, $?) if ($?); -+ &clear_from_child($pid); -+ }; -+ }; -+}; -+ -+sub clear_from_child { -+ my $pid = shift; -+ my $child_nick = $processes_hash{$pid}; -+ &RemoveFromDependencies($child_nick, -+ $folders_hashes{$child_nick}); -+ $running_children{$folders_hashes{$child_nick}}--; -+ delete $processes_hash{$pid}; -+ $only_dependent = 0; -+}; -+ -+# -+# Register signal handler & unblock SIGALRM -+# -+sub register_signal_handler { -+ $sigaction = POSIX::SigAction->new('main::handle_dead_child'); -+ sigaction(SIGCHLD, $sigaction); -+ $handler_set = 1; -+}; -+ -+# -+# Build the entire project according to queue of dependencies -+# -+sub BuildDependent { -+ $dependencies_hash = shift; -+ my $pid = 0; -+ my $child_nick = ''; -+ while ($child_nick = &PickPrjToBuild($dependencies_hash)) { -+ if (($QuantityToBuild) ) { # multyprocessing not for $BuildAllParents (-all etc)!! -+ ®ister_signal_handler if (!$handler_set); -+ do { -+ # start current child & all -+ # that could be started now -+ &start_child($child_nick) if ($child_nick); -+ sleep if (&children_number() >= $QuantityToBuild); -+ $child_nick = &PickPrjToBuild($dependencies_hash); -+ if ($only_dependent) { -+ return if ($BuildAllParents); -+ sleep; -+ }; -+ } while (!$no_projects); -+ return if ($BuildAllParents); -+ while (&children_number()) { -+ sleep(5); -+ }; -+ print STDERR "Multiprocessing build is finished\n"; -+ } else { -+ &dmake_dir($child_nick); -+ }; -+ $child_nick = ''; -+ }; -+}; -+ -+sub children_number { -+ return scalar (keys %processes_hash); -+}; -+ -+sub start_child { -+ &cancel_build if (scalar keys %broken_build); -+ my $child_nick = shift; -+ my $pid; -+ if ($pid = fork) { # parent -+ $processes_hash{$pid} = $child_nick; -+ print 'Running processes: ', &children_number(), "\n"; -+ $folders_hashes{$child_nick} = $dependencies_hash; -+ $running_children{$dependencies_hash}++; -+ sleep(1) if ($BuildAllParents); -+ } elsif (defined $pid) { # child -+ $child = 1; -+ #print "$child_nick\n"; -+ &dmake_dir($child_nick); -+ }; -+}; -+ -+# -+# Build everything that should be built multiprocessing version -+# -+sub build_multiprocessing { -+ my $Prj; -+ my @build_queue = (); # array, containing queue of projects -+ # to build -+ do { -+ while ($Prj = &PickPrjToBuild(\%ParentDepsHash)) { -+ if ($build_from_opt) { -+ if ($build_from_opt ne $Prj) { -+ &RemoveFromDependencies($Prj, \%ParentDepsHash); -+ next; -+ } else { -+ $build_from_opt = ''; -+ }; -+ }; -+ if ($build_since) { -+ if ($build_since ne $Prj) { -+ &RemoveFromDependencies($Prj, \%ParentDepsHash); -+ } else { -+ &RemoveFromDependencies($Prj, \%ParentDepsHash); -+ $build_since = ''; -+ }; -+ next; -+ }; -+ push @build_queue, $Prj; -+ $projects_deps_hash{$Prj} = {}; -+ &get_deps_hash(&CorrectPath($StandDir.$Prj), $projects_deps_hash{$Prj}); -+ }; -+ sleep(1) if (!$Prj); -+ &build_actual_queue(\@build_queue); -+ } while (scalar (keys %ParentDepsHash)); -+ while (&children_number()) { -+ sleep(5); -+ }; -+ &cancel_build if (scalar keys %broken_build); -+ print STDERR "Multiprocessing build is finished\n"; -+ exit(0); -+}; -+ -+# -+# Here the built queue is built as long as possible -+# -+sub build_actual_queue { -+ my $build_queue = shift; -+ my $i = 0; -+ do { -+ while ($i <= (scalar(@$build_queue) - 1)) { -+ &cancel_build if (scalar keys %broken_build); -+ $Prj = $$build_queue[$i]; -+ &annonce_module($Prj) if (!(defined $module_annonced{$Prj})); -+ $only_dependent = 0; -+ $no_projects = 0; -+ &BuildDependent($projects_deps_hash{$Prj}); -+ if ($no_projects && ($running_children{$projects_deps_hash{$Prj}} == 0)) { -+ chdir(&CorrectPath($StandDir.$Prj)); -+ system ("$deliver_commando") if (!$show && ($Prj ne $CurrentPrj)); -+ delete $projects_deps_hash{$Prj}; -+ &RemoveFromDependencies($Prj, \%ParentDepsHash); -+ splice (@$build_queue, $i, 1); -+ next; -+ }; -+ $i++; -+ }; -+ $i = 0; -+ } while (!&are_all_dependent($build_queue)); -+}; -+ -+# -+# Print announcement for module just started -+# -+sub annonce_module { -+ my $Prj = shift; -+ print $echo. "=============\n"; -+ print $echo. "Building project $Prj\n"; -+ print $echo. "=============\n"; -+ $module_annonced{$Prj}++; -+}; -+ -+sub are_all_dependent { -+ my $build_queue = shift; -+ my $folder = ''; -+ foreach my $prj (@$build_queue) { -+ $folder = &FindIndepPrj($projects_deps_hash{$prj}); -+ return '' if ($folder); -+ }; -+ return '1'; -+}; -+ |