diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2010-11-02 16:09:22 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2010-11-02 16:09:22 +0100 |
commit | 628feac11e4ddc80880ee12abb4363788fdf88ea (patch) | |
tree | 4acda6749f3c9ddd98fdf06c822ca21537921195 /solenv/bin | |
parent | b6681a304410d1f47570942a8cda5d34b37e3b0e (diff) | |
parent | 91f02c263c3c7d9f012cd2427d6bb84bfb79ec93 (diff) |
CWS-TOOLING: integrate CWS vgbugs12
Diffstat (limited to 'solenv/bin')
-rwxr-xr-x[-rw-r--r--] | solenv/bin/build.pl | 697 | ||||
-rwxr-xr-x | solenv/bin/modules/SourceConfig.pm | 13 |
2 files changed, 332 insertions, 378 deletions
diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl index bff6e870f2e9..0ba604d55cec 100644..100755 --- a/solenv/bin/build.pl +++ b/solenv/bin/build.pl @@ -30,6 +30,7 @@ # # build - build entire project # + use strict; use Config; use POSIX; use Cwd qw (cwd); @@ -46,6 +47,7 @@ use lib ("$ENV{SOLARENV}/bin/modules"); use SourceConfig; use RepositoryHelper; + use Cwd 'chdir'; my $in_so_env = 0; if (defined $ENV{COMMON_ENV_TOOLS}) { @@ -61,24 +63,19 @@ $verbose_mode = ($ENV{verbose} =~ /^t\S*$/i); } my $enable_multiprocessing = 1; - my $cygwin = 0; - $cygwin++ if ($^O eq 'cygwin'); - if ($ENV{GUI} eq 'WNT' && !$cygwin) { - eval { require Win32::Process; import Win32::Process; }; - $enable_multiprocessing = 0 if ($@); - eval { require Win32::Pipe; import Win32::Pipe; }; - }; - ### for XML file format eval { require XMLBuildListParser; import XMLBuildListParser; }; + my $enable_xml = 0; + my @modes_array = (); if (!$@) { $enable_xml = 1; @modes_array = split('\s' , $ENV{BUILD_TYPE}); }; #### script id ##### - ( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/; - $id_str = ' $Revision: 275224 $ '; + ( my $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/; + my $id_str = ' $Revision: 275224 $ '; + my $script_rev = 0; $id_str =~ /Revision:\s+(\S+)\s+\$/ ? ($script_rev = $1) : ($script_rev = "-"); @@ -90,103 +87,98 @@ # # ######################### - $modules_number++; - $perl = ""; - $remove_command = ""; - use Cwd 'chdir'; - $perl = 'perl'; - $remove_command = 'rm -rf'; - $nul = '> /dev/null'; + my $modules_number++; + my $perl = 'perl'; + my $remove_command = 'rm -rf'; + my $nul = '> /dev/null'; - $processes_to_run = 0; + my $processes_to_run = 0; # delete $pid when not needed - %projects_deps_hash = (); # hash of projects with no dependencies, + my %projects_deps_hash = (); # hash of projects with no dependencies, # that could be built now - %broken_build = (); # hash of hashes of the modules, + my %broken_build = (); # hash of hashes of the modules, # where build was broken (error occurred) - %folders_hashes = (); - %running_children = (); - $dependencies_hash = 0; - $cmd_file = ''; - $build_all_parents = 0; - $show = 0; - $checkparents = 0; - $deliver = 0; - $pre_custom_job = ''; - $custom_job = ''; - $post_custom_job = ''; - %local_deps_hash = (); - %PathHash = (); - %PlatformHash = (); - %AliveDependencies = (); - %global_deps_hash = (); # hash of dependencies of the all modules - %global_deps_hash_backup = (); # backup hash of external dependencies of the all modules - %module_deps_hash_backup = (); # backup hash of internal dependencies for aech module - %modules_with_errors = (); # hash of modules hashes, which cannot be built further - @broken_modules_names = (); # array of modules, which cannot be built further - @dmake_args = (); - %dead_parents = (); - $initial_module = ''; - $all_dependent = 1; # a flag indicating if the hash has independent keys - $build_from_with_branches = ''; - $build_all_cont = ''; - $build_since = ''; - $dlv_switch = ''; - $child = 0; - %processes_hash = (); - %module_announced = (); - $prepare = ''; # prepare for following incompatible build - $ignore = ''; - $html = ''; - @ignored_errors = (); - %incompatibles = (); - %skip_modules = (); - %exclude_branches = (); - $only_platform = ''; # the only platform to prepare - $only_common = ''; # the only common output tree to delete when preparing - %build_modes = (); - $maximal_processes = 0; # the max number of the processes run - %modules_types = (); # modules types ('mod', 'img', 'lnk') hash - %platforms = (); # platforms available or being working with - %platforms_to_copy = (); # copy output trees for the platforms when --prepare - $tmp_dir = get_tmp_dir(); # temp directory for checkout and other actions + my %folders_hashes = (); + my %running_children = (); + my $dependencies_hash = 0; + my $cmd_file = ''; + my $build_all_parents = 0; + my $show = 0; + my $checkparents = 0; + my $deliver = 0; + my $pre_custom_job = ''; + my $custom_job = ''; + my $post_custom_job = ''; + my %local_deps_hash = (); + my %path_hash = (); + my %platform_hash = (); + my %alive_dependencies = (); + my %global_deps_hash = (); # hash of dependencies of the all modules + my %global_deps_hash_backup = (); # backup hash of external dependencies of the all modules + my %module_deps_hash_backup = (); # backup hash of internal dependencies for aech module + my @broken_module_names = (); # array of modules, which cannot be built further + my @dmake_args = (); + my %dead_parents = (); + my $initial_module = ''; + my $all_dependent = 1; # a flag indicating if the hash has independent keys + my $build_from_with_branches = ''; + my $build_all_cont = ''; + my $build_since = ''; + my $dlv_switch = ''; + my $child = 0; + my %processes_hash = (); + my %module_announced = (); + my $prepare = ''; # prepare for following incompatible build + my $ignore = ''; + my $html = ''; + my @ignored_errors = (); + my %incompatibles = (); + my %skip_modules = (); + my %exclude_branches = (); + my $only_platform = ''; # the only platform to prepare + my $only_common = ''; # the only common output tree to delete when preparing + my %build_modes = (); + my $maximal_processes = 0; # the max number of the processes run + my %modules_types = (); # modules types ('mod', 'img', 'lnk') hash + my %platforms = (); # platforms available or being working with + my %platforms_to_copy = (); # copy output trees for the platforms when --prepare + my $tmp_dir = get_tmp_dir(); # temp directory for checkout and other actions # $dmake_batch = undef; # - @possible_build_lists = ('build.lst', 'build.xlist'); # build lists names - %build_list_paths = (); # 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 = ''; # -"- - %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 - %html_info = (); # hash containing all necessary info for generating of html page - %module_by_hash = (); # hash containing all modules names as values and correspondent hashes as keys - %build_in_progress = (); # hash of modules currently being built - %build_is_finished = (); # hash of already built modules - %modules_with_errors = (); # hash of modules with build errors - %build_in_progress_shown = (); # hash of modules being built, + my @possible_build_lists = ('build.lst', 'build.xlist'); # build lists names + my %build_list_paths = (); # build lists names + my %build_lists_hash = (); # hash of arrays $build_lists_hash{$module} = \($path, $xml_list_object) + my $pre_job = 'announce'; # job to add for not-single module build + my $post_job = ''; # -"- + my @warnings = (); # array of warnings to be shown at the end of the process + my @errors = (); # array of errors to be shown at the end of the process + my %html_info = (); # hash containing all necessary info for generating of html page + my %module_by_hash = (); # hash containing all modules names as values and correspondent hashes as keys + my %build_in_progress = (); # hash of modules currently being built + my %build_is_finished = (); # hash of already built modules + my %modules_with_errors = (); # hash of modules with build errors + my %build_in_progress_shown = (); # hash of modules being built, # and shown last time (to keep order) - $build_time = time; - $html_last_updated = 0; - %jobs_hash = (); - $html_path = undef; - $build_finished = 0; - $html_file = ''; - %had_error = (); # hack for misteriuos windows problems - try run dmake 2 times if first time there was an error - $mkout = CorrectPath("$ENV{SOLARENV}/bin/mkout.pl"); - %weights_hash = (); # hash contains info about how many modules are dependent from one module + my $build_time = time; + my $html_last_updated = 0; + my %jobs_hash = (); + my $html_path = undef; + my $build_finished = 0; + my $html_file = ''; + my %had_error = (); # hack for misteriuos windows problems - try run dmake 2 times if first time there was an error + my $mkout = correct_path("$ENV{SOLARENV}/bin/mkout.pl"); + my %weights_hash = (); # hash contains info about how many modules are dependent from one module # %weight_stored = (); - $grab_output = 1; - $stop_build_on_error = 0; # for multiprocessing mode: do not build further module if there is an error - $interactive = 0; # for interactive mode... (for testing purpose enabled by default) - $parent_process = 1; - $server_mode = 0; - $setenv_string = ''; # string for configuration of the client environment - $ports_string = ''; # string with possible ports for server - @server_ports = (); - $html_port = 0; - $server_socket_obj = undef; # socket object for server - $html_socket_obj = undef; # socket object for server + my $grab_output = 1; + my $stop_build_on_error = 0; # for multiprocessing mode: do not build further module if there is an error + my $interactive = 0; # for interactive mode... (for testing purpose enabled by default) + my $parent_process = 1; + my $server_mode = 0; + my $setenv_string = ''; # string for configuration of the client environment + my $ports_string = ''; # string with possible ports for server + my @server_ports = (); + my $html_port = 0; + my $server_socket_obj = undef; # socket object for server + my $html_socket_obj = undef; # socket object for server my %clients_jobs = (); my %clients_times = (); my $client_timeout = 0; # time for client to build (in sec)... @@ -205,19 +197,28 @@ my $clear_config = 0; my $finisched_children = 0; my $debug = 0; - %module_deps_hash_pids = (); + my %module_deps_hash_pids = (); my @argv = @ARGV; my $source_config_file; + my @modules_built = (); + my $deliver_command = $ENV{DELIVER}; + my %prj_platform = (); + my $check_error_string = ''; + my $dmake = ''; + my $dmake_args = ''; + my $echo = ''; + my $new_line = "\n"; + my $incompatible = 0; + my $local_host_ip = 'localhost'; ### main ### get_options(); -# my $temp_html_file = CorrectPath($tmp_dir. '/' . $ENV{INPATH}. '.build.html'); +# my $temp_html_file = correct_path($tmp_dir. '/' . $ENV{INPATH}. '.build.html'); get_build_modes(); - %deliver_env = (); + my %deliver_env = (); if ($prepare) { get_platforms(\%platforms); - @modules_built = (); $deliver_env{'BUILD_SOSL'}++; $deliver_env{'COMMON_OUTDIR'}++; @@ -227,14 +228,14 @@ $deliver_env{'OUTPATH'}++; $deliver_env{'L10N_framework'}++; }; - $StandDir = get_stand_dir(); # This also sets $initial_module - $source_config = SourceConfig -> new($StandDir); + my $workspace_path = get_workspace_path(); # This also sets $initial_module + my $source_config = SourceConfig -> new($workspace_path); if ($html) { if (defined $html_path) { - $html_file = CorrectPath($html_path . '/' . $ENV{INPATH}. '.build.html'); + $html_file = correct_path($html_path . '/' . $ENV{INPATH}. '.build.html'); } else { - my $log_directory = Cwd::realpath(CorrectPath($StandDir . '/..')) . '/log'; + my $log_directory = Cwd::realpath(correct_path($workspace_path . '/..')) . '/log'; if ((!-d $log_directory) && (!mkdir($log_directory))) { print_error("Cannot create $log_directory for writing html file\n"); }; @@ -250,17 +251,9 @@ get_module_and_buildlist_paths(); provide_consistency() if (defined $ENV{CWS_WORK_STAMP} && defined($ENV{COMMON_ENV_TOOLS})); - $deliver_command = $ENV{DELIVER}; $deliver_command .= ' -verbose' if ($html); $deliver_command .= ' '. $dlv_switch if ($dlv_switch); $ENV{mk_tmp}++; - %prj_platform = (); - $check_error_string = ''; - $dmake = ''; -# $dmake_bin = ''; - $dmake_args = ''; - $echo = ''; - $new_line = "\n"; get_commands(); unlink ($cmd_file); @@ -293,7 +286,7 @@ if (scalar keys %broken_build) { cancel_build(); # } elsif (!$custom_job && $post_custom_job) { -# do_post_custom_job(CorrectPath($StandDir.$initial_module)); +# do_post_custom_job(correct_path($workspace_path.$initial_module)); }; print_warnings(); if (scalar keys %active_modules) { @@ -308,7 +301,7 @@ print $echo."$_\n"; }; print $new_line; - print $echo."not found and couldn't be built. Dependencies on that module(s) ignored. Maybe you should correct build lists.\n"; + print $echo."not found and couldn't be built. dependencies on that module(s) ignored. Maybe you should correct build lists.\n"; print $new_line; do_exit(1) if ($checkparents); }; @@ -365,7 +358,7 @@ sub generate_config_file { sub start_interactive { - $pid = open(HTML_PIPE, "-|"); + my $pid = open(HTML_PIPE, "-|"); print "Pipe is open\n"; if ($pid) { # parent @@ -439,7 +432,6 @@ sub start_html_message_trigger { }; sub get_html_orders { -# print "Parent gonna read\n"; return if (!$interactive); my $buffer_size = 1024; my $buffer; @@ -483,7 +475,6 @@ sub get_html_orders { schedule_rebuild(\%modules_to_rebuild); generate_html_file(); }; -# print "Parent got nothing to read\n"; }; sub schedule_delete { @@ -553,7 +544,7 @@ sub get_build_list_path { my $possible_dir_path = $module_paths{$_}.'/prj/'; if (-d $possible_dir_path) { foreach my $build_list (@possible_build_lists) { - my $possible_build_list_path = CorrectPath($possible_dir_path . $build_list); + my $possible_build_list_path = correct_path($possible_dir_path . $build_list); if (-f $possible_build_list_path) { $build_list_paths{$module} = $possible_build_list_path; return $possible_build_list_path; @@ -563,7 +554,7 @@ sub get_build_list_path { }; }; $dead_parents{$module}++; - $build_list_paths{$module} = CorrectPath(retrieve_build_list($module)) if (!defined $build_list_paths{$module}); + $build_list_paths{$module} = correct_path(retrieve_build_list($module)) if (!defined $build_list_paths{$module}); return $build_list_paths{$module}; }; @@ -586,9 +577,9 @@ sub get_parent_deps { $parents_deps_hash{$_}++; } $$deps_hash{$module} = \%parents_deps_hash; - foreach $Parent (keys %parents_deps_hash) { - if (!defined($$deps_hash{$Parent}) && (!defined $exclude_branches{$module})) { - push (@unresolved_parents, $Parent); + foreach my $parent (keys %parents_deps_hash) { + if (!defined($$deps_hash{$parent}) && (!defined $exclude_branches{$module})) { + push (@unresolved_parents, $parent); }; }; }; @@ -655,7 +646,7 @@ sub reverse_dependensies { # sub build_all { if ($build_all_parents) { - my ($Prj, $PrjDir, $orig_prj); + my ($prj, $prj_dir, $orig_prj); get_parent_deps( $initial_module, \%global_deps_hash); if (scalar keys %active_modules) { $active_modules{$initial_module}++; @@ -680,11 +671,11 @@ sub build_all { exit 0; } elsif ($incompatible) { my @missing_modules = (); - foreach (keys %global_deps_hash) { + foreach (sort keys %global_deps_hash) { push(@missing_modules, $_) if (!defined $active_modules{$_}); }; if (scalar @missing_modules) { - print_error("There are modules:\n@missing_modules\n\nthat should be built, but they are not activated. Please, verify your $source_config_file.\n"); + push(@warnings, "The modules: \"@missing_modules\" should be have been built, but they are not activated and have been skipped. Be aware, that can cause compatibility problems. Maybe you should verify your $source_config_file.\n"); }; }; foreach my $module (keys %dead_parents, keys %skip_modules) { @@ -703,26 +694,26 @@ sub build_all { if ($server_mode) { run_server(); }; - while ($Prj = pick_prj_to_build(\%global_deps_hash)) { - if (!defined $dead_parents{$Prj}) { + while ($prj = pick_prj_to_build(\%global_deps_hash)) { + if (!defined $dead_parents{$prj}) { if (scalar keys %broken_build) { - print $echo . "Skipping project $Prj because of error(s)\n"; - remove_from_dependencies($Prj, \%global_deps_hash); - $build_is_finished{$Prj}++; + print $echo . "Skipping project $prj because of error(s)\n"; + remove_from_dependencies($prj, \%global_deps_hash); + $build_is_finished{$prj}++; next; }; - $PrjDir = $module_paths{$Prj}; - get_module_dep_hash($Prj, \%local_deps_hash); - my $info_hash = $html_info{$Prj}; - $$info_hash{DIRS} = check_deps_hash(\%local_deps_hash, $Prj); - $module_by_hash{\%local_deps_hash} = $Prj; + $prj_dir = $module_paths{$prj}; + get_module_dep_hash($prj, \%local_deps_hash); + my $info_hash = $html_info{$prj}; + $$info_hash{DIRS} = check_deps_hash(\%local_deps_hash, $prj); + $module_by_hash{\%local_deps_hash} = $prj; build_dependent(\%local_deps_hash); print $check_error_string; }; - remove_from_dependencies($Prj, \%global_deps_hash); - $build_is_finished{$Prj}++; + remove_from_dependencies($prj, \%global_deps_hash); + $build_is_finished{$prj}++; }; } else { store_build_list_content($initial_module); @@ -742,7 +733,7 @@ sub build_all { sub backup_deps_hash { my $source_hash = shift; my $backup_hash = shift; - foreach $key (keys %$source_hash) { + foreach my $key (keys %$source_hash) { my %values_hash = %{$$source_hash{$key}}; $$backup_hash{$key} = \%values_hash; }; @@ -812,7 +803,6 @@ sub dmake_dir { _exit(0); } elsif ($error_code && ($error_code != -1)) { return $error_code; -# print_error("Error $? occurred while making $job_name"); }; }; @@ -890,7 +880,6 @@ sub get_prj_platform { }; }; }; -#seek(BUILD_LST, 0, 0); }; # @@ -901,8 +890,8 @@ sub get_deps_from_object { my ($module, $build_list_object, $dependencies_hash) = @_; foreach my $dir ($build_list_object->getJobDirectories("make", $ENV{GUI})) { - $PathHash{$dir} = $module_paths{$module}; - $PathHash{$dir} .= $dir if ($dir ne '/'); + $path_hash{$dir} = $module_paths{$module}; + $path_hash{$dir} .= $dir if ($dir ne '/'); my %deps_hash = (); foreach my $dep ($build_list_object->getJobDependencies($dir, "make", $ENV{GUI})) { @@ -933,7 +922,7 @@ sub get_module_dep_hash { # sub get_deps_hash { my ($dummy, $module_to_build); - %DeadDependencies = (); + my %dead_dependencies = (); $module_to_build = shift; my $dependencies_hash = shift; if ($custom_job) { @@ -964,37 +953,37 @@ sub get_deps_hash { }; s/\r\n//; if ($_ =~ /\s+nmake\s+/o) { - my ($Platform, $Dependencies, $Dir, $DirAlias); + my ($platform, $dependencies, $dir, $dir_alias); my %deps_hash = (); - $Dependencies = $'; + $dependencies = $'; $dummy = $`; $dummy =~ /(\S+)\s+(\S*)/o; - $Dir = $2; - $Dependencies =~ /(\w+)/o; - $Platform = $1; - $Dependencies = $'; - while ($Dependencies =~ /,(\w+)/o) { - $Dependencies = $'; + $dir = $2; + $dependencies =~ /(\w+)/o; + $platform = $1; + $dependencies = $'; + while ($dependencies =~ /,(\w+)/o) { + $dependencies = $'; }; - $Dependencies =~ /\s+(\S+)\s+/o; - $DirAlias = $1; - if (!CheckPlatform($Platform)) { - next if (defined $PlatformHash{$DirAlias}); - $DeadDependencies{$DirAlias}++; + $dependencies =~ /\s+(\S+)\s+/o; + $dir_alias = $1; + if (!check_platform($platform)) { + next if (defined $platform_hash{$dir_alias}); + $dead_dependencies{$dir_alias}++; next; }; - delete $DeadDependencies{$DirAlias} if (defined $DeadDependencies{$DirAlias}); - print_error("Directory alias $DirAlias is defined at least twice!! Please, correct build.lst in module $module_to_build") if (defined $$dependencies_hash{$DirAlias}); - $PlatformHash{$DirAlias}++; - $Dependencies = $'; - print_error("$module_to_build/prj/build.lst has wrongly written dependencies string:\n$_\n") if (!$Dependencies); - $deps_hash{$_}++ foreach (GetDependenciesArray($Dependencies)); - $$dependencies_hash{$DirAlias} = \%deps_hash; + delete $dead_dependencies{$dir_alias} if (defined $dead_dependencies{$dir_alias}); + print_error("Directory alias $dir_alias is defined at least twice!! Please, correct build.lst in module $module_to_build") if (defined $$dependencies_hash{$dir_alias}); + $platform_hash{$dir_alias}++; + $dependencies = $'; + print_error("$module_to_build/prj/build.lst has wrongly written dependencies string:\n$_\n") if (!$dependencies); + $deps_hash{$_}++ foreach (get_dependency_array($dependencies)); + $$dependencies_hash{$dir_alias} = \%deps_hash; my $local_dir = ''; - if ($Dir =~ /(\\|\/)/o) { + if ($dir =~ /(\\|\/)/o) { $local_dir = "/$'"; }; - $PathHash{$DirAlias} = CorrectPath($module_paths{$module_to_build} . $local_dir); + $path_hash{$dir_alias} = correct_path($module_paths{$module_to_build} . $local_dir); } elsif ($_ !~ /^\s*$/ && $_ !~ /^\w*\s/o) { chomp; push(@errors, $_); @@ -1011,16 +1000,15 @@ sub get_deps_hash { print_error($message); }; }; - foreach my $alias (keys %DeadDependencies) { - next if defined $AliveDependencies{$alias}; - if (!IsHashNative($alias)) { + foreach my $alias (keys %dead_dependencies) { + next if defined $alive_dependencies{$alias}; +# if (!IsHashNative($alias)) { remove_from_dependencies($alias, $dependencies_hash); - delete $DeadDependencies{$alias}; - }; + delete $dead_dependencies{$alias}; +# }; }; }; -# check_deps_hash($dependencies_hash); - resolve_aliases($dependencies_hash, \%PathHash); + resolve_aliases($dependencies_hash, \%path_hash); if (!$prepare) { add_prerequisite_job($dependencies_hash, $module_to_build, $pre_custom_job); add_prerequisite_job($dependencies_hash, $module_to_build, $pre_job); @@ -1039,7 +1027,7 @@ sub add_prerequisite_job { return if (!$job); $job = "$module $job"; foreach (keys %$dependencies_hash) { - $deps_hash = $$dependencies_hash{$_}; + my $deps_hash = $$dependencies_hash{$_}; $$deps_hash{$job}++; }; $$dependencies_hash{$job} = {}; @@ -1061,15 +1049,15 @@ sub add_dependent_job { # this procedure converts aliases to absolute paths # sub resolve_aliases { - my ($dependencies_hash, $PathHash) = @_; + my ($dependencies_hash, $path_hash) = @_; foreach my $dir_alias (keys %$dependencies_hash) { my $aliases_hash_ref = $$dependencies_hash{$dir_alias}; my %paths_hash = (); foreach (keys %$aliases_hash_ref) { - $paths_hash{$$PathHash{$_}}++; + $paths_hash{$$path_hash{$_}}++; }; delete $$dependencies_hash{$dir_alias}; - $$dependencies_hash{$$PathHash{$dir_alias}} = \%paths_hash; + $$dependencies_hash{$$path_hash{$dir_alias}} = \%paths_hash; }; }; @@ -1089,7 +1077,7 @@ sub mark_platform { # Convert path from abstract (with '\' and/or '/' delimiters) # to system-independent # -sub CorrectPath { +sub correct_path { $_ = shift; s/\\/\//g; return $_; @@ -1140,76 +1128,50 @@ sub get_commands { # # Procedure retrieves list of projects to be built from build.lst # -sub get_stand_dir { +sub get_workspace_path { if (!defined $ENV{GUI}) { $ENV{mk_tmp} = ''; die "No environment set\n"; }; my $repository_helper = RepositoryHelper->new(); - my $StandDir = $repository_helper->get_repository_root(); + my $workspace_path = $repository_helper->get_repository_root(); my $initial_dir = $repository_helper->get_initial_directory(); - if ($StandDir eq $initial_dir) { + if ($workspace_path eq $initial_dir) { print_error('Found no project to build'); }; - $initial_module = substr($initial_dir, length($StandDir) + 1); + $initial_module = substr($initial_dir, length($workspace_path) + 1); if ($initial_module =~ /(\\|\/)/) { $initial_module = $`; }; - $module_paths{$initial_module} = $StandDir . "/$initial_module"; -# $build_list_paths{$initial_module} =$StandDir . '/prj/'.$_; -# if ( defined $ENV{PWD} ) { -# $StandDir = $ENV{PWD}; -# } elsif (defined $ENV{_cwd}) { -# $StandDir = $ENV{_cwd}; -# } else { -# $StandDir = cwd(); -# }; -# my $previous_dir = ''; -# do { -# foreach (@possible_build_lists) {# ('build.lst', 'build.xlist'); -# if (-e $StandDir . '/prj/'.$_) { -# $initial_module = File::Basename::basename($StandDir); -# $build_list_paths{$initial_module} =$StandDir . '/prj/'.$_; -# $StandDir = File::Basename::dirname($StandDir); -# $module_paths{$initial_module} = $StandDir . "/$initial_module"; - return $StandDir; -# } elsif ($StandDir eq $previous_dir) { -# $ENV{mk_tmp} = ''; -# print_error('Found no project to build'); -# }; -# }; -# $previous_dir = $StandDir; -# $StandDir = File::Basename::dirname(Cwd::realpath($StandDir)); -# print_error('Found no project to build') if (!$StandDir); -# } -# while (chdir "$StandDir"); + $module_paths{$initial_module} = $workspace_path . "/$initial_module"; + return $workspace_path; }; # # Picks project which can be built now from hash and then deletes it from hash # sub pick_prj_to_build { - my $DepsHash = shift; + my $deps_hash = shift; get_html_orders(); - my $Prj = find_indep_prj($DepsHash); - if ($Prj) { - delete $$DepsHash{$Prj}; + my $prj = find_indep_prj($deps_hash); + if ($prj) { + delete $$deps_hash{$prj}; generate_html_file(); }; - return $Prj; + return $prj; }; # # Make a decision if the project should be built on this platform # -sub CheckPlatform { - my $Platform = shift; - return 1 if ($Platform eq 'all'); - return 1 if (($ENV{GUI} eq 'WIN') && ($Platform eq 'w')); - return 1 if (($ENV{GUI} eq 'UNX') && ($Platform eq 'u')); - return 1 if (($ENV{GUI} eq 'OS2') && ($Platform eq 'p')); +sub check_platform { + my $platform = shift; + return 1 if ($platform eq 'all'); + return 1 if (($ENV{GUI} eq 'WIN') && ($platform eq 'w')); + 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; }; @@ -1218,14 +1180,14 @@ sub CheckPlatform { # of all from given project dependent projects # sub remove_from_dependencies { - my ($ExclPrj, $i, $Prj, $Dependencies); - $ExclPrj = shift; - my $ExclPrj_orig = ''; - $ExclPrj_orig = $` if (($ExclPrj =~ /\.lnk$/o) || ($ExclPrj =~ /\.link$/o)); - $Dependencies = shift; - foreach $Prj (keys %$Dependencies) { - my $prj_deps_hash = $$Dependencies{$Prj}; - delete $$prj_deps_hash{$ExclPrj} if (defined $$prj_deps_hash{$ExclPrj}); + my ($exclude_prj, $i, $prj, $dependencies); + $exclude_prj = shift; + my $exclude_prj_orig = ''; + $exclude_prj_orig = $` if (($exclude_prj =~ /\.lnk$/o) || ($exclude_prj =~ /\.link$/o)); + $dependencies = shift; + foreach $prj (keys %$dependencies) { + my $prj_deps_hash = $$dependencies{$prj}; + delete $$prj_deps_hash{$exclude_prj} if (defined $$prj_deps_hash{$exclude_prj}); }; }; @@ -1247,8 +1209,8 @@ sub check_deps_hash { do { $consistent = ''; - foreach $key (sort keys %deps_hash) { - $local_deps_ref = $deps_hash{$key}; + foreach my $key (sort keys %deps_hash) { + my $local_deps_ref = $deps_hash{$key}; if (!scalar keys %$local_deps_ref) { if (defined $module) { $build_number++; @@ -1282,7 +1244,7 @@ sub check_deps_hash { BUILD_NUMBER => $build_number, STATUS => 'waiting', LOG_PATH => '../' . $source_config->get_module_repository($module) . "/$module/$ENV{INPATH}/misc/logs/$log_name", - LONG_LOG_PATH => CorrectPath($module_paths{$module} . "/$ENV{INPATH}/misc/logs/$log_name"), + LONG_LOG_PATH => correct_path($module_paths{$module} . "/$ENV{INPATH}/misc/logs/$log_name"), START_TIME => 0, FINISH_TIME => 0, CLIENT => '-' @@ -1315,16 +1277,16 @@ sub check_deps_hash { # Find project with no dependencies left. # sub find_indep_prj { - my ($Dependencies, $i); + my ($dependencies, $i); my @candidates = (); $all_dependent = 1; handle_dead_children(0) if ($processes_to_run); my $children = children_number(); return '' if (!$server_mode && $children && ($children >= $processes_to_run)); - $Dependencies = shift; - if (scalar keys %$Dependencies) { - foreach my $job (keys %$Dependencies) { - if (!scalar keys %{$$Dependencies{$job}}) { + $dependencies = shift; + if (scalar keys %$dependencies) { + foreach my $job (keys %$dependencies) { + if (!scalar keys %{$$dependencies{$job}}) { push(@candidates, $job); last if (!$processes_to_run); }; @@ -1366,56 +1328,55 @@ sub get_waiters_number { # # Check if given entry is HASH-native, that is not a user-defined data # -sub IsHashNative { - my $Prj = shift; - return 1 if ($Prj =~ /^HASH\(0x[\d | a | b | c | d | e | f]{6,}\)/); - return 0; -}; +#sub IsHashNative { +# my $prj = shift; +# return 1 if ($prj =~ /^HASH\(0x[\d | a | b | c | d | e | f]{6,}\)/); +# return 0; +#}; # # Getting array of dependencies from the string given # -sub GetDependenciesArray { - my ($DepString, @Dependencies, $ParentPrj, $prj, $string); - @Dependencies = (); - $DepString = shift; - $string = $DepString; +sub get_dependency_array { + my ($dep_string, @dependencies, $parent_prj, $prj, $string); + @dependencies = (); + $dep_string = shift; + $string = $dep_string; $prj = shift; - while ($DepString !~ /^NULL/o) { - print_error("Project $prj has wrongly written dependencies string:\n $string") if (!$DepString); - $DepString =~ /(\S+)\s*/o; - $ParentPrj = $1; - $DepString = $'; - if ($ParentPrj =~ /\.(\w+)$/o) { - $ParentPrj = $`; - if (($prj_platform{$ParentPrj} ne $1) && - ($prj_platform{$ParentPrj} ne 'all')) { - print_error ("$ParentPrj\.$1 is a wrongly dependency identifier!\nCheck if it is platform dependent"); + while ($dep_string !~ /^NULL/o) { + print_error("Project $prj has wrongly written dependencies string:\n $string") if (!$dep_string); + $dep_string =~ /(\S+)\s*/o; + $parent_prj = $1; + $dep_string = $'; + if ($parent_prj =~ /\.(\w+)$/o) { + $parent_prj = $`; + if (($prj_platform{$parent_prj} ne $1) && + ($prj_platform{$parent_prj} ne 'all')) { + print_error ("$parent_prj\.$1 is a wrongly dependency identifier!\nCheck if it is platform dependent"); }; - $AliveDependencies{$ParentPrj}++ if (CheckPlatform($1)); - push(@Dependencies, $ParentPrj); + $alive_dependencies{$parent_prj}++ if (check_platform($1)); + push(@dependencies, $parent_prj); } else { - if ((exists($prj_platform{$ParentPrj})) && - ($prj_platform{$ParentPrj} ne 'all') ) { - print_error("$ParentPrj is a wrongly used dependency identifier!\nCheck if it is platform dependent"); + if ((exists($prj_platform{$parent_prj})) && + ($prj_platform{$parent_prj} ne 'all') ) { + print_error("$parent_prj is a wrongly used dependency identifier!\nCheck if it is platform dependent"); }; - push(@Dependencies, $ParentPrj); + push(@dependencies, $parent_prj); }; }; - return @Dependencies; + return @dependencies; }; # # Getting current directory list # -sub GetDirectoryList { - my ($Path); - $Path = shift; - opendir(CurrentDirList, $Path); - @DirectoryList = readdir(CurrentDirList); +sub get_directory_list { + my $path = shift; + opendir(CurrentDirList, $path); + my @directory_list = readdir(CurrentDirList); closedir(CurrentDirList); - return @DirectoryList; + return @directory_list; }; sub print_error { @@ -1640,7 +1601,7 @@ sub get_options { }; if ($interactive) { $html++; # enable html page generation... - $local_host_name = hostname(); + my $local_host_name = hostname(); $local_host_ip = inet_ntoa(scalar(gethostbyname($local_host_name)) || 'localhost'); } # Default build modes(for OpenOffice.org) @@ -1701,14 +1662,14 @@ sub get_switch_options { # sub cancel_build { # close_server_socket(); - my $broken_modules_number = scalar @broken_modules_names; + my $broken_modules_number = scalar @broken_module_names; my $message_part = 'build '; if (scalar keys %incompatibles) { my @incompatible_modules = keys %incompatibles; if ($stop_build_on_error) { - $message_part .= "--from @incompatible_modules:@broken_modules_names\n"; + $message_part .= "--from @incompatible_modules:@broken_module_names\n"; } else { - $message_part .= "--from @broken_modules_names\n"; + $message_part .= "--from @broken_module_names\n"; }; } else { if ($processes_to_run) { @@ -1716,14 +1677,14 @@ sub cancel_build { } else { $message_part .= "--all:"; }; - $message_part .= "@broken_modules_names\n"; + $message_part .= "@broken_module_names\n"; }; if ($broken_modules_number && $build_all_parents) { print "\n"; print $broken_modules_number; print " module(s): "; - foreach (@broken_modules_names) { + foreach (@broken_module_names) { print "\n\t$_"; }; print "\nneed(s) to be rebuilt\n\nReason(s):\n\n"; @@ -1779,38 +1740,20 @@ sub handle_dead_children { my $try_once_more = 0; do { my $pid = 0; - if ($ENV{GUI} eq 'WNT' && !$cygwin) { - foreach $pid (keys %processes_hash) { - my $exit_code = undef; - my $proc_obj = $windows_procs{$pid}; - $proc_obj->GetExitCode($exit_code); - if ( $exit_code != 259 ) { - $try_once_more = store_error($pid, $exit_code); - delete $windows_procs{$pid}; - if ($try_once_more) { - give_second_chance($pid); - } else { - clear_from_child($pid); - }; - }; - }; - sleep 1 if (children_number() >= $processes_to_run || ($force_wait && ($running_children == children_number()))); + if (children_number() >= $processes_to_run || + ($force_wait && ($running_children == children_number()))) { + $pid = wait(); } else { - if (children_number() >= $processes_to_run || - ($force_wait && ($running_children == children_number()))) { - $pid = wait(); + $pid = waitpid( -1, &WNOHANG); + }; + if ($pid > 0) { + $try_once_more = store_error($pid, $?); + if ($try_once_more) { + give_second_chance($pid); } else { - $pid = waitpid( -1, &WNOHANG); - }; - if ($pid > 0) { - $try_once_more = store_error($pid, $?); - if ($try_once_more) { - give_second_chance($pid); - } else { - clear_from_child($pid); - }; - $finisched_children++; + clear_from_child($pid); }; + $finisched_children++; }; } while(children_number() >= $processes_to_run); }; @@ -1883,7 +1826,7 @@ sub build_dependent { mp_success_exit(); } else { if (dmake_dir($child_nick)) { - push(@broken_modules_names, $module_by_hash{$dependencies_hash}); + push(@broken_module_names, $module_by_hash{$dependencies_hash}); cancel_build(); }; }; @@ -1942,19 +1885,19 @@ sub store_pid { # Build everything that should be built multiprocessing version # sub build_multiprocessing { - my $Prj; + my $prj; do { my $got_module = 0; $finisched_children = 0; - while ($Prj = pick_prj_to_build(\%global_deps_hash)) { - if (!defined $projects_deps_hash{$Prj}) { - $projects_deps_hash{$Prj} = {}; - get_module_dep_hash($Prj, $projects_deps_hash{$Prj}); - my $info_hash = $html_info{$Prj}; - $$info_hash{DIRS} = check_deps_hash($projects_deps_hash{$Prj}, $Prj); - $module_by_hash{$projects_deps_hash{$Prj}} = $Prj; + while ($prj = pick_prj_to_build(\%global_deps_hash)) { + if (!defined $projects_deps_hash{$prj}) { + $projects_deps_hash{$prj} = {}; + get_module_dep_hash($prj, $projects_deps_hash{$prj}); + my $info_hash = $html_info{$prj}; + $$info_hash{DIRS} = check_deps_hash($projects_deps_hash{$prj}, $prj); + $module_by_hash{$projects_deps_hash{$prj}} = $prj; } - $module_build_queue{$Prj}++; + $module_build_queue{$prj}++; $got_module++; }; if (!$got_module) { @@ -1983,7 +1926,7 @@ sub build_multiprocessing { sub mp_success_exit { # close_server_socket(); # if (!$custom_job && $post_custom_job) { -# do_post_custom_job(CorrectPath($StandDir.$initial_module)); +# do_post_custom_job(correct_path($workspace_path.$initial_module)); # }; print "\nMultiprocessing build is finished\n"; print "Maximal number of processes run: $maximal_processes\n"; @@ -1999,8 +1942,7 @@ sub build_actual_queue { do { my @sorted_queue = sort {(scalar keys %{$projects_deps_hash{$a}}) <=> (scalar keys %{$projects_deps_hash{$b}})} keys %$build_queue; my $started_children = 0; -# foreach $Prj (@sorted_queue) { - foreach $Prj (keys %$build_queue) { + foreach my $prj (keys %$build_queue) { get_html_orders(); if ($reschedule_queue) { $reschedule_queue = 0; @@ -2013,19 +1955,19 @@ sub build_actual_queue { }; return; }; - if (defined $modules_with_errors{$projects_deps_hash{$Prj}} && !$ignore) { - push (@broken_modules_names, $Prj); - delete $$build_queue{$Prj}; + if (defined $modules_with_errors{$projects_deps_hash{$prj}} && !$ignore) { + push (@broken_module_names, $prj); + delete $$build_queue{$prj}; next; }; - $started_children += build_dependent($projects_deps_hash{$Prj}); - if ((!scalar keys %{$projects_deps_hash{$Prj}}) && - !$running_children{$projects_deps_hash{$Prj}}) { - if (!defined $modules_with_errors{$projects_deps_hash{$Prj}} || $ignore) + $started_children += build_dependent($projects_deps_hash{$prj}); + if ((!scalar keys %{$projects_deps_hash{$prj}}) && + !$running_children{$projects_deps_hash{$prj}}) { + if (!defined $modules_with_errors{$projects_deps_hash{$prj}} || $ignore) { - remove_from_dependencies($Prj, \%global_deps_hash); - $build_is_finished{$Prj}++; - delete $$build_queue{$Prj}; + remove_from_dependencies($prj, \%global_deps_hash); + $build_is_finished{$prj}++; + delete $$build_queue{$prj}; $finished_projects++; }; }; @@ -2044,6 +1986,7 @@ sub build_actual_queue { sub run_job { my ($job, $path, $registered_name) = @_; my $job_to_do = $job; + my $error_code = 0; print "$registered_name\n"; return 0 if ( $show ); $job_to_do = $deliver_command if ($job eq 'deliver'); @@ -2101,38 +2044,38 @@ sub do_custom_job { # Print announcement for module just started # sub announce_module { - my $Prj = shift; - $build_in_progress{$Prj}++; - print_announce($Prj); + my $prj = shift; + $build_in_progress{$prj}++; + print_announce($prj); }; sub print_announce { - my $Prj = shift; - return if (defined $module_announced{$Prj}); + my $prj = shift; + return if (defined $module_announced{$prj}); my $prj_type = ''; - $prj_type = $modules_types{$Prj} if (defined $modules_types{$Prj}); + $prj_type = $modules_types{$prj} if (defined $modules_types{$prj}); my $text; if ($prj_type eq 'lnk') { - if (!defined $active_modules{$Prj}) { - $text = "Skipping module $Prj\n"; + if (!defined $active_modules{$prj}) { + $text = "Skipping module $prj\n"; } else { - $text = "Skipping link to $Prj\n"; + $text = "Skipping link to $prj\n"; }; - $build_is_finished{$Prj}++; + $build_is_finished{$prj}++; } elsif ($prj_type eq 'img') { - $text = "Skipping incomplete $Prj\n"; - $build_is_finished{$Prj}++; + $text = "Skipping incomplete $prj\n"; + $build_is_finished{$prj}++; } elsif ($custom_job) { - $text = "Running custom job \"$custom_job\" in module $Prj\n"; + $text = "Running custom job \"$custom_job\" in module $prj\n"; } else { - $text = "Building module $Prj\n"; + $text = "Building module $prj\n"; }; my $announce_string = $new_line; $announce_string .= $echo . "=============\n"; $announce_string .= $echo . $text; $announce_string .= $echo . "=============\n"; print $announce_string; - $module_announced{$Prj}++; + $module_announced{$prj}++; }; sub are_all_dependent { @@ -2179,7 +2122,7 @@ sub modules_classify { # sub provide_consistency { check_dir(); - foreach $var_ref (\$build_all_cont, \$build_since) { + foreach my $var_ref (\$build_all_cont, \$build_since) { if ($$var_ref) { return if (defined $module_paths{$$var_ref}); print_error("Cannot find module '$$var_ref'", 9); @@ -2234,7 +2177,7 @@ sub clear_module { closedir(DIRHANDLE); foreach (@dir_content) { next if (/^\.+$/); - my $dir = CorrectPath($module_paths{$module}.'/'.$_); + my $dir = correct_path($module_paths{$module}.'/'.$_); if ((!-d $dir.'/.svn') && is_output_tree($dir)) { #print "I would delete $dir\n"; rmtree("$dir", 0, 1); @@ -2296,7 +2239,7 @@ sub retrieve_build_list { $solver_inc_dir .= '/inc'; $solver_inc_dir .= $ENV{UPDMINOREXT} if (defined $ENV{UPDMINOREXT}); $solver_inc_dir .= "/$module"; - $solver_inc_dir = CorrectPath($solver_inc_dir); + $solver_inc_dir = correct_path($solver_inc_dir); $dead_parents{$module}++; print "Fetching dependencies for module $module from solver..."; foreach (@possible_build_lists) { @@ -2323,7 +2266,7 @@ sub fix_permissions { }; sub prepare_build_from_with_branches { - ($full_deps_hash, $reversed_full_deps_hash) = @_; + my ($full_deps_hash, $reversed_full_deps_hash) = @_; foreach my $prerequisite (keys %$full_deps_hash) { foreach my $dependent_module (keys %incompatibles) { if (defined ${$$reversed_full_deps_hash{$prerequisite}}{$dependent_module}) { @@ -2418,7 +2361,7 @@ sub prepare_build_all_cont { $border_prj = $build_all_cont if ($build_all_cont); $border_prj = $build_since if ($build_since); while ($prj = pick_prj_to_build($deps_hash)) { - $orig_prj = ''; + my $orig_prj = ''; $orig_prj = $` if ($prj =~ /\.lnk$/o); $orig_prj = $` if ($prj =~ /\.link$/o); if (($border_prj ne $prj) && @@ -2497,7 +2440,7 @@ sub get_workspace_platforms { my $workspace_patforms = shift; my $solver_path = $ENV{SOLARVERSION}; opendir(SOLVERDIR, $solver_path); - @dir_list = readdir(SOLVERDIR); + my @dir_list = readdir(SOLVERDIR); close SOLVERDIR; foreach (@dir_list) { next if /^common/; @@ -2624,7 +2567,7 @@ sub read_ssolar_vars { my ($verswitch, $source_root, $cwsname); $verswitch = "-ver $ENV{UPDMINOR}" if (defined $ENV{UPDMINOR}); $source_root = '-sourceroot' if (defined $ENV{SOURCE_ROOT_USED}); - $cws_name = "-cwsname $ENV{CWS_WORK_STAMP}" if (defined $ENV{CWS_WORK_STAMP}); + my $cws_name = "-cwsname $ENV{CWS_WORK_STAMP}" if (defined $ENV{CWS_WORK_STAMP}); my $param = "-$ENV{WORK_STAMP} $verswitch $source_root $cws_name $pro $platform"; my $ss_command = "$perl $setsolar -file $tmp_file $param $nul"; @@ -2661,8 +2604,8 @@ sub get_solar_vars { sub get_current_module { my $module_name = shift; my $link_name = $module_name . '.lnk'; - $link_name .= '.link' if (-e $StandDir.$module_name . '.link'); - chdir $StandDir; + $link_name .= '.link' if (-e $workspace_path.$module_name . '.link'); + chdir $workspace_path; getcwd(); print "\nBreaking link to module $module_name"; my $result = rename $link_name, $module_name; @@ -2683,7 +2626,7 @@ sub check_dir { if (($current_module =~ /(\.lnk)$/) || ($current_module =~ /(\.link)$/)) { $current_module = $`; # we're dealing with a link => fallback to SOLARSRC under UNIX - $StandDir = $ENV{SOLARSRC}.'/'; + $workspace_path = $ENV{SOLARSRC}.'/'; get_current_module($current_module); return; } else { @@ -2736,9 +2679,9 @@ sub do_exit { if ( $^O eq 'os2' ) { # perl 5.10 returns 'resource busy' for rmtree - rmdir(CorrectPath($tmp_dir)) if ($tmp_dir); + rmdir(correct_path($tmp_dir)) if ($tmp_dir); } - rmtree(CorrectPath($tmp_dir), 0, 0) if ($tmp_dir); + rmtree(correct_path($tmp_dir), 0, 0) if ($tmp_dir); print STDERR "Cannot delete $tmp_dir. Please remove it manually\n" if (-d $tmp_dir); exit($exit_code); }; @@ -2755,7 +2698,7 @@ sub sort_modules_appearance { delete $build_in_progress{$_} if (defined $build_in_progress{$_}); delete $build_in_progress_shown{$_} if (defined $build_in_progress_shown{$_}); }; - @modules_order = sort keys %modules_with_errors; + my @modules_order = sort keys %modules_with_errors; foreach (keys %modules_with_errors) { delete $build_in_progress{$_} if (defined $build_in_progress{$_}); delete $build_is_finished{$_} if (defined $build_is_finished{$_}); @@ -3459,7 +3402,7 @@ sub run_server { print $new_socket_obj $job_string_base . $job_string; $clients_jobs{$pid} = $job_string; $clients_times{$pid} = time; - $children_running = children_number(); + my $children_running = children_number(); $verbose_mode && print 'Running processes: ', $children_running, "\n"; $maximal_processes = $children_running if ($children_running > $maximal_processes); } else { @@ -3541,23 +3484,23 @@ sub pick_jobdir { my $build_queue = shift; my $i = 0; foreach (@$build_queue) { - $Prj = $$build_queue[$i]; - my $prj_deps_hash = $projects_deps_hash{$Prj}; + my $prj = $$build_queue[$i]; + my $prj_deps_hash = $projects_deps_hash{$prj}; if (defined $modules_with_errors{$prj_deps_hash} && !$ignore) { - push (@broken_modules_names, $Prj); + push (@broken_module_names, $prj); splice (@$build_queue, $i, 1); next; }; $running_children{$prj_deps_hash} = 0 if (!defined $running_children{$prj_deps_hash}); - $child_nick = pick_prj_to_build($prj_deps_hash); + my $child_nick = pick_prj_to_build($prj_deps_hash); if ($child_nick) { return ($child_nick, $prj_deps_hash); } if ((!scalar keys %$prj_deps_hash) && !$running_children{$prj_deps_hash}) { if (!defined $modules_with_errors{$prj_deps_hash} || $ignore) { - remove_from_dependencies($Prj, \%global_deps_hash); - $build_is_finished{$Prj}++; + remove_from_dependencies($prj, \%global_deps_hash); + $build_is_finished{$prj}++; splice (@$build_queue, $i, 1); next; }; @@ -3568,16 +3511,16 @@ sub pick_jobdir { sub fill_modules_queue { my $build_queue = shift; - my $Prj; - while ($Prj = pick_prj_to_build(\%global_deps_hash)) { - push @$build_queue, $Prj; - $projects_deps_hash{$Prj} = {}; - get_module_dep_hash($Prj, $projects_deps_hash{$Prj}); - my $info_hash = $html_info{$Prj}; - $$info_hash{DIRS} = check_deps_hash($projects_deps_hash{$Prj}, $Prj); - $module_by_hash{$projects_deps_hash{$Prj}} = $Prj; - }; - if (!$Prj && !children_number() && (!scalar @$build_queue)) { + my $prj; + while ($prj = pick_prj_to_build(\%global_deps_hash)) { + push @$build_queue, $prj; + $projects_deps_hash{$prj} = {}; + get_module_dep_hash($prj, $projects_deps_hash{$prj}); + my $info_hash = $html_info{$prj}; + $$info_hash{DIRS} = check_deps_hash($projects_deps_hash{$prj}, $prj); + $module_by_hash{$projects_deps_hash{$prj}} = $prj; + }; + if (!$prj && !children_number() && (!scalar @$build_queue)) { cancel_build() if (scalar keys %broken_build); mp_success_exit(); }; diff --git a/solenv/bin/modules/SourceConfig.pm b/solenv/bin/modules/SourceConfig.pm index dfaa797d8f48..116a5e9fb893 100755 --- a/solenv/bin/modules/SourceConfig.pm +++ b/solenv/bin/modules/SourceConfig.pm @@ -388,7 +388,18 @@ sub add_active_repositories { sub add_active_modules { my $self = shift; - $self->{NEW_MODULES} = shift; + my $module_list_ref = shift; + my $ignored_modules_string = ''; + my @real_modules = (); + foreach my $module (sort @$module_list_ref) { + if ($self->get_module_path($module)) { + push(@real_modules, $module); + } else { + $ignored_modules_string .= " $module"; + }; + }; + push (@{$self->{WARNINGS}}, "\nWARNING: following modules are not found in active repositories, and have not been added to the " . $self->get_config_file_default_path() . ":$ignored_modules_string\n") if ($ignored_modules_string); + $self->{NEW_MODULES} = \@real_modules; croak('Empty module list passed for addition to source_config') if (!scalar @{$self->{NEW_MODULES}}); $self->{VERBOSE} = shift; generate_config_file($self); |