diff options
Diffstat (limited to 'solenv/bin')
35 files changed, 1751 insertions, 2472 deletions
diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl index 4613987737ef..f524ee07fce2 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); @@ -47,6 +48,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}) { @@ -58,24 +60,20 @@ $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 = "-"); @@ -87,100 +85,95 @@ # # ######################### - $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 - @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 %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_modules_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 + 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; - %jobs_hash = (); - $html_path = undef; - $build_finished = 0; - $html_file = ''; - %had_error = (); # hack for mysterious 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 - $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 $build_time = time; + my %jobs_hash = (); + my $html_path = undef; + my $build_finished = 0; + my $html_file = ''; + my %had_error = (); # hack for mysterious 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 + 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)... @@ -199,7 +192,7 @@ my $clear_config = 0; my $finished_children = 0; my $debug = 0; - %module_deps_hash_pids = (); + my %module_deps_hash_pids = (); my @argv = @ARGV; my $source_config_file; my $zenity_pid = 0; @@ -208,6 +201,16 @@ my $zenity_err = ''; my $verbose = 0; + 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(); @@ -216,10 +219,9 @@ zenity_tooltip("Starting build."); get_build_modes(); - %deliver_env = (); + my %deliver_env = (); if ($prepare) { get_platforms(\%platforms); - @modules_built = (); $deliver_env{'BUILD_SOSL'}++; $deliver_env{'COMMON_OUTDIR'}++; @@ -229,14 +231,15 @@ $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); + check_partial_gnumake_build($initial_module); 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"); }; @@ -252,16 +255,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 || $verbose); $deliver_command .= ' '. $dlv_switch if ($dlv_switch); $ENV{mk_tmp}++; - %prj_platform = (); - $check_error_string = ''; - $dmake = ''; - $dmake_args = ''; - $echo = ''; - $new_line = "\n"; get_commands(); unlink ($cmd_file); @@ -305,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); }; @@ -362,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 @@ -544,7 +540,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; @@ -554,7 +550,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}; }; @@ -577,9 +573,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); }; }; }; @@ -646,7 +642,7 @@ sub reverse_dependencies { # 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}++; @@ -661,7 +657,9 @@ sub build_all { prepare_build_from_with_branches(\%global_deps_hash, \%reversed_full_deps_hash); } if ($build_all_cont || $build_since) { + store_weights(\%global_deps_hash); prepare_build_all_cont(\%global_deps_hash); + %weights_hash = (); }; if ($generate_config) { %add_to_config = %global_deps_hash; @@ -669,11 +667,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) { @@ -692,26 +690,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); @@ -731,7 +729,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; }; @@ -792,6 +790,7 @@ sub dmake_dir { html_store_job_info(\%local_deps_hash, $job_name, $error_code) if (!$child); }; + if ($error_code && $ignore) { push(@ignored_errors, $job_name); $error_code = 0; @@ -808,6 +807,7 @@ sub dmake_dir { }; _exit(0); } elsif ($error_code && ($error_code != -1)) { + $broken_build{$job_name} = $error_code; return $error_code; }; }; @@ -896,8 +896,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})) { @@ -928,7 +928,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) { @@ -958,37 +958,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, $_); @@ -1005,15 +1005,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}; +# }; }; }; - 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); @@ -1032,7 +1032,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} = {}; @@ -1054,15 +1054,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; }; }; @@ -1082,7 +1082,7 @@ sub mark_platform { # Convert path from abstract (with '\' and/or '/' delimiters) # to system-independent # -sub CorrectPath { +sub correct_path { $_ = shift; s/\\/\//g; return $_; @@ -1128,50 +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"; - return $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; }; @@ -1180,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}); }; }; @@ -1209,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++; @@ -1244,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 => '-' @@ -1277,16 +1277,19 @@ 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) { - push(@candidates, $job) 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); + }; }; if (scalar @candidates) { $all_dependent = 0; @@ -1325,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 { @@ -1600,7 +1602,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) @@ -1662,12 +1664,12 @@ sub get_switch_options { sub cancel_build { my $broken_modules_number = scalar @broken_modules_names; - print "\n"; - print "-----------------------------------------------------------------------\n"; - print " Oh dear - something failed during the build - sorry !\n"; - print " For more help with debugging build errors, please see the section in:\n"; - print " http://wiki.documentfoundation.org/Development\n"; - print "\n"; + print STDERR "\n"; + print STDERR "-----------------------------------------------------------------------\n"; + print STDERR " Oh dear - something failed during the build - sorry !\n"; + print STDERR " For more help with debugging build errors, please see the section in:\n"; + print STDERR " http://wiki.documentfoundation.org/Development\n"; + print STDERR "\n"; if (!$broken_modules_number || !$build_all_parents) { while (children_number()) { @@ -1676,34 +1678,34 @@ sub cancel_build { } if (keys %broken_build) { - print " internal build errors:\n\n"; + print STDERR " internal build errors:\n\n"; foreach (keys %broken_build) { - print "ERROR: error " . $broken_build{$_} . " occurred while making $_\n"; + print STDERR "ERROR: error " . $broken_build{$_} . " occurred while making $_\n"; }; - print "\n"; + print STDERR "\n"; } my $module = shift @broken_modules_names; if ($broken_modules_number > 1) { - print " it seems you are using a threaded build, which means that the\n"; - print " actual compile error is probably hidden far above, and could be\n"; - print " inside any of these other modules:\n"; - print " @broken_modules_names\n"; - print " please re-run build inside each one to isolate the problem.\n"; + print STDERR " it seems you are using a threaded build, which means that the\n"; + print STDERR " actual compile error is probably hidden far above, and could be\n"; + print STDERR " inside any of these other modules:\n"; + print STDERR " @broken_modules_names\n"; + print STDERR " please re-run build inside each one to isolate the problem.\n"; } else { - print " it seems that the error is inside '$module', please re-run build\n"; - print " inside this module to isolate the error and/or test your fix:\n"; + print STDERR " it seems that the error is inside '$module', please re-run build\n"; + print STDERR " inside this module to isolate the error and/or test your fix:\n"; } - print "-----------------------------------------------------------------------\n"; - print "\n"; - print "rm -Rf " . $ENV{'SRC_ROOT'} . "/$module/" . $ENV{'INPATH'} . " # optional module 'clean'\n"; - print "" . $ENV{'OOO_SHELL'} . "\n"; - print "cd " . $ENV{'SRC_ROOT'} . "\n"; - print "source ./" . $ENV{'ENV_SCRIPT'} . "\n"; - print "cd $module\n"; - print "build\n"; - print "\n"; - print "when the problem is isolated and fixed exit and re-run 'make' from the top-level\n"; + print STDERR "-----------------------------------------------------------------------\n"; + print STDERR "\n"; + print STDERR "rm -Rf " . $ENV{'SRC_ROOT'} . "/$module/" . $ENV{'INPATH'} . " # optional module 'clean'\n"; + print STDERR "" . $ENV{'OOO_SHELL'} . "\n"; + print STDERR "cd " . $ENV{'SRC_ROOT'} . "\n"; + print STDERR "source ./" . $ENV{'ENV_SCRIPT'} . "\n"; + print STDERR "cd $module\n"; + print STDERR "build\n"; + print STDERR "\n"; + print STDERR "when the problem is isolated and fixed exit and re-run 'make' from the top-level\n"; zenity_message("LibreOffice Build Failed!"); zenity_close(); @@ -1752,38 +1754,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); - }; - $finished_children++; + clear_from_child($pid); }; + $finished_children++; }; } while(children_number() >= $processes_to_run); }; @@ -1915,19 +1899,19 @@ sub store_pid { # Build everything that should be built multiprocessing version # sub build_multiprocessing { - my $Prj; + my $prj; do { my $got_module = 0; $finished_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) { @@ -1968,7 +1952,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 (keys %$build_queue) { + foreach my $prj (keys %$build_queue) { get_html_orders(); if ($reschedule_queue) { $reschedule_queue = 0; @@ -1981,19 +1965,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_modules_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++; }; }; @@ -2012,6 +1996,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'); @@ -2057,7 +2042,7 @@ sub do_custom_job { }; if ($error_code) { $modules_with_errors{$dependencies_hash}++; - $broken_build{$module} = $error_code; +# $broken_build{$module_job} = $error_code; } else { remove_from_dependencies($module_job, $dependencies_hash); }; @@ -2070,31 +2055,31 @@ 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"; @@ -2104,7 +2089,7 @@ sub print_announce { my $total_modules = scalar(keys %build_lists_hash); my $modules_started = scalar(keys %module_announced) + 1; zenity_tooltip("($modules_started/$total_modules) $text"); - $module_announced{$Prj}++; + $module_announced{$prj}++; }; sub zenity_enabled { @@ -2194,7 +2179,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 +2219,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)) { rmtree("$dir", 0, 1); if (-d $dir) { @@ -2289,28 +2274,24 @@ sub retrieve_build_list { my $old_fh = select(STDOUT); # Try to get global depencies from solver's build.lst if such exists - my $solver_inc_dir = "$ENV{SOLARVER}/common"; + my $solver_inc_dir = "$ENV{SOLARVER}/$ENV{INPATH}"; $solver_inc_dir .= $ENV{PROEXT} if (defined $ENV{PROEXT}); $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) { - my $possible_build_lst = "$solver_inc_dir/$_"; - if (-e $possible_build_lst) { + foreach my $onelist (@possible_build_lists) { + my $build_list_candidate = "$solver_inc_dir/$onelist"; + if (-e $build_list_candidate) { print " ok\n"; select($old_fh); - return $possible_build_lst; + return $build_list_candidate; }; } - print " failed\n"; - - if (!defined $dead_parents{$module}) { - print "WARNING: Cannot figure out CWS for $module. Forgot to set CWS?\n"; - } - select($old_fh); + print(" failed\n"); + print_error("incomplete dependencies!\n"); return undef; }; @@ -2321,7 +2302,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}) { @@ -2415,7 +2396,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) && @@ -2573,7 +2554,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"; @@ -2610,8 +2591,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; @@ -2632,7 +2613,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 { @@ -2684,9 +2665,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); }; @@ -2703,7 +2684,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{$_}); @@ -3390,7 +3371,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 { @@ -3470,23 +3451,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_modules_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; }; @@ -3497,17 +3478,34 @@ 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(); }; }; + +sub is_gnumake_module { + my $module = shift; + my $bridgemakefile = $source_config->get_module_path($module) . "/prj/makefile.mk"; + return (-e $bridgemakefile); +} + +sub check_partial_gnumake_build { + if(!$build_all_parents && is_gnumake_module(shift)) { + print "This module has been migrated to GNU make.\n"; + print "You can only use build --all/--since here with build.pl.\n"; + print "To do the equivalent of 'build && deliver' call:\n"; + print "\tmake -sr\n"; + print "in the module root (This will modify the solver).\n"; + exit 1; + } +} diff --git a/solenv/bin/buildalyzer b/solenv/bin/buildalyzer new file mode 100644 index 000000000000..8b278e66b8e6 --- /dev/null +++ b/solenv/bin/buildalyzer @@ -0,0 +1,138 @@ +#!/usr/bin/env python +import sys +import os + +class CxxTarget: + def __init__(self, line): + self.directory = '' + self.outputfile = '' + self.includeflags = [] + self.cxxflags = [] + self.inputfiles = [] + self.nolink = False + options = line[:-1].split(' ') + self.directory = options.pop(0) + parsing_outputfile = False + for option in options: + if parsing_outputfile: + self.outputfile = option + parsing_outputfile = False + elif option == '-o': + parsing_outputfile = True + elif option == '-c': + self.nolink = True + elif option.startswith('-I'): + self.includeflags.append(CxxFlag(option)) + elif option.startswith('-'): + self.cxxflags.append(CxxFlag(option)) + else: + self.inputfiles.append(option) + self.cxxflags.sort() + self.includeflags.sort() + cxxflags_tmp = dict() + for flag in self.cxxflags: + cxxflags_tmp[flag.name] = flag + self.cxxflags = cxxflags_tmp.values() + includeflags_tmp = dict() + for flag in self.includeflags: + includeflags_tmp[flag.name] = flag + self.includeflags = includeflags_tmp.values() + CxxTargets.by_name[self.getFullOutputname()] = self + def __str__(self): + return '%s' % (self.getFullOutputname()) + def getFullOutputname(self): + return self.directory + '/' + self.outputfile + def __cmp__(self, other): + return cmp(self.getFullOutputname(), other.getFullOutputname()) + +class CxxFlag: + def __init__(self, name): + self.name = name + CxxFlags.by_name[self.name] = self + def __str__(self): + return 'Flag %s' % (self.name) + def __cmp__(self, other): + return cmp(self.name, other.name) + +class CxxFlags: + by_name = dict() + +class CxxTargets: + by_name = dict() + +if __name__ == '__main__': + [CxxTarget(line) for line in sys.stdin.readlines()] + compile_targets = [target for target in CxxTargets.by_name.values() if target.nolink] + link_targets = [target for target in CxxTargets.by_name.values() if not target.nolink] + common_compile_flags = [] + for flag in CxxFlags.by_name.values(): + if sum((flag in target.cxxflags for target in compile_targets)) == len(compile_targets): + common_compile_flags.append(flag) + common_link_flags = [] + for flag in CxxFlags.by_name.values(): + if sum((flag in target.cxxflags for target in compile_targets)) == len(compile_targets): + common_link_flags.append(flag) + + for target in compile_targets: + target.cxxflags = [flag for flag in target.cxxflags if flag not in common_compile_flags] + target.cxxflags.sort() + for target in link_targets: + target.cxxflags = [flag for flag in target.cxxflags if flag not in common_link_flags] + target.cxxflags.sort() + + common_compile_flags.sort() + common_link_flags.sort() + print 'common compile flags: %s' % (' '.join(flag.name for flag in common_compile_flags)) + print 'common link flags: %s' % (' '.join(flag.name for flag in common_link_flags)) + + by_flagset = dict() + for target in CxxTargets.by_name.values(): + flagset = ' '.join((flag.name for flag in target.cxxflags)) + if flagset not in by_flagset: + by_flagset[flagset] = list() + by_flagset[flagset].append(target) + for targetlist in by_flagset.values(): + targetlist.sort() + flagsets = by_flagset.keys() + flagsets.sort() + print '%d compilerflag groups:' % (len(flagsets)) + for flagset in flagsets: + print flagset + for target in by_flagset[flagset]: + print '%s' % (target) + print + + by_flagset = dict() + for target in CxxTargets.by_name.values(): + flagset = ' '.join((flag.name for flag in target.includeflags)) + if flagset not in by_flagset: + by_flagset[flagset] = list() + by_flagset[flagset].append(target) + for targetlist in by_flagset.values(): + targetlist.sort() + flagsets = by_flagset.keys() + flagsets.sort() + print '%d include flag groups:' % (len(flagsets)) + for flagset in flagsets: + print flagset + for target in by_flagset[flagset]: + print '%s' % (target) + print + + print 'sources:' + by_name = dict() + for target in CxxTargets.by_name.values(): + by_name[os.path.basename(target.outputfile)] = target + names = by_name.keys() + names.sort() + for target in CxxTargets.by_name.values(): + if len(target.inputfiles) > 1: + objects = [os.path.basename(object) for object in target.inputfiles] + sources = list() + for object in objects: + if object in by_name: + sources.append(by_name[object].inputfiles[0]) + else: + sources.append('!!!!' + object) + sources.sort() + print '%s %s' % (target.getFullOutputname(), ' '.join(sources)) diff --git a/solenv/bin/createcomponent.xslt b/solenv/bin/createcomponent.xslt new file mode 100644 index 000000000000..7f7695d533b3 --- /dev/null +++ b/solenv/bin/createcomponent.xslt @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:uc="http://openoffice.org/2010/uno-components"> + <xsl:param name="uri"/> + <xsl:strip-space elements="*"/> + <xsl:template match="uc:component"> + <xsl:copy> + <xsl:apply-templates select="@*"/> + <xsl:attribute name="uri"> + <xsl:value-of select="$uri"/> + </xsl:attribute> + <xsl:apply-templates/> + </xsl:copy> + </xsl:template> + <xsl:template match="*"> + <xsl:copy> + <xsl:apply-templates select="@*"/> + <xsl:apply-templates/> + </xsl:copy> + </xsl:template> + <xsl:template match="@*"> + <xsl:copy/> + </xsl:template> +</xsl:stylesheet> diff --git a/solenv/bin/deliver.pl b/solenv/bin/deliver.pl index 898dd97a1dc7..0a945bc4e408 100755 --- a/solenv/bin/deliver.pl +++ b/solenv/bin/deliver.pl @@ -43,7 +43,7 @@ use File::Spec; ( $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/; -$id_str = ' $Revision$ '; +$id_str = ' $Revision: 275594 $ '; $id_str =~ /Revision:\s+(\S+)\s+\$/ ? ($script_rev = $1) : ($script_rev = "-"); @@ -403,6 +403,8 @@ sub parse_options { my $arg; my $dontdeletecommon = 0; + $opt_silent = 1 if ( defined $ENV{VERBOSE} && $ENV{VERBOSE} eq 'FALSE'); + $opt_verbose = 1 if ( defined $ENV{VERBOSE} && $ENV{VERBOSE} eq 'TRUE'); while ( $arg = shift @ARGV ) { $arg =~ /^-force$/ and $opt_force = 1 and next; $arg =~ /^-check$/ and $opt_check = 1 and $opt_verbose = 1 and next; @@ -422,15 +424,13 @@ sub parse_options } $dest = $arg; } - $opt_silent = 1 if ( !defined $ENV{VERBOSE} || (defined $ENV{VERBOSE} && $ENV{VERBOSE} eq 'FALSE')) && ( ! $opt_verbose ); - $opt_verbose = 1 if ( defined $ENV{VERBOSE} && $ENV{VERBOSE} eq 'TRUE') && ( ! $opt_silent ); # $dest and $opt_zip or $opt_delete are mutually exclusive if ( $dest and ($opt_zip || $opt_delete) ) { usage(1); } # $opt_silent and $opt_check or $opt_verbose are mutually exclusive if ( ($opt_check or $opt_verbose) and $opt_silent ) { - print STDERR "Error on command line: options '-check'/'-verbose' and '-quiet' are mutually exclusive.\n"; + print STDERR "Error on command line: options '-check' and '-quiet' are mutually exclusive.\n"; usage(1); } if ($dontdeletecommon) { @@ -678,6 +678,12 @@ sub glob_line } else { # no globbing but renaming possible + # #i89066# + if (-d $to && -f $from) { + my $filename = File::Basename::basename($from); + $to .= '/' if ($to !~ /[\\|\/]$/); + $to .= $filename; + }; push(@globbed_files, [$from, $to]); } if ( $opt_checkdlst ) { @@ -782,11 +788,6 @@ sub copy_if_newer if ( $opt_delete ) { print "REMOVE: $to\n" if $opt_verbose; $rc = unlink($to) unless $opt_check; - # handle special packaging of *.dylib files for Mac OS X - if ( $to =~ s/\.dylib$/.jnilib/ ) { - print "REMOVE: $to\n" if $opt_verbose; - $rc += unlink "$to" unless $opt_check; - } return 1 if $opt_check; return $rc; } @@ -851,19 +852,6 @@ sub copy_if_newer # handle special packaging of *.dylib files for Mac OS X if ( $^O eq 'darwin' ) { - if ( $to =~ /\.dylib/ ) { - system("macosx-create-bundle", $to); - my $bundlelib = $to; - $bundlelib =~ s/\.dylib$//; - $bundlelib .= ".jnilib"; - if ( $opt_delete ) { - print "REMOVE: $bundlelib\n" if $opt_verbose; - unlink "$bundlelib" unless $opt_check; - } else { - push_on_ziplist($bundlelib) if $opt_zip; - push_on_loglist("LINK", basename($to), "$bundlelib") if $opt_log; - } - } system("macosx-create-bundle", "$to=$from.app") if ( -d "$from.app" ); system("ranlib", "$to" ) if ( $to =~ /\.a/ ); } diff --git a/solenv/bin/linkoo b/solenv/bin/linkoo index 297a736dfb75..3b09dcf8295a 100755 --- a/solenv/bin/linkoo +++ b/solenv/bin/linkoo @@ -251,7 +251,7 @@ sub scan_and_link_files($$$) } # Now scan the solver - my $upd = 330; + my $upd = 300; $upd = $ENV{UPD} if (defined $ENV{UPD}); scan_one_dir ($installed_files, \%build_files, "$build_path/solver/$upd/$target", 1); diff --git a/solenv/bin/macosx-change-install-names.pl b/solenv/bin/macosx-change-install-names.pl index 844c36f23c2b..52b2ffa343ec 100644 --- a/solenv/bin/macosx-change-install-names.pl +++ b/solenv/bin/macosx-change-install-names.pl @@ -60,6 +60,18 @@ sub action($$$) 'Usage: app|shl|extshl UREBIN|URELIB|OOO|SDK|BRAND|OXT|BOXT|NONE <filepath>*'; $type = shift @ARGV; $loc = shift @ARGV; +if ($type eq "SharedLibrary") +{ + $type = "shl"; +} +if ($type eq "Executable") +{ + $type = "app" +} +if ($type eq "Library") +{ + $type = "shl" +} if ($type eq "extshl") { $type = "shl"; diff --git a/solenv/bin/macosx-create-bundle b/solenv/bin/macosx-create-bundle index ba7d624e68f3..4b03e076f3ae 100755 --- a/solenv/bin/macosx-create-bundle +++ b/solenv/bin/macosx-create-bundle @@ -96,7 +96,7 @@ while [ $# != 0 ]; do # Link jnilib ln -sf "$inputfilename" "$outputdir/$inputjnilibname" - printf "macosx-create-bundle: $outputdir/$inputjnilibname successfully created\n" + #printf "macosx-create-bundle: $outputdir/$inputjnilibname successfully created\n" fi else printf "macosx-create-bundle: error: file is not an executable or shared library.\n" >&2 diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl index 955873c21f76..e46ffdf28662 100644 --- a/solenv/bin/make_installer.pl +++ b/solenv/bin/make_installer.pl @@ -54,11 +54,9 @@ use installer::packagepool; use installer::parameter; use installer::pathanalyzer; use installer::profiles; -use installer::regmerge; use installer::scppatchsoname; use installer::scpzipfiles; use installer::scriptitems; -use installer::servicesfile; use installer::setupscript; use installer::simplepackage; use installer::sorter; @@ -905,43 +903,6 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::worker::resolving_hidden_flag($filesinproductlanguageresolvedarrayref, $allvariableshashref, "File", $languagestringref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles13c.log", $filesinproductlanguageresolvedarrayref); } - ##################################### - # Creating services.rdb - ##################################### - - if ( $allvariableshashref->{'SERVICESPROJEKT'} ) - { - if (! $installer::globals::languagepack && ! $installer::globals::helppack) - { - # ATTENTION: For creating the services.rdb it is necessary to execute the native file - # "regcomp" or "regcomp.exe". Therefore this function can only be executed on the - # corresponding platform. - - if ( $installer::globals::servicesrdb_can_be_created ) - { - installer::logger::print_message( "... creating preregistered services.rdb ...\n" ); - - installer::servicesfile::create_services_rdb($allvariableshashref, $filesinproductlanguageresolvedarrayref, $includepatharrayref, $languagestringref); - if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles14.log", $filesinproductlanguageresolvedarrayref); } - } - } - } - - ##################################### - # Calls of regmerge - ##################################### - - if (!($installer::globals::is_copy_only_project)) - { - if (! $installer::globals::languagepack && ! $installer::globals::helppack) - { - installer::logger::print_message( "... merging files into registry database ...\n" ); - - installer::regmerge::merge_registration_files($filesinproductlanguageresolvedarrayref, $includepatharrayref, $languagestringref, $allvariableshashref); - if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles14b.log", $filesinproductlanguageresolvedarrayref); } - } - } - ############################################ # Collecting directories for epm list file ############################################ @@ -2039,7 +2000,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::windows::registry::create_registry_table($registryitemsinproductlanguageresolvedarrayref, \@allregistrycomponents, $newidtdir, $languagesarrayref, $allvariableshashref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "registryitems4.log", $registryitemsinproductlanguageresolvedarrayref); } - installer::windows::component::create_component_table($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, \@allfilecomponents, \@allregistrycomponents, $newidtdir, $componentid, $componentidkeypath); + installer::windows::component::create_component_table($filesinproductlanguageresolvedarrayref, $registryitemsinproductlanguageresolvedarrayref, $directoriesforepmarrayref, \@allfilecomponents, \@allregistrycomponents, $newidtdir, $componentid, $componentidkeypath, $allvariableshashref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles19.log", $filesinproductlanguageresolvedarrayref); } if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "registryitems5.log", $registryitemsinproductlanguageresolvedarrayref); } @@ -2250,6 +2211,7 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::logger::print_message( "... creating msi database (language $onelanguage) ... \n" ); installer::windows::msiglobal::set_uuid_into_component_table($languageidtdir, $allvariableshashref); # setting new GUID for the components using the tool uuidgen.exe + installer::windows::msiglobal::prepare_64bit_database($languageidtdir, $allvariableshashref); # making last 64 bit changes installer::windows::msiglobal::create_msi_database($languageidtdir ,$msifilename); # validating the database # ToDo diff --git a/solenv/bin/mhids.pl b/solenv/bin/mhids.pl deleted file mode 100644 index a1325032849c..000000000000 --- a/solenv/bin/mhids.pl +++ /dev/null @@ -1,384 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -my $filename; -my $srs; -my $prjname; -my $defs; -my $solarincludes; -my $verbose = 0; - -my $debug = 0; -my $filebase; -my $workfile; -my $shell_workfile; -my @cleanuplist = (); - -# variables to setup the compiler line -my $appext; -my $compiler; -my $outbin_flag; -my $outobj_flag; -my $objext; -my $preprocess_flag; # preprocess to stdout - -my $no_hid_files; - -sub cleandie -{ - my $errstring = shift @_; - my $erroreval = $@; - - print STDERR "$errstring\n"; - if ( not $debug ) { - foreach my $i (@cleanuplist) { - if ( -f "$workfile$i" ) { - unlink "$workfile$i" or print STDERR "ERROR - couldn't remove $workfile$i\n"; - } - } - } - die "$erroreval\n"; -} - -sub setcompiler -{ - my $whichcom = $ENV{COM}; - my $extra_cflags = $ENV{EXTRA_CFLAGS}; - $extra_cflags = "" if (!$extra_cflags); - if ( "$whichcom" eq "GCC" ) { - $appext = ""; # windows for now - $compiler = "gcc -x c $extra_cflags"; - $outbin_flag = "-o "; - $outobj_flag = ""; - $objext = ".o"; - $preprocess_flag = "-E"; # preprocess to stdout - } elsif ( "$whichcom" eq "MSC" ) { - $appext = ".exe"; # windows for now - $compiler = "cl -nologo"; - $outbin_flag = "-Fe"; - $outobj_flag = "-Fo"; - $objext = ".obj"; - $preprocess_flag = "-EP"; # preprocess to stdout - $solarincludes =~ s/\/stl/\/xstlx/g; - $defs =~ s/\/stl/\/xstlx/g; - } elsif ( "$whichcom" eq "C52" ) { - $appext = ""; # windows for now - $compiler = "cc"; - $outbin_flag = "-o "; - $outobj_flag = ""; - $objext = ".o"; - $preprocess_flag = "-E"; # preprocess to stdout - - # hack for SO cc wrapper - $ENV{wrapper_override_cc_wrapper} = "TRUE"; - $solarincludes =~ s/stl/xstlx/g; - $defs =~ s/\/stl/\/xstlx/g; - } else { - print STDERR "----------------------------------------------------------------------\n"; - print STDERR "OOops... looks like your compiler isn't known to \n$0\n"; - print STDERR "please edit the \"setcompiler\" section of this script to make it work.\n"; - print STDERR "----------------------------------------------------------------------\n"; - die "ERROR - compiler (or \$COM settings) unknown!\n"; - } -} - -#--------------------------------------------------- -$filename = undef; -$srs = undef; -$prjname = undef; - -my @expectedArgs = ( \$filename, \$srs, \$prjname ); -my $expectedArgsIndex = 0; -while ( ( $#ARGV >= 0 ) && ( $expectedArgsIndex < 3 ) ) -{ - $_ = shift @ARGV; - if ( /^-verbose$/ ) - { - $verbose = 1; - next; - } - ${$expectedArgs[ $expectedArgsIndex ]} = $_; - ++$expectedArgsIndex; -} - -$defs = join " ",@ARGV if ($#ARGV); - -if ( !defined $prjname ) { die "ERROR - check usage\n"; } - -if ( $ENV{NO_HID_FILES} ) { - $no_hid_files = $ENV{"NO_HID_FILES"}; -} -$solarincludes = $ENV{SOLARINCLUDES}; -if (defined $ENV{TMPDIR}) { - $tmpdir = $ENV{TMPDIR}; -} elsif (defined $ENV{TMP}) { - $tmpdir = $ENV{TMP}; -} else { - die "ERROR - \"TMPDIR\" & \"TMP\" environment variables not set\n"; -}; -die "ERROR - \"$tmpdir\" doesn't exist\n" if ( ! -d $tmpdir ); - -setcompiler(); - -# convert windows only? -$srs =~ s/\\/\//g; -$filename =~ s/\\/\//g; - -$filebase = $filename; -$filebase =~ s/.*[\\\/]//; -$filebase =~ s/\..*?$//; -# now stript it to something that doesn't togger vista execution prevention :( -$flbs = $filebase; -$flbs =~ s/[aeiou]//g; -# call srand ony once per script! -srand(); -$workfile = "$tmpdir/${flbs}_".$$.rand(); - -# now get $workfile ready for shell usage... -$shell_workfile = $workfile; - -print "workfile: $workfile\n" if $verbose; - -#remove old objects which remained in place by a former bug -unlink "$workfile.obj"; - -# can't do this for modules with mixed case! - -if ( -f "$workfile.hid" ) -{ - unlink "$workfile.hid" or die "ERRROR - cannot remove $workfile.hid\n"; -} - -# hack to quit for files which cannot be handled -if ( defined $ENV{"NO_HID_FILES"} ) { - foreach $fname ( split / /, $ENV{"NO_HID_FILES"} ) - { - if ( $fname eq $filename ) - { - print "No hid generation for $filename due to NO_HID_FILES\n"; - print "Touching $srs/$filebase.hid anyways\n"; - open TOUCH, ">$srs/$filebase.hid" or die "ERRROR - cannot open $srs/$filebase.hid for writing\n"; - close TOUCH; - exit 0; - } - } -} - -my $verboseSwitch = $verbose ? "-verbose" : ""; -print "$ENV{SOLARBINDIR}/hidc $verboseSwitch $filename ${shell_workfile}.c1 $prjname\n" if $verbose; -$ret = system "$ENV{SOLARBINDIR}/hidc $verboseSwitch $filename ${shell_workfile}.c1 $prjname"; -if ( $ret ) { - push @cleanuplist, ".c1"; - cleandie("ERROR - calling \"hidc\" failed"); -} -push @cleanuplist, ".c1"; - -print "$compiler $defs $solarincludes $preprocess_flag ${shell_workfile}.c1 > ${shell_workfile}.c2\n" if $verbose; -$ret = system "$compiler $defs $solarincludes $preprocess_flag ${shell_workfile}.c1 > ${shell_workfile}.c2"; -if ( $ret ) { - push @cleanuplist, ".c2"; - cleandie("ERROR - calling compiler for preprocessing failed"); -} -push @cleanuplist, ".c2"; - -if (!open C_PROG, ">$workfile.c") { - push @cleanuplist, ".c"; - cleandie("ERROR - open $workfile.c\n for writing failed"); -} -push @cleanuplist, ".c"; -print C_PROG "#include <stdio.h>\n"; -print C_PROG "#include <wctype.h>\n"; - -if ( !open PRE, "<$workfile.c2" ) { - cleandie("ERROR - open $workfile.c2\n for reading failed"); -} - -$InMain = 0; -while (<PRE>) -{ - if ( /int\s*main/ ) - { - $InMain = 1; - } - - if ( $InMain && !/^\s*$/ ) - { - print C_PROG; - } -} - -close PRE; -close C_PROG; - -#cl %SOLARINCLUDES% %_srs%\%_workfile%.c /Fe%_srs%\%_workfile%$appext -my $outobj_param = ""; -if ( $outobj_flag ne "" ) -{ - $outobj_param = "$outobj_flag${shell_workfile}$objext"; -} -print "$compiler $defs $solarincludes ${shell_workfile}.c $outobj_param $outbin_flag${shell_workfile}$appext \n" if $verbose; -$ret = system "$compiler $defs $solarincludes ${shell_workfile}.c $outobj_param $outbin_flag${shell_workfile}$appext"; -if ( $ret ) { - push @cleanuplist, "$appext"; - cleandie("ERROR - compiling $workfile.c failed"); -} -push @cleanuplist, "$objext"; -push @cleanuplist, "$appext"; - -#awk -f %ENV_TOOLS%\hidcode.awk < %srs%\%workfile%.c3 > %srs%\%workfile%.hid -if ( !open C3,"$workfile$appext|" ) { - cleandie("ERROR - executing $workfile$appext failed"); -} -if ( !open HID,">$srs/$filebase.hid.$ENV{INPATH}" ) { - cleandie("ERROR - open $srs/$filebase.hid.$ENV{INPATH} for writing failed"); -} - -while (<C3>) -{ - @fields = split /\s+/; - - if ( $fields[1] eq "HelpID" ) - { - print HID "$fields[0] $fields[2]\n"; - next; - } - - @arr = split /:/, $fields[0]; - if( $arr[1] =~ /^leer$|^bitmap$|^font$|^color$|^image$|^imagelist$|^date$|^brush$|^fixedtext$|^keycode$|^time$|^mapmode$/i ) - { - next; - } - - if ( $fields[1] eq "Norm" ) - { - # Felder der Zeile auf Variable verteilen - $helpIDString = $fields[0]; - $GClass = lc($fields[2]); - $GID = $fields[3]; - $LClass = lc($fields[4]); - $LID = $fields[5] || 0; - - $nHID=0; - - $VAL1 = 536870912; #2 hoch 29 - if ( $GClass eq "workwindow" ) { $nHID= $VAL1 *5; } - elsif( $GClass eq "modelessdialog" ) { $nHID= $VAL1 *4; } - elsif( $GClass eq "floatingwindow" ) { $nHID= $VAL1 *3; } - elsif( $GClass eq "modaldialog" ) { $nHID= $VAL1 *2; } - elsif( $GClass eq "tabpage" ) { $nHID= $VAL1 *1; } - elsif( $GClass eq "dockingwindow" ) { $nHID= $VAL1 *6; } - #Maximal bis 7 dann sind 32Bit ausgeschoepft - else { - $nHID=0; - $outline = "No GClass ".$helpIDString." ".$nHID." ".$GClass; - next; - } - if( $LID != 0 ) { - if ( $LClass eq "tabcontrol" ) { $nHID += 0; } - elsif( $LClass eq "radiobutton" ) { $nHID += 2*256; } - elsif( $LClass eq "checkbox" ) { $nHID += 4*256; } - elsif( $LClass eq "tristatebox" ) { $nHID += 6*256; } - elsif( $LClass eq "edit" ) { $nHID += 8*256; } - elsif( $LClass eq "multilineedit" ) { $nHID += 10*256; } - elsif( $LClass eq "multilistbox" ) { $nHID += 12*256; } - elsif( $LClass eq "listbox" ) { $nHID += 14*256; } - elsif( $LClass eq "combobox" ) { $nHID += 16*256; } - elsif( $LClass eq "pushbutton" ) { $nHID += 18*256; } - elsif( $LClass eq "spinfield" ) { $nHID += 20*256; } - elsif( $LClass eq "patternfield" ) { $nHID += 22*256; } - elsif( $LClass eq "numericfield" ) { $nHID += 24*256; } - elsif( $LClass eq "metricfield" ) { $nHID += 26*256; } - elsif( $LClass eq "currencyfield" ) { $nHID += 28*256; } - elsif( $LClass eq "datefield" ) { $nHID += 30*256; } - elsif( $LClass eq "timefield" ) { $nHID += 32*256; } - elsif( $LClass eq "imageradiobutton" ) { $nHID += 34*256; } - elsif( $LClass eq "numericbox" ) { $nHID += 36*256; } - elsif( $LClass eq "metricbox" ) { $nHID += 38*256; } - elsif( $LClass eq "currencybox" ) { $nHID += 40*256; } - elsif( $LClass eq "datebox" ) { $nHID += 42*256; } - elsif( $LClass eq "timebox" ) { $nHID += 44*256; } - elsif( $LClass eq "imagebutton" ) { $nHID += 46*256; } - elsif( $LClass eq "menubutton" ) { $nHID += 48*256; } - elsif( $LClass eq "morebutton" ) { $nHID += 50*256; } - else { - $nHID=0; - $outline = "No LClass ".$helpIDString." ".$nHID; - next; - } - - #GID und LID auch beruecksichtigen - $nHID += $LID; - } - $nHID += $GID * 16384; #14 Bit nach links shiften - - # check here and not above to avoid warnings for restypes not generated anyways - if( $GID == 0 || $GID >32767 || $LID > 511 ) - { - #GID & LID ungueltig - print STDERR "Invalid Global or Local ID: 0 < GID <= 32767 ; LID <= 511\n"; - print STDERR "$helpIDString GID = $GID; LID = $LID\n"; - next; - } - - # - # 1. Stelle selber ausgeben, falls groesser als 2^21 - # wg. problemen von awk/gawk bei printf mit %u - # - $x=0; - if( $nHID >= 4000000000 ) { - $nHID -= 4000000000; - $x=4; - }elsif( $nHID >= 3000000000) { - $nHID -= 3000000000; - $x=3; - }elsif( $nHID >= 2000000000) { - $nHID -= 2000000000; - $x=2; - } - if( $x != 0) - { printf HID "%s %d%u \n",$helpIDString,$x, $nHID; } - else - { printf HID "%s %u \n",$helpIDString, $nHID; } - } -} - -close C3; -close HID; - -rename("$srs/$filebase.hid.$ENV{INPATH}", "$srs/$filebase.hid") or cleandie("ERROR - couldn't rename tmp file to final for $filebase"); - -if ( not $debug ) { - foreach my $i (@cleanuplist) { - sleep 1; - if ( -f "$workfile$i" ) { - unlink "$workfile$i" or cleandie(""); - } - } -} diff --git a/solenv/bin/modules/CreatePDBRelocators.pm b/solenv/bin/modules/CreatePDBRelocators.pm index c31e3a053b0c..753075a2bfea 100644 --- a/solenv/bin/modules/CreatePDBRelocators.pm +++ b/solenv/bin/modules/CreatePDBRelocators.pm @@ -45,8 +45,11 @@ sub new { my $Object = shift; my $solarversion = shift; + my $workdir; + my $relworkdir; my $self = {}; - my @repositories; + my @basedirs; + my @repos; if (!defined ($solarversion)) { $solarversion = $ENV{SOLARVERSION}; @@ -58,14 +61,33 @@ sub new $self->{SOLARVERSION} = $solarversion; - my $SourceConfigObj = SourceConfig->new(); - @repositories = $SourceConfigObj->get_repositories(); + $workdir = $ENV{WORKDIR}; + if ( !$workdir ) { + print STDERR "can't determine WORKDIR.\n"; + exit (1); + } - if (!scalar @repositories) { - print STDERR "no repository and no working directory found.\n"; + if ( $workdir =~ /^$solarversion/ ) { + $relworkdir = $workdir; + $relworkdir =~ s/^$solarversion\///; + } else { + print STDERR "ERROR: workdir outside $solarversion unsupported\n"; + exit (2); + } + my $SourceConfigObj = SourceConfig->new(); + @repos = $SourceConfigObj->get_repositories(); + if ( defined $ENV{UPDMINOREXT} ) { + foreach my $onedir ( @repos ) { + push( @basedirs, $onedir.$ENV{UPDMINOREXT} ); + } + } + # basdirs is repositories (dmake) + workdir (gnu make) + push(@basedirs, $relworkdir); + if (!scalar @basedirs) { + print STDERR "no basedir and no working directory found.\n"; exit (2); } - $self->{REPOSITORIES} = \@repositories; + $self->{BASEDIRS} = \@basedirs; bless($self, $Object); return $self; } @@ -106,10 +128,10 @@ sub create_pdb_relocators } # collect files - foreach my $repository (@{$self->{REPOSITORIES}}) { + foreach my $basedir (@{$self->{BASEDIRS}}) { my @pdb_files; - my $o = $self->{SOLARVERSION} . "/$repository"; - $repository =~ s/(.*?)\.(.*)/$1/; + my $o = $self->{SOLARVERSION} . "/$basedir"; + $basedir =~ s/(.*?)\.(.*)/$1/; $self->collect_files( $o, $inpath, \@pdb_files); foreach (@pdb_files) { @@ -122,12 +144,12 @@ sub create_pdb_relocators my $target = ""; if ( $src_location =~ /\/so\// ) { - $location = "../../../$repository$milestoneext/" . $src_location; + $location = "../../../$basedir$milestoneext/" . $src_location; $target = "$pdb_dir/so/$relocator"; } else { - $location = "../../$repository$milestoneext/" . $src_location; + $location = "../../$basedir$milestoneext/" . $src_location; $target = "$pdb_dir/$relocator"; } @@ -142,14 +164,14 @@ sub create_pdb_relocators return 1; } -sub collect_files_from_all_repositories +sub collect_files_from_all_basedirs { my $self = shift; my ($platform, $filesref) = @_; - my $repository; + my $basedir; my $ret; - foreach $repository (@{$self->{REPOSITORIES}}) { - my $srcdir = $self->{SOLARVERSION} . "/$repository"; + foreach $basedir (@{$self->{BASEDIRS}}) { + my $srcdir = $self->{SOLARVERSION} . "/$basedir"; $ret |= $self->collect_files ($srcdir, $platform, $filesref); } return $ret; @@ -160,14 +182,16 @@ sub collect_files my $self = shift; my ($srcdir, $platform, $filesref) = @_; my $template = "$srcdir/*/$platform"; + my $template2 = "$srcdir/LinkTarget"; if ( $ENV{GUI} eq "WNT" ) { # collect all pdb files on o: # regular glob does not work with two wildcard on WNT my @bin = glob("$template/bin/*.pdb"); my @bin_so = glob("$template/bin/so/*.pdb"); + my @workdir = glob("$template2/*/*.pdb"); # we are only interested in pdb files which are accompanied by # .exe or .dll which the same name - foreach (@bin, @bin_so) { + foreach (@bin, @bin_so, @workdir) { my $dir = dirname($_); my $base = basename($_, ".pdb"); my $exe = "$dir/$base.exe"; @@ -180,13 +204,16 @@ sub collect_files else { # collect all shared libraries on o: my @lib = glob("$template/lib/*.so*"); + my @workdir_lib = glob("$template2/Library/*.so*"); my @lib_so = glob("$template/lib/so/*.so*"); my @mac_lib = glob("$template/lib/*.dylib*"); + my @mac_workdir_lib = glob("$template2/Library/*.dylib*"); my @mac_lib_so = glob("$template/lib/so/*.dylib*"); # collect all binary executables on o: my @bin = $self->find_binary_execs("$template/bin"); + my @workdir_bin = $self->find_binary_execs("$template2/Executable"); my @bin_so = $self->find_binary_execs("$template/bin/so"); - push(@$filesref, (@lib, @lib_so, @mac_lib, @mac_lib_so, @bin, @bin_so)); + push(@$filesref, (@lib, @lib_so, @workdir_lib, @mac_lib, @mac_workdir_lib, @mac_lib_so, @bin, @workdir_bin, @bin_so)); } return 1; } diff --git a/solenv/bin/modules/RepositoryHelper.pm b/solenv/bin/modules/RepositoryHelper.pm index 31c97e35d1c2..9bf4b841c7be 100644 --- a/solenv/bin/modules/RepositoryHelper.pm +++ b/solenv/bin/modules/RepositoryHelper.pm @@ -118,21 +118,26 @@ sub search_for_hg { sub search_via_build_lst { my $self = shift; - my @possible_build_lists = ('build.lst', 'build.xlist'); # build lists names +# my @possible_build_lists = ('build.lst', 'build.xlist'); # build lists names + my @possible_build_lists = ('build.lst'); # build lists names my $previous_dir = ''; my $rep_root_candidate = $self->{INITIAL_DIRECTORY}; do { foreach (@possible_build_lists) { - if (-e $rep_root_candidate . '/prj/'.$_) { + my $test_file; + if ($rep_root_candidate eq '/') { + $test_file = '/prj/' . $_; + } else { + $test_file = $rep_root_candidate . '/prj/' . $_; + }; + if (-e $test_file) { $self->{REPOSITORY_ROOT} = File::Basename::dirname($rep_root_candidate); return 1; - } elsif ($rep_root_candidate eq $previous_dir) { - return 0; }; }; $previous_dir = $rep_root_candidate; $rep_root_candidate = File::Basename::dirname($rep_root_candidate); - return 0 if (!$rep_root_candidate); + return 0 if ((!$rep_root_candidate) || ($rep_root_candidate eq $previous_dir)); } while (chdir "$rep_root_candidate"); }; diff --git a/solenv/bin/modules/SourceConfig.pm b/solenv/bin/modules/SourceConfig.pm index dfaa797d8f48..e7b526e2cfca 100755 --- a/solenv/bin/modules/SourceConfig.pm +++ b/solenv/bin/modules/SourceConfig.pm @@ -320,14 +320,14 @@ sub read_config_file { next; }; }; - croak("Line $line in " . $self->{SOURCE_CONFIG_FILE} . 'violates format. Please make your checks!!'); + croak("Line $line in " . $self->{SOURCE_CONFIG_FILE} . ' violates format. Please make your checks!'); }; close SOURCE_CONFIG_FILE; if (!scalar keys %{$self->{REPOSITORIES}}) { get_fallback_repository($self); }; } else { - croak('Cannot open ' . $self->{SOURCE_CONFIG_FILE} . 'for reading'); + croak('Cannot open ' . $self->{SOURCE_CONFIG_FILE} . ' for reading'); }; }; @@ -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); diff --git a/solenv/bin/modules/SourceConfigHelper.pm b/solenv/bin/modules/SourceConfigHelper.pm new file mode 100644 index 000000000000..84ffbe0ca3f7 --- /dev/null +++ b/solenv/bin/modules/SourceConfigHelper.pm @@ -0,0 +1,422 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +#************************************************************************* +# +# SourceConfigHelper - Perl extension for parsing general info databases +# +# usage: see below +# +#************************************************************************* + +package SourceConfigHelper; + +use strict; + +use RepositoryHelper; +use SourceConfig; +use Cwd qw (cwd); +use Carp; + +my $debug = 0; +my @source_config_list; # array of sourceconfig objects + +#----------------------------------------------------------------------- +# Constants +#----------------------------------------------------------------------- + +use constant SOURCE_CONFIG_NONE => 0; +use constant SOURCE_CONFIG_CURRENT_FIRST => 1; +use constant SOURCE_CONFIG_ENVIRONMENT_FIRST => 2; +use constant SOURCE_CONFIG_CURRENT_ONLY => 3; +use constant SOURCE_CONFIG_ENVIRONMENT_ONLY => 4; + +use constant SOURCE_CONFIG_DEFAULT => SOURCE_CONFIG_CURRENT_FIRST; + +##### profiling ##### + +##### ctor ##### + +sub new { + my $proto = shift; + my $class = ref($proto) || $proto; + my $init_action = shift; + my $self = {}; + my $SourceConfigCurrent; + my $SourceConfigEnvironment; + + $init_action = SOURCE_CONFIG_DEFAULT if (!defined ($init_action)); + if (!eval ($init_action) or ($init_action < SOURCE_CONFIG_NONE) or ($init_action > SOURCE_CONFIG_ENVIRONMENT_ONLY)) { + croak("wrong initial parameter: $init_action\n"); + } + + if ($init_action != SOURCE_CONFIG_NONE) { + my $repositoryHash_ref = {}; + if ($init_action != SOURCE_CONFIG_ENVIRONMENT_ONLY) { + my $initial_directory = cwd(); + my $result = is_repository($initial_directory, $repositoryHash_ref); + if ($result) { + $SourceConfigCurrent = SourceConfig->new($repositoryHash_ref->{REPOSITORY_ROOT}); + } + } + if ($init_action != SOURCE_CONFIG_CURRENT_ONLY) { + my $source_config = $ENV{SOURCE_ROOT_DIR} . '/' . SourceConfig::SOURCE_CONFIG_FILE_NAME; + if (-f $source_config) { + $SourceConfigEnvironment = SourceConfig->new($source_config); + } + } + + # fill array + + if (($init_action == SOURCE_CONFIG_CURRENT_FIRST) or ($init_action == SOURCE_CONFIG_CURRENT_ONLY)) { + if (defined ($SourceConfigCurrent)) { + push (@source_config_list, $SourceConfigCurrent); + } + if ($init_action == SOURCE_CONFIG_CURRENT_FIRST) { + if (defined ($SourceConfigEnvironment)) { + push (@source_config_list, $SourceConfigEnvironment); + } + } + } + elsif (($init_action == SOURCE_CONFIG_ENVIRONMENT_FIRST) or ($init_action == SOURCE_CONFIG_ENVIRONMENT_ONLY)) { + if (defined ($SourceConfigEnvironment)) { + push (@source_config_list, $SourceConfigEnvironment); + } + if ($init_action == SOURCE_CONFIG_ENVIRONMENT_FIRST) { + if (defined ($SourceConfigCurrent)) { + push (@source_config_list, $SourceConfigCurrent); + } + } + } + } + + $self->{SOURCE_CONFIG_LIST} = \@source_config_list; + + bless($self, $class); + return $self; +} + +##### methods ##### + +############################################################################################ + +sub add_SourceConfig { + my $self = shift; + my $source_config = shift; + push (@{$self->{SOURCE_CONFIG_LIST}}, $source_config); +} + +############################################################################################ + +sub get_SourceConfigList { + my $self = shift; + return @{$self->{SOURCE_CONFIG_LIST}}; +} + +############################################################################################ + +sub has_SourceConfig { + my $self = shift; + my $result = 0; + my $count = @{$self->{SOURCE_CONFIG_LIST}}; + $result = 1 if ($count > 0); + return $result; +} + +############################################################################################ + +sub get_module_path { + my $self = shift; + my $module = shift; + my $function = \&SourceConfig::get_module_path; + my $result; + $result = $self->get_StringResult ($function, $module); + return $result; +} + +############################################################################################ + +sub get_active_modules { + my $self = shift; + my $parameter; # empty + my $function = \&SourceConfig::get_active_modules; + my $array_ref; + $array_ref = $self->get_ArrayResult ($function, $parameter); + return @$array_ref; +} + +############################################################################################ + +sub get_repositories { + my $self = shift; + my $parameter; # empty + my $function = \&SourceConfig::get_repositories; + my $array_ref; + $array_ref = $self->get_ArrayResult ($function, $parameter); + return @$array_ref; +} + +############################################################################################ + +sub get_module_repository { + my $self = shift; + my $module = shift; + my $function = \&SourceConfig::get_module_repository; + my $result; + $result = $self->get_StringResult ($function, $module); + return $result; +} + +############################################################################################ + +sub is_active { + my $self = shift; + my $module = shift; + my $function = \&SourceConfig::is_active; + my $result_ref; + my $is_active = 0; + $result_ref = $self->get_ResultOfList ($function, $module); + my $count = @$result_ref; + if ($count>0) { + foreach my $active (@$result_ref) { + if ($active) { + $is_active = $active; + } + } + } + return $is_active; +} + +##### private methods ##### + +############################################################################################ +# +# is_repository () : check if the directory is a valid repository +# +# input: - directory +# - hash reference, where the output will be stored +# +# output: 0 = FALSE, the directory is no valid repository +# 1 = TRUE, the repository root can be found in $repositoryHash_ref->{REPOSITORY_ROOT} +# +############################################################################################ + +sub is_repository { + my $directory = shift; + my $repositoryHash_ref = shift; + $repositoryHash_ref->{INITIAL_DIRECTORY} = $directory; + $repositoryHash_ref->{REPOSITORY_ROOT} = undef; + $repositoryHash_ref->{REPOSITORY_NAME} = undef; + my $result = RepositoryHelper::search_via_build_lst($repositoryHash_ref); + chdir $repositoryHash_ref->{INITIAL_DIRECTORY}; + if (!$result) { + $result = RepositoryHelper::search_for_hg($repositoryHash_ref); + } + return $result; +} + +############################################################################################ +# +# get_ResultOfList(): give back an array reference from all SourceConfig Objects results +# +# input: - function : reference to the called function of each SourceConfig Object +# - parameter : parameter for the called function +# +# output: result : array of all results +# +############################################################################################ + +sub get_ResultOfList { + my $self = shift; + my $function = shift; + my $parameter = shift; + my @result; + foreach my $source_config (@{$self->{SOURCE_CONFIG_LIST}}) { + push (@result, &$function ($source_config, $parameter)); + } + return \@result; +} + +############################################################################################ +# +# get_StringResult(): give back the first defined result from all SourceConfig Objects +# +# input: - function : reference to the called function of each SourceConfig Object +# - parameter : parameter for the called function +# +# output: result : scalar variable (string), undef if no result +# +############################################################################################ + +sub get_StringResult { + my $self = shift; + my $function = shift; + my $parameter = shift; + my $result_ref; + $result_ref = $self->get_ResultOfList ($function, $parameter); + my $count = @$result_ref; + if ($count>0) { + my $value; + my $i = 0; + while (($i < $count) and !defined ($value)) { # search the first defined result + $value = $$result_ref[$i]; + $i++; + } + return $value; + } + return undef; +} + +############################################################################################ +# +# get_StringResult(): give back a sorted and uniqe array reference of the results +# from all SourceConfig Objects +# +# input: - function : reference to the called function of each SourceConfig Object +# - parameter : parameter for the called function +# +# output: result : sorted and uniqe array reference +# +############################################################################################ + +sub get_ArrayResult { + my $self = shift; + my $function = shift; + my $parameter = shift; + my $result_ref; + my @modules; + $result_ref = $self->get_ResultOfList ($function, $parameter); + my $count = @$result_ref; + if ($count>0) { + my %moduleHash; + foreach my $module (@$result_ref) { + $moduleHash{$module}++; + } + @modules = sort keys %moduleHash; + } + return \@modules; +} + + ##### finish ##### + +1; # needed by use or require + +__END__ + +=head1 NAME + +SourceConfigHelper - Perl extension for handling with SourceConfigObjetcs + +=head1 SYNOPSIS + + # example that will read source_config file and return the active repositories + + use SourceConfigHelper; + + # Create a new instance: + $a = SourceConfigHelper->new(); + + # Get repositories for the actual workspace: + $a->get_repositories(); + +=head1 DESCRIPTION + +SourceConfigHelper is a perl extension to handle more than one objects of SourceConfig +to set up a search order for modules. + +Methods: + +SourceConfigHelper::new() + +Creates a new instance of SourceConfigHelper. Can be initialized by: default - empty or with a constant of search order. default: the source_config will be taken first from the current repository and second from the environment +Possible parameters are: +SourceConfigHelper::SOURCE_CONFIG_NONE - no SourceConfig Object will be created +SourceConfigHelper::SOURCE_CONFIG_CURRENT_FIRST - use the current repository first +SourceConfigHelper::SOURCE_CONFIG_ENVIRONMENT_FIRST - use the repository of the environment first +SourceConfigHelper::SOURCE_CONFIG_CURRENT_ONLY - use only the current repository +SourceConfigHelper::SOURCE_CONFIG_ENVIRONMENT_ONLY - use only the repository of the environment + +SourceConfigHelper::get_repositories() + +Returns sorted list of active repositories for the actual workspace + +SourceConfigHelper::get_active_modules() + +Returns a sorted list of active modules + +SourceConfigHelper::get_all_modules() + +Returns sorted list of all modules in active repositories. + +SourceConfigHelper::get_module_path($module) + +Returns absolute module path. If the module is not active or don't exists, "undef" will be returned. + +SourceConfigHelper::get_module_repository($module) + +Returns the module's repository. If the module is not active or don't exists, "undef" will be returned. + +SourceConfigHelper::is_active() + +Returns 1 (TRUE) if a module is active +Returns 0 (FALSE) if a module is not active + +SourceConfigHelper::add_SourceConfig($SourceConfigObject) + +Add the SourceConfigObject to the end of the list + +SourceConfigHelper::get_SourceConfigList() + +Return an array of SourceConfigObjects + +SourceConfigHelper::has_SourceConfig() + +Returns 1 (TRUE) if one or more SourceConfig Objects is in the list +Returns 0 (FALSE) if no SourceConfig Object is in the list (can happen if there is no valid repository) + +=head2 EXPORT + +SourceConfigHelper::new() +SourceConfigHelper::get_repositories() +SourceConfigHelper::get_active_modules() +SourceConfigHelper::get_all_modules() +SourceConfigHelper::get_module_path($module) +SourceConfigHelper::get_module_repository($module) +SourceConfigHelper::is_active($module) +SourceConfigHelper::add_SourceConfig($SourceConfigObject) +SourceConfigHelper::get_SourceConfigList() +SourceConfigHelper::has_SourceConfig() + +=head1 AUTHOR + +Kurt Zenker, kz@openoffice.org + +=head1 SEE ALSO + +perl(1). + +=cut diff --git a/solenv/bin/modules/installer/control.pm b/solenv/bin/modules/installer/control.pm index 9fdfae4d9c66..3f6b43f563fb 100644 --- a/solenv/bin/modules/installer/control.pm +++ b/solenv/bin/modules/installer/control.pm @@ -320,6 +320,11 @@ sub check_logfile my @output = (); my $contains_error = 0; + my $ignore_error = 0; + my $make_error_to_warning = 0; + + if (( ! $installer::globals::pro ) && ( $installer::globals::ignore_error_in_logfile )) { $ignore_error = 1; } + for ( my $i = 0; $i <= $#{$logfile}; $i++ ) { my $line = ${$logfile}[$i]; @@ -337,6 +342,12 @@ sub check_logfile { $contains_error = 1; push(@errors, $line); + + if ( $ignore_error ) + { + $contains_error = 0; + $make_error_to_warning = 1; + } } } @@ -358,7 +369,26 @@ sub check_logfile } else { - my $line = "\n***********************************************************\n"; + my $line = ""; + + if ( $make_error_to_warning ) + { + $line = "\n*********************************************************************\n"; + push(@output, $line); + $line = "The following errors in the log file were ignored:\n\n"; + push(@output, $line); + + for ( my $i = 0; $i <= $#errors; $i++ ) + { + $line = "$errors[$i]"; + push(@output, $line); + } + + $line = "*********************************************************************\n"; + push(@output, $line); + } + + $line = "\n***********************************************************\n"; push(@output, $line); $line = "Successful packaging process!\n"; push(@output, $line); diff --git a/solenv/bin/modules/installer/environment.pm b/solenv/bin/modules/installer/environment.pm index 4b4d93aa3723..5c8c4ab25e40 100644 --- a/solenv/bin/modules/installer/environment.pm +++ b/solenv/bin/modules/installer/environment.pm @@ -115,9 +115,6 @@ sub set_global_environment_variables if ( $ENV{'LAST_MINOR'} ) { $installer::globals::lastminor = $ENV{'LAST_MINOR'}; } if ( $ENV{'PROEXT'} ) { $installer::globals::pro = 1; } - if ( $ENV{'SOLAR_JAVA'} ) { $installer::globals::solarjava = 1; } - if ( $ENV{'JDKLIB'} ) { $installer::globals::jdklib = $ENV{'JDKLIB'}; } - if ( $ENV{'JREPATH'} ) { $installer::globals::jrepath = $ENV{'JREPATH'}; } if ( $ENV{'VERBOSE'} && ( (lc $ENV{'VERBOSE'}) eq "false" ) ) { $installer::globals::quiet = 1; } if ( $ENV{'PREPARE_WINPATCH'} ) { $installer::globals::prepare_winpatch = 1; } @@ -129,6 +126,7 @@ sub set_global_environment_variables if ( $ENV{'SOLAR_JAVA'} ) { $installer::globals::solarjavaset = 1; } if ( $ENV{'RPM'} ) { $installer::globals::rpm = $ENV{'RPM'}; } if ( $ENV{'DONTCOMPRESS'} ) { $installer::globals::solarisdontcompress = 1; } + if ( $ENV{'IGNORE_ERROR_IN_LOGFILE'} ) { $installer::globals::ignore_error_in_logfile = 1; } if (( $ENV{'DISABLE_STRIP'} ) && ( $ENV{'DISABLE_STRIP'} ne '' )) { $installer::globals::strip = 0; } if ( $installer::globals::localinstalldir ) { $installer::globals::localinstalldirset = 1; } diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index 0d3bc2603f6b..6b82c17885d0 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -87,7 +87,8 @@ BEGIN "oc", "ml", "as", - "ast" + "ast", + "ht" ); @items_at_modules = ("Files", "Dirs", "Unixlinks"); @asianlanguages = ("ja", "ko", "zh-CN", "zh-TW"); @@ -118,8 +119,6 @@ BEGIN $dounzip = 1; $languages_defined_in_productlist = 0; $setupscript_defined_in_productlist = 0; - $services_rdb_created = 0; - $servicesrdb_can_be_created = 0; $islinux = 0; $issolaris = 0; $ismacosx = 0; @@ -238,9 +237,6 @@ BEGIN $creating_windows_installer_patch = 0; $strip = 1; - $solarjava = 0; - $jdklib = ""; - $jrepath = ""; $globallogging = 0; $globalloggingform21 = 1; @@ -248,6 +244,7 @@ BEGIN @logfileinfo = (); @errorlogfileinfo = (); @globallogfileinfo = (); + $ignore_error_in_logfile = 0; $exitlog = ""; $globalinfo_copied = 0; $quiet = 0; @@ -378,6 +375,10 @@ BEGIN %spellcheckerlanguagehash = (); %spellcheckerfilehash = (); $registryrootcomponent = ""; + %allcomponents = (); + %allcomponents_in_this_database = (); + %allshortcomponents = (); + %alluniquedirectorynames = (); $installlocationdirectory = ""; $installlocationdirectoryset = 0; @@ -409,9 +410,6 @@ BEGIN %usedtreeconditions = (); %moduledestination = (); - $unomaxservices = 1800; # regcomp -c argument length - $javamaxservices = 15; - $one_cab_file = 0; $fix_number_of_cab_files = 1; $cab_file_per_component = 0; @@ -454,8 +452,6 @@ BEGIN @solarispatchfiles = (".diPatch", "patchinfo"); @environmentvariables = ( "SOLARVERSION", "GUI", "WORK_STAMP", "OUTPATH", "LOCAL_OUT", "LOCAL_COMMON_OUT" ); @packagelistitems = ("module", "solarispackagename", "packagename", "copyright", "vendor", "description" ); - @regcompjars = ( "unoil.jar", "java_uno.jar", "ridl.jar", "jurt.jar", "juh.jar", "xmerge.jar", "commonwizards.jar" ); - @regcompregisterlibs = ( "javavm.uno", "javaloader.uno", "stocservices.uno" ); @languagepackfeature =(); @helppackfeature =(); @featurecollector =(); @@ -503,7 +499,6 @@ BEGIN $separator = "/"; $pathseparator = "\:"; $libextension = "\.dll"; - $quote = "\'"; $isunix = 0; $iswin = 1; $archiveformat = ".zip"; @@ -528,7 +523,6 @@ BEGIN $libextension = "\.so"; } $archiveformat = ".tar.gz"; - $quote = "\'"; $isunix = 1; $iswin = 0; } diff --git a/solenv/bin/modules/installer/parameter.pm b/solenv/bin/modules/installer/parameter.pm index 2d58d585599e..f17965fa3d7f 100644 --- a/solenv/bin/modules/installer/parameter.pm +++ b/solenv/bin/modules/installer/parameter.pm @@ -386,19 +386,6 @@ sub setglobalvariables if ( ! $installer::globals::packageformat ) { $installer::globals::packageformat = "native"; } - # $installer::globals::servicesrdb_can_be_created can only be set, if regcomp (regcomp.exe) can be executed. - - if ( $installer::globals::iswin && $installer::globals::iswindowsbuild ) { $installer::globals::servicesrdb_can_be_created = 1; } - if ( $installer::globals::islinux && $installer::globals::islinuxbuild ) { $installer::globals::servicesrdb_can_be_created = 1; } - if ( $installer::globals::issolaris && $installer::globals::issolarisbuild ) { $installer::globals::servicesrdb_can_be_created = 1; } - - # ToDo: Needs to be expanded for additional compiler (setting $installer::globals::servicesrdb_can_be_created = 1 for all external platforms) - - if ((!($installer::globals::iswindowsbuild)) && (!($installer::globals::islinuxbuild)) && (!($installer::globals::issolarisbuild))) - { - $installer::globals::servicesrdb_can_be_created = 1; - } - # extension, if $installer::globals::pro is set if ($installer::globals::pro) { $installer::globals::productextension = ".pro"; } @@ -655,8 +642,6 @@ sub outputparameter if ( $installer::globals::debian ) { push(@output, "Linux: Creating Debian packages\n"); } if ( $installer::globals::dounzip ) { push(@output, "Unzip ARCHIVE files\n"); } else { push(@output, "Not unzipping ARCHIVE files\n"); } - if ( $installer::globals::servicesrdb_can_be_created ) { push(@output, "services.rdb can be created\n"); } - else { push(@output, "services.rdb cannot be created !\n"); } if (!($installer::globals::languages_defined_in_productlist)) { push(@output, "Languages:\n"); diff --git a/solenv/bin/modules/installer/regmerge.pm b/solenv/bin/modules/installer/regmerge.pm deleted file mode 100644 index 2f31a0bbc64c..000000000000 --- a/solenv/bin/modules/installer/regmerge.pm +++ /dev/null @@ -1,339 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -package installer::regmerge; - -use Cwd; -use installer::converter; -use installer::existence; -use installer::exiter; -use installer::globals; -use installer::logger; -use installer::pathanalyzer; -use installer::remover; -use installer::scriptitems; -use installer::systemactions; - -################################################################ -# Collecting all files with content: -# Regmergefile = "mydatabasepart.rdb"; -################################################################ - -sub collect_all_regmergefiles -{ - my ($filesarrayref) = @_; - - my @regmergefiles = (); - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - if ( $onefile->{'Regmergefile'} ) { push(@regmergefiles, $onefile); } - } - - return \@regmergefiles; -} - -################################################################ -# Collecting all gids of the databases, that are part of -# the file definition -################################################################ - -sub collect_all_database_gids -{ - my ($filesarrayref) = @_; - - my @databasegids = (); - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - - if ( $onefile->{'RegistryID'} ) - { - my $databasegid = $onefile->{'RegistryID'}; - if (! installer::existence::exists_in_array($databasegid, \@databasegids)) { push(@databasegids, $databasegid); } - } - else - { - installer::exiter::exit_program("ERROR: File defintion error. File :$onefile->{'gid'} without RegistryID!", "collect_all_database_gids"); - } - } - - return \@databasegids; -} - -################################################################ -# Returning the database file from the files collector. In the -# future this file does not need to exist, but currently it -# has to exist already in the files collector. -################################################################ - -sub get_database_file -{ - my ($databasegid, $filesarrayref) = @_; - - my $found = 0; - my $onefile; - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - $onefile = ${$filesarrayref}[$i]; - my $gid = $onefile->{'gid'}; - - if ( $databasegid eq $gid ) - { - $found = 1; - last; - } - } - - if ( ! $found ) { installer::exiter::exit_program("ERROR: Did not find StarRegistry file $databasegid!", "get_database_file"); } - - return $onefile; -} - -################################################################ -# The regmerge file has to be found the in include pathes -################################################################ - -sub get_regmerge_file -{ - my ($includepatharrayref) = @_; - - my $searchname; - - if ($installer::globals::isunix) { $searchname = "regcomplazy"; } - else { $searchname = "regcomplazy.exe"; } - - my $regmergefileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$searchname, $includepatharrayref, 1); - if ( $$regmergefileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $searchname for merging the StarRegistry!", "get_regmerge_file"); } - - return $$regmergefileref; -} - -################################################################ -# Collecting all files that are merged to one defined -# StarRegistry database -################################################################ - -sub collect_all_files_for_one_registry -{ - my ($regmergefiles, $databasegid) = @_; - - my @regmergefiles = (); - - for ( my $i = 0; $i <= $#{$regmergefiles}; $i++ ) - { - my $onefile = ${$regmergefiles}[$i]; - if ( $onefile->{'RegistryID'} eq $databasegid ) { push(@regmergefiles, $onefile); } - } - - return \@regmergefiles; -} - -################################################################ -# Collecting all particles from the regmerge files -################################################################ - -sub collect_all_regmerge_particles -{ - my ($databaseregisterfiles) = @_; - - my @regmergeparticles = (); - - for ( my $i = 0; $i <= $#{$databaseregisterfiles}; $i++ ) - { - my $onefile = ${$databaseregisterfiles}[$i]; - if ( $onefile->{'Regmergefile'} ) { push(@regmergeparticles, $onefile->{'Regmergefile'}); } - else { installer::exiter::exit_program("ERROR: Could not find entry for \"Regmergefile\" in $onefile->{'gid'}!", "collect_all_regmerge_particles"); } - } - - return \@regmergeparticles; -} - -################################################################ -# Collecting all source pathes of the regmerge particles -################################################################ - -sub get_all_source_pathes -{ - my ($regmergeparticles, $includepatharrayref) = @_; - - my @regmergeparticles = (); - - for ( my $i = 0; $i <= $#{$regmergeparticles}; $i++ ) - { - my $filename = ${$regmergeparticles}[$i]; - - my $fileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 1); - if ( $$fileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $filename for merging the StarRegistry!", "get_all_source_pathes"); } - - push(@regmergeparticles, $$fileref); - } - - return \@regmergeparticles; -} - -################################################################ -# Merging the rdb files into the StarRegistry database -################################################################ - -sub merge_files -{ - my ($regmergefile, $databasefile, $registerfiles, $databasedir, $allvariableshashref) = @_; - - my $databasesource = $databasefile->{'sourcepath'}; - my $databasename = $databasefile->{'Name'}; - my $databasedest = $databasedir . $installer::globals::separator . $databasename; - - installer::systemactions::copy_one_file($databasesource, $databasedest); - $databasefile->{'sourcepath'} = $databasedest; # new sourcepath for the StarRegistry file - - # One call for every merge particle. This is only possible, if there are only a few merge particles. - - my $prefix = $databasefile->{'NativeServicesURLPrefix'}; - # TODO: "NativeServicesURLPrefix" or "JavaServicesURLPrefix" - - my $error_occurred = 0; - - for ( my $i = 0; $i <= $#{$registerfiles}; $i++ ) - { - my $registerfile = $databasedir . $installer::globals::separator . $i . ".tmp"; - open (IN, '<', $registerfiles->[$i]) or $error_occurred = 1; - open (OUT, '>', $registerfile) or $error_occurred = 1; - while (<IN>) - { - s/^ComponentName=/ComponentName=$prefix/; - print OUT $_ or $error_occurred = 1; - } - close IN or $error_occurred = 1; - close OUT or $error_occurred = 1; - - my $systemcall = $regmergefile . " -v " . $databasedest . " " . $registerfile . " 2\>\&1 |"; - - my @regmergeoutput = (); - - my $var_library_path; - my $old_library_path; - if ($installer::globals::isunix) { - $var_library_path = $installer::globals::ismacosx ? - 'DYLD_LIBRARY_PATH' : 'LD_LIBRARY_PATH'; - $old_library_path = $ENV{$var_library_path}; - installer::servicesfile::include_libdir_into_ld_library_path( - $var_library_path, $regmergefile); - } - - open (REG, "$systemcall"); - while (<REG>) {push(@regmergeoutput, $_); } - close (REG); - - my $returnvalue = $?; # $? contains the return value of the systemcall - - if (defined $var_library_path) { - if (defined $old_library_path) { - $ENV{$var_library_path} = $old_library_path; - } else { - delete $ENV{$var_library_path}; - } - } - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $j = 0; $j <= $#regmergeoutput; $j++ ) { push( @installer::globals::logfileinfo, "$regmergeoutput[$j]"); } - - if ($returnvalue) - { - $infoline = "ERROR: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - $error_occurred = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - } - } - - return $error_occurred; -} - -################################################################ -# Expanding the registry database files by merging rdb files -# into this registry database files. -################################################################ - -sub merge_registration_files -{ - my ($filesarrayref, $includepatharrayref, $languagestringref, $allvariableshashref) = @_; - - installer::logger::include_header_into_logfile("Creating starregistry databases:"); - - # Test if there is something to do. At least one file has to have the content: - # Regmergefile = "mydatabasepart.rdb"; - - my $regmergefiles = collect_all_regmergefiles($filesarrayref); - - if ( $#{$regmergefiles} > -1 ) # not empty -> at least one regmerge file - { - # prepare registration - - my $regmergefile = get_regmerge_file($includepatharrayref); # searching for regmerge (regcomplazy.exe) - - my $databasegids = collect_all_database_gids($regmergefiles); - - # iterating over all database gids - - my $regmergeerror = 0; - - for ( my $i = 0; $i <= $#{$databasegids}; $i++ ) - { - $databasegid = ${$databasegids}[$i]; - - my $databasedirname = $databasegid . "_rdb"; # <- unique! - my $databasedir = installer::systemactions::create_directories($databasedirname, $languagestringref); - push(@installer::globals::removedirs, $databasedir); - - my $databasefile = get_database_file($databasegid, $filesarrayref); - my $databaseregisterfiles = collect_all_files_for_one_registry($regmergefiles, $databasegid); - - if ( $#{$databaseregisterfiles} > -1 ) # not empty -> at least one regmerge file - { - my $regmergeparticles = collect_all_regmerge_particles($databaseregisterfiles); - $regmergeparticles = get_all_source_pathes($regmergeparticles, $includepatharrayref); - my $oneregmergeerror = merge_files($regmergefile, $databasefile, $regmergeparticles, $databasedir, $allvariableshashref); - if ($oneregmergeerror) { $regmergeerror = 1; } - } - } - - if ( $regmergeerror ) { installer::exiter::exit_program("ERROR: regmerge !", "merge_registration_files"); } - - } -} - -1; diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm index c23cd9e1a817..555b64196cb3 100644 --- a/solenv/bin/modules/installer/scriptitems.pm +++ b/solenv/bin/modules/installer/scriptitems.pm @@ -1222,7 +1222,7 @@ sub get_Source_Directory_For_Files_From_Includepathlist my $styles = ""; my $file_can_miss = 0; if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } - if (( $styles =~ /\bSTARREGISTRY\b/ ) || ( $styles =~ /\bFILE_CAN_MISS\b/ )) { $file_can_miss = 1; } + if ( $styles =~ /\bFILE_CAN_MISS\b/ ) { $file_can_miss = 1; } if (( $installer::globals::languagepack ) && ( ! $onefile->{'ismultilingual'} ) && ( ! ( $styles =~ /\bFORCELANGUAGEPACK\b/ ))) { $file_can_miss = 1; } if (( $installer::globals::helppack ) && ( ! $onefile->{'ismultilingual'} ) && ( ! ( $styles =~ /\bFORCEHELPPACK\b/ ))) { $file_can_miss = 1; } @@ -1350,12 +1350,21 @@ sub remove_Files_Without_Sourcedirectory if ($sourcepath eq "") { my $styles = $onefile->{'Styles'}; + my $filename = $onefile->{'Name'}; - if ( ! ( $styles =~ /\bSTARREGISTRY\b/ )) # StarRegistry files will be created later + if ( ! $installer::globals::languagepack && !$installer::globals::helppack) { - my $filename = $onefile->{'Name'}; + $infoline = "ERROR: Removing file $filename from file list.\n"; + push( @installer::globals::logfileinfo, $infoline); + + push(@missingfiles, "ERROR: File not found: $filename\n"); + $error_occurred = 1; - if ( ! $installer::globals::languagepack && !$installer::globals::helppack) + next; # removing this file from list, if sourcepath is empty + } + elsif ( $installer::globals::languagepack ) # special case for language packs + { + if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ )) { $infoline = "ERROR: Removing file $filename from file list.\n"; push( @installer::globals::logfileinfo, $infoline); @@ -1365,51 +1374,38 @@ sub remove_Files_Without_Sourcedirectory next; # removing this file from list, if sourcepath is empty } - elsif ( $installer::globals::languagepack ) # special case for language packs + else { - if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ )) - { - $infoline = "ERROR: Removing file $filename from file list.\n"; - push( @installer::globals::logfileinfo, $infoline); - - push(@missingfiles, "ERROR: File not found: $filename\n"); - $error_occurred = 1; - - next; # removing this file from list, if sourcepath is empty - } - else - { - $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "INFO: It is not language dependent and can be ignored in language packs.\n"; - push( @installer::globals::logfileinfo, $infoline); + $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; + push( @installer::globals::logfileinfo, $infoline); + $infoline = "INFO: It is not language dependent and can be ignored in language packs.\n"; + push( @installer::globals::logfileinfo, $infoline); - next; # removing this file from list, if sourcepath is empty - } + next; # removing this file from list, if sourcepath is empty } - else # special case for help packs + } + else # special case for help packs + { + if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCEHELPPACK\b/ )) { - if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCEHELPPACK\b/ )) - { - $infoline = "ERROR: Removing file $filename from file list.\n"; - push( @installer::globals::logfileinfo, $infoline); + $infoline = "ERROR: Removing file $filename from file list.\n"; + push( @installer::globals::logfileinfo, $infoline); - push(@missingfiles, "ERROR: File not found: $filename\n"); - $error_occured = 1; + push(@missingfiles, "ERROR: File not found: $filename\n"); + $error_occured = 1; - next; # removing this file from list, if sourcepath is empty - } - else - { - $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "INFO: It is not language dependent and can be ignored in help packs.\n"; - push( @installer::globals::logfileinfo, $infoline); + next; # removing this file from list, if sourcepath is empty + } + else + { + $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; + push( @installer::globals::logfileinfo, $infoline); + $infoline = "INFO: It is not language dependent and can be ignored in help packs.\n"; + push( @installer::globals::logfileinfo, $infoline); - next; # removing this file from list, if sourcepath is empty - } + next; # removing this file from list, if sourcepath is empty } - } + } } push(@newfilesarray, $onefile); diff --git a/solenv/bin/modules/installer/servicesfile.pm b/solenv/bin/modules/installer/servicesfile.pm deleted file mode 100644 index 948287b206f8..000000000000 --- a/solenv/bin/modules/installer/servicesfile.pm +++ /dev/null @@ -1,1059 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -package installer::servicesfile; - -use Cwd; -use installer::converter; -use installer::existence; -use installer::exiter; -use installer::globals; -use installer::logger; -use installer::pathanalyzer; -use installer::remover; -use installer::scriptitems; -use installer::systemactions; - -################################################################ -# Adding the newly created file into the files collector -################################################################ - -sub add_services_sourcepath_into_filearray -{ - my ( $filesarrayref, $servicesfile, $servicesname ) = @_; - - my $found = 0; - my $onefile; - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - $onefile = ${$filesarrayref}[$i]; - my $name = $onefile->{'Name'}; - - if ( $servicesname eq $name ) - { - $found = 1; - $onefile->{'sourcepath'} = $servicesfile; # setting the sourcepath! - last; - } - } - - if ( ! $found ) { installer::exiter::exit_program("ERROR: Did not find $servicesname in files collector!", "add_services_sourcepath_into_filearray"); } - -} - -################################################################ -# Generating a file url from a path -################################################################ - -sub make_file_url -{ - my ( $path ) = @_; - - my $fileurl = ""; - - # removing ending slash/backslash - - installer::remover::remove_ending_pathseparator(\$path); - - if ($installer::globals::iswin) - { - $path =~ s/\\/\//g; - $fileurl = "file\:\/\/\/" . $path; - } - else - { - $fileurl = "file\:\/\/" . $path; - } - - return $fileurl; -} - -################################################################ -# Determining all sourcepath from the uno components -################################################################ - -sub get_all_sourcepathes -{ - my ( $filesref ) = @_; - - my @pathes = (); - - for ( my $i = 0; $i <= $#{$filesref}; $i++ ) - { - my $onefile = ${$filesref}[$i]; - my $path = $onefile->{'sourcepath'}; - - installer::pathanalyzer::get_path_from_fullqualifiedname(\$path); - - if (! installer::existence::exists_in_array($path, \@pathes)) - { - push(@pathes, $path); - } - } - - return \@pathes; -} - -################################################################ -# Registering all uno component files in the services.rdb -################################################################ - -sub register_unocomponents -{ - my ($allvariableshashref, $unocomponents, $regcompfileref, $servicesfile, $nativeservicesurlprefix) = @_; - - installer::logger::include_header_into_logfile("Registering UNO components:"); - - my $error_occurred = 0; - my $filestring = ""; - for ( my $i = 0; $i <= $#{$unocomponents}; ++$i ) - { - my $local_error1_occurred = 0; - my $local_error2_occurred = 0; - - my $sourcepath = make_file_url(${$unocomponents}[$i]->{'sourcepath'}); - my $urlprefix = ${$unocomponents}[$i]->{'NativeServicesURLPrefix'}; - if (defined($urlprefix)) - { - $local_error1_occurred = call_regcomp($regcompfileref, $servicesfile, $sourcepath, $urlprefix); - } - else - { - $filestring .= ";" unless $filestring eq ""; - $filestring .= $sourcepath; - } - if (length($filestring) > $installer::globals::unomaxservices || - ($i == $#{$unocomponents} && $filestring ne "")) - { - $local_error2_occurred = call_regcomp($regcompfileref, $servicesfile, $filestring, $nativeservicesurlprefix); - $filestring = ""; - } - - if (( $local_error1_occurred ) || ( $local_error2_occurred )) { $error_occurred = 1; } - } - - return $error_occurred; -} - -sub call_regcomp -{ - my ($regcompfileref, $servicesfile, $filestring, $urlprefix) = @_; - my @regcompoutput = (); - - my $error_occurred = 0; - - my $systemcall = "$$regcompfileref -register -r ".fix_cygwin_path($servicesfile)." -c " . $installer::globals::quote . $filestring . $installer::globals::quote . " -wop=" . $installer::globals::quote . $urlprefix . $installer::globals::quote . " 2\>\&1 |"; - - open (REG, "$systemcall"); - while (<REG>) {push(@regcompoutput, $_); } - close (REG); - - my $returnvalue = $?; # $? contains the return value of the systemcall - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $j = 0; $j <= $#regcompoutput; $j++ ) { push( @installer::globals::logfileinfo, "$regcompoutput[$j]"); } - - if ($returnvalue) - { - $infoline = "ERROR: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - $error_occurred = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - } - - return $error_occurred; -} - -################################################################ -# Registering all java component files in the services.rdb -################################################################ - -sub register_javacomponents -{ - my ($allvariableshashref, $javacomponents, $regcompfileref, $servicesfile, $regcomprdb, $javaservicesurlprefix) = @_; - - installer::logger::include_header_into_logfile("Registering Java components:"); - - my $ridljar_ref = "ridl.jar"; - my $ure_internal_java_dir_ref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$ridljar_ref, "", 1); - installer::pathanalyzer::get_path_from_fullqualifiedname($ure_internal_java_dir_ref); - if ( $$ure_internal_java_dir_ref eq "" ) { installer::exiter::exit_program("Could not determine URE_INTERNAL_JAVA_DIR when registering Java components!", "register_javacomponents"); } - - my $error_occurred = 0; - - my $do_register = 1; - if (!( $installer::globals::solarjava )) { $do_register = 0; } - - if ( $do_register ) - { - my $filestring = ""; - - for ( my $i = 0; $i <= $#{$javacomponents}; ) - { - my $sourcepath = ${$javacomponents}[$i++]->{'sourcepath'}; - - $filestring = $filestring . make_file_url($sourcepath); - - if ( $i % $installer::globals::javamaxservices == 0 || $i > $#{$javacomponents} ) # limiting to $installer::globals::maxservices files - { - my @regcompoutput = (); - - my $systemcall = "$$regcompfileref -register -br ".fix_cygwin_path($regcomprdb)." -r ".fix_cygwin_path($servicesfile)." -c " . $installer::globals::quote . $filestring . $installer::globals::quote . " -l com.sun.star.loader.Java2 -wop=" . $installer::globals::quote . $javaservicesurlprefix . $installer::globals::quote ." -env:URE_INTERNAL_JAVA_DIR=" . $installer::globals::quote . make_file_url($$ure_internal_java_dir_ref) . $installer::globals::quote . " 2\>\&1 |"; - - open (REG, "$systemcall"); - while (<REG>) {push(@regcompoutput, $_); } - close (REG); - - my $returnvalue = $?; # $? contains the return value of the systemcall - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $k = 0; $k <= $#regcompoutput; $k++ ) { push( @installer::globals::logfileinfo, "$regcompoutput[$k]"); } - - if ($returnvalue) - { - $infoline = "ERROR: $systemcall\n"; - $error_occurred = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - } - - push( @installer::globals::logfileinfo, $infoline); - - $filestring = ""; - } - else - { - $filestring = $filestring . ";"; - } - } - } - - return $error_occurred; -} - - - -################################################################ -# Helper routine to change cygwin (POSIX) path to DOS notation -# if needed -################################################################ -sub fix_cygwin_path -{ - my ( $path ) = @_; - - if ( $installer::globals::iswin eq 1 ) - { - $path = qx{cygpath -m "$path"}; - chomp($path); - } - - return $path; -} - - - -################################################################ -# Registering all uno component files in the services.rdb -################################################################ -sub get_source_path_cygwin_safe -{ - my ( $name, $array, $int ) = @_; - - my $ret = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$name, $array, $int); - if ( $installer::globals::iswin eq 1 ) - { - if( substr( $$ret, 1,1 ) eq ":" ) - { - chomp($$ret = qx{cygpath -u "$$ret"}); - } - } - return $ret; -} - -sub register_pythoncomponents -{ - my ($pythoncomponents, $regcompfileref, $servicesfile,$includepatharrayref) = @_; - - installer::logger::include_header_into_logfile("Registering python UNO components:"); - - my $error_occurred = 0; - my $counter = 0; - - my $systemcall = ""; - - my $allsourcepathes = get_all_sourcepathes($pythoncomponents); - - for ( my $j = 0; $j <= $#{$allsourcepathes}; $j++ ) - { - my $filestring = ""; - my $onesourcepath = ${$allsourcepathes}[$j]; - my $to = ""; - my $from = cwd(); - if ( $installer::globals::iswin ) { $from =~ s/\//\\/g; } - - my $typesrdbname = "types.rdb"; - - # FIXME: Remove the unneeded - # get_source_path_cygwin_safe() -> fix_cygwin_path() - # when WRAPCMD is gone - my $typesrdbref = get_source_path_cygwin_safe($typesrdbname, $includepatharrayref, 1); - - if ( $$typesrdbref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $typesrdbname !", "register_pythoncomponents"); } - - my $pyunoservicesrdbname = "pyuno_services.rdb"; - my $pyunoservicesrdbref = get_source_path_cygwin_safe($pyunoservicesrdbname, $includepatharrayref, 1); - - if ( $$pyunoservicesrdbref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $pyunoservicesrname !", "register_pythoncomponents"); } - - for ( my $i = 0; $i <= $#{$pythoncomponents}; $i++ ) - { - my $doinclude = 1; - my $sourcepath = ${$pythoncomponents}[$i]->{'sourcepath'}; - - $to = $sourcepath; - installer::pathanalyzer::get_path_from_fullqualifiedname(\$to); - - if (!($to eq $onesourcepath)) { $doinclude = 0; } - - if ( $doinclude ) - { - my $filename = ${$pythoncomponents}[$i]->{'Name'}; - $filestring = $filestring . $filename . "\;"; - $counter++; - } - - if ( $counter > 0 ) - { - $filestring =~ s/\;\s*$//; - $filestring = substr( $filestring, 0, length($filestring)-3); - chdir($onesourcepath); - - my @regcompoutput = (); - - $systemcall = "$$regcompfileref -register" - . " -br " . fix_cygwin_path($$typesrdbref) - . " -br " . fix_cygwin_path($$pyunoservicesrdbref) - . " -r " . fix_cygwin_path($servicesfile) - . " -c vnd.openoffice.pymodule:" . $filestring . " -l com.sun.star.loader.Python 2\>\&1 |"; - - open (REG, "$systemcall"); - while (<REG>) {push(@regcompoutput, $_); } - close (REG); - - my $returnvalue = $?; # $? contains the return value of the systemcall - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $j = 0; $j <= $#regcompoutput; $j++ ) { push( @installer::globals::logfileinfo, "$regcompoutput[$j]"); } - - if ($returnvalue) - { - $infoline = "ERROR: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - $error_occurred = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - } - - chdir($from); - - $counter = 0; - $filestring = ""; - } - } - } - - return $error_occurred; -} - -################################################################ -# Iterating over all files, to find all files with the -# style UNO_COMPONENT. This can be libraries and jar files. -################################################################ - -sub register_all_components -{ - my ( $allvariableshashref, $servicesgid, $filesarrayref, $regcompfileref, $servicesfile, $regcomprdb, $includepatharrayref, $nativeservicesurlprefix, $javaservicesurlprefix ) = @_; - - my $registererrorflag = 0; - - my @unocomponents = (); - my @javacomponents = (); - my @pythoncomponents = (); - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - my $styles = ""; - my $regmergefile = ""; - my $registryid = ""; - - if ( $onefile->{'RegistryID'} ) { $registryid = $onefile->{'RegistryID'}; } - - if ( $servicesgid ne $registryid ) { next; } # only registration for the current $servicesgid - - if ( $onefile->{'Regmergefile'} ) { $regmergefile = $onefile->{'Regmergefile'}; } - - if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } - - if (( $styles =~ /\bUNO_COMPONENT\b/ ) && ( $regmergefile eq "" )) # regmergefiles will not be registered with regcomp - { - my $filename = $onefile->{'Name'}; - - if ( $filename =~ /\.jar\s*$/ ) # java component - { - push(@javacomponents, $onefile); - } - elsif( $filename =~ /\.py\s*$/ ) # python_component - { - push(@pythoncomponents, $onefile); - } - else # uno component - { - push(@unocomponents, $onefile); - } - } - } - - $uno_error_occurred = 0; - $java_error_occurred = 0; - $python_error_occurred = 0; - - if ( $#unocomponents > -1 ) { $uno_error_occurred = register_unocomponents($allvariableshashref, \@unocomponents, $regcompfileref, $servicesfile, $nativeservicesurlprefix); } - if ( $#javacomponents > -1 ) { $java_error_occurred = register_javacomponents($allvariableshashref, \@javacomponents, $regcompfileref, $servicesfile, $regcomprdb, $javaservicesurlprefix); } - if ( $#pythoncomponents > -1 ) { $python_error_occurred = register_pythoncomponents(\@pythoncomponents, $regcompfileref, $servicesfile, $includepatharrayref); } - - if ( $uno_error_occurred || $java_error_occurred || $python_error_occurred ) { $registererrorflag = 1; } - - return $registererrorflag; -} - -################################################### -# Include the solver lib directory into -# the LD_LIBRARY_PATH for Unix platforms -################################################### - -sub include_libdir_into_ld_library_path -{ - my ( $var, $binfile ) = @_; - - my $ld_library_path = $binfile; - installer::pathanalyzer::get_path_from_fullqualifiedname(\$ld_library_path); - $ld_library_path =~ s/\/\s*$//; # removing ending slashes - $ld_library_path =~ s/\/bin\./\/lib\./; - $ld_library_path =~ s/\/bin\s*$/\/lib/; # when packing from flat - - my $oldldlibrarypathstring = $ENV{$var}; - my $new_ld_library_path = $ld_library_path; - if ( defined $oldldlibrarypathstring ) { - $new_ld_library_path = $new_ld_library_path . $installer::globals::pathseparator . $oldldlibrarypathstring; - } - if ( $ENV{'SYSTEM_MOZILLA'} && $ENV{'SYSTEM_MOZILLA'} eq "YES" && - (!$ENV{'WITH_OPENLDAP'} || $ENV{'WITH_OPENLDAP'} ne "YES")) { - $new_ld_library_path = $new_ld_library_path . $installer::globals::pathseparator . $ENV{'MOZ_LIB'}; - } - $ENV{$var} = $new_ld_library_path; - - my $infoline = "Setting $var to $ENV{$var}\n"; - push( @installer::globals::logfileinfo, $infoline); -} - -################################################################## -# Setting the needed jar files into the CLASSPATH -# They are needed from regcomp. -# The jar files are defined in @installer::globals::regcompjars -################################################################## - -sub prepare_classpath_for_java_registration -{ - my ( $includepatharrayref ) = @_; - my $local_pathseparator = $installer::globals::pathseparator; - - if( $^O =~ /cygwin/i ) - { # $CLASSPATH must use DOS separator even when using cygwin's perl - $local_pathseparator = ';'; - } - - for ( my $i = 0; $i <= $#installer::globals::regcompjars; $i++ ) - { - my $filename = $installer::globals::regcompjars[$i]; - - my $jarfileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 1); - - if ( $$jarfileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $filename for registering java components!", "prepare_classpath_for_java_registration"); } - - my $oldclasspathstring = ""; - if ( $ENV{'CLASSPATH'} ) { $oldclasspathstring = $ENV{'CLASSPATH'}; } - else { $oldclasspathstring = "\."; } - my $classpathstring = $$jarfileref . $local_pathseparator . $oldclasspathstring; - if ( $^O =~ /cygwin/i ) { - $classpathstring =~ s/\//\\/g; # guw.pl likes '\' in $PATH. - } - $ENV{'CLASSPATH'} = $classpathstring; - - my $infoline = "Setting CLASSPATH to $ENV{'CLASSPATH'}\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -################################################################## -# Setting the jdk lib into the LD_LIBRARY_PATH (Unix) -# This is used by regcomp to register Java components. -# The jdk lib is defined in $installer::globals::jdklib -################################################################## - -sub add_jdklib_into_ld_library_path -{ - my ($var) = @_; - if (defined $installer::globals::jdklib) { - my $oldldlibrarypathstring = $ENV{$var}; - my $new_ld_library_path = $installer::globals::jdklib; - if (defined $oldldlibrarypathstring) { - $new_ld_library_path .= - $installer::globals::pathseparator . $oldldlibrarypathstring; - } - $ENV{$var} = $new_ld_library_path; - my $infoline = "Setting $var to $ENV{$var}\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -################################################################## -# Adding the libraries included in zip files into path variable -# (for example mozruntime.zip). This is needed to register all -# libraries successfully. -################################################################## - -sub add_path_to_pathvariable_directory -{ - my ( $filesarrayref, $searchstring ) = @_; - - # determining the path - - my $path = ""; - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - my $sourcepath = $onefile->{'sourcepath'}; - - installer::pathanalyzer::get_path_from_fullqualifiedname(\$sourcepath); - installer::remover::remove_ending_pathseparator(\$sourcepath); - - if ( $sourcepath =~ /\Q$searchstring\E\s*$/ ) - { - $path = $sourcepath; - last; - } - } - - # adding the path to the PATH variable - - if ( $path ne "" ) - { - my $oldpath = ""; - if ( $ENV{'PATH'} ) { $oldpath = $ENV{'PATH'}; } - else { $oldpath = "\."; } - if ( $^O =~ /cygwin/i ) { - $path = qx(cygpath -u "$path"); - chomp $path; - } - my $newpath = $path . $installer::globals::pathseparator . $oldpath; - $ENV{'PATH'} = $newpath; - - my $infoline = "Setting PATH to $ENV{'PATH'}\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -################################################################## -# Adding the path of a specified library to the path variable -# (for example msvcr70.dll). This is needed to register all -# libraries successfully. -################################################################## - -sub add_path_to_pathvariable -{ - my ( $filesarrayref, $searchstring ) = @_; - - # determining the path - - my $path = ""; - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - my $sourcepath = $onefile->{'sourcepath'}; - - if ( $sourcepath =~ /\Q$searchstring\E\s*$/ ) - { - installer::pathanalyzer::get_path_from_fullqualifiedname(\$sourcepath); - installer::remover::remove_ending_pathseparator(\$sourcepath); - $path = $sourcepath; - last; - } - } - - # adding the path to the PATH variable - - if ( $path ne "" ) - { - my $oldpath = ""; - if ( $ENV{'PATH'} ) { $oldpath = $ENV{'PATH'}; } - else { $oldpath = "\."; } - if ( $^O =~ /cygwin/i ) { - $path = qx(cygpath -u "$path"); - chomp $path; - } - my $newpath = $path . $installer::globals::pathseparator . $oldpath; - $ENV{'PATH'} = $newpath; - - my $infoline = "Setting PATH to $ENV{'PATH'}\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -################################################################## -# Setting the jre path into the PATH (Windows only) -# This is used by regcomp.exe to register Java components. -# The jre path is saved in $installer::globals::jrepath -################################################################## - -sub add_jrepath_into_path -{ - my $oldpath = ""; - if ( $ENV{'PATH'} ) { $oldpath = $ENV{'PATH'}; } - else { $oldpath = "\."; } - - if ( $installer::globals::jrepath ne "" ) - { - my $newpath = $installer::globals::jrepath . $installer::globals::pathseparator . $oldpath; - $ENV{'PATH'} = $newpath; - - my $infoline = "Setting PATH to $ENV{'PATH'}\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -####################################################################################### -# Preparing a registry "regcomp.rdb" which regcomp can work on (types+java services). -# Copying the "udkapi.rdb", renaming it to "regcomp.rdb" and registering the -# libraries @installer::globals::regcompregisterlibs, which are javavm.uno.so -# and javaloader.uno.so or javavm.uno.dll and javaloader.uno.dll -####################################################################################### - -sub prepare_regcomp_rdb -{ - my ( $regcompfile, $servicesdir, $includepatharrayref) = @_; - - # udkapi.rdb has to be found in the sourcepath - - my $filename = "udkapi.rdb"; - my $udkapirdbref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 1); - if ( $$udkapirdbref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $filename for creating regcomp.rdb!", "prepare_regcomp_rdb"); } - - my $regcompfilename = "regcomp.rdb"; - my $regcomprdb = $servicesdir . $installer::globals::separator . $regcompfilename; - - # If there is an older version of this file, it has to be removed - if ( -f $regcomprdb ) { unlink($regcomprdb); } - - installer::systemactions::copy_one_file($$udkapirdbref, $regcomprdb); - - # now the libraries in @installer::globals::regcompregisterlibs can be registered in the "regcomp.rdb" - - for ( my $i = 0; $i <= $#installer::globals::regcompregisterlibs; $i++ ) - { - my $libfilename = $installer::globals::regcompregisterlibs[$i] . $installer::globals::libextension; - my $libfileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$libfilename, $includepatharrayref, 1); - if ( $$libfileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $libfilename for creating regcomp.rdb!", "prepare_regcomp_rdb"); } - - my $from = cwd(); - if ( $installer::globals::iswin ) { $from =~ s/\//\\/g; } - - my $to = $$libfileref; - installer::pathanalyzer::get_path_from_fullqualifiedname(\$to); - - chdir($to); - - my $systemcall = "$regcompfile -register -s -r " . fix_cygwin_path($regcomprdb) . " -c $libfilename"; - - my $returnvalue = system($systemcall); - - chdir($from); - - my $infoline; - if ($returnvalue) { $infoline = "ERROR: $systemcall\n"; } - else { $infoline = "SUCCESS: $systemcall\n"; } - - push( @installer::globals::logfileinfo, $infoline); - } - - return $regcomprdb; -} - -################################################################ -# Collecting all gids of the databases, that are part of -# the file definition -################################################################ - -sub collect_all_services_gids -{ - my ($filesarrayref) = @_; - - my @databasegids = (); - my $error_occurred = 0; - my @error_files = (); - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - - if ( $onefile->{'RegistryID'} ) - { - my $databasegid = $onefile->{'RegistryID'}; - if (! installer::existence::exists_in_array($databasegid, \@databasegids)) { push(@databasegids, $databasegid); } - } - else - { - push(@error_files, $onefile->{'gid'}); - $error_occurred = 1; - } - } - - if ( $error_occurred ) - { - my $infoline = "ERROR: Style UNO_COMPONENT is set, but no RegistryID is assigned!\n"; - push( @installer::globals::logfileinfo, $infoline); - print $infoline; - - for ( my $j = 0; $j <= $#error_files; $j++ ) - { - $infoline = "$error_files[$j]\n"; - push( @installer::globals::logfileinfo, $infoline); - print $infoline; - } - - installer::exiter::exit_program("ERROR: File defintion error.", "collect_all_services_gids"); - } - - return \@databasegids; -} - -###################################################################### -# All gids in $databasegids are as RegistryID assigned to files. -# For all this Registry Files a definition has to exist. -###################################################################### - -sub check_defintion_of_databasegids -{ - my ($databasegids, $registryfiles) = @_; - - my @registryfiles = (); - - # First check: For all assigned Registry files, a definition of - # a file with flag STARREGISTRY has to exist. - - for ( my $i = 0; $i <= $#{$databasegids}; $i++ ) - { - my $onegid = ${$databasegids}[$i]; - my $gid_defined = 0; - - for ( my $j = 0; $j <= $#{$registryfiles}; $j++ ) - { - my $registrygid = ${$registryfiles}[$j]->{'gid'}; - - if ( $onegid eq $registrygid ) - { - $gid_defined = 1; - last; - } - } - - if ( ! $gid_defined ) - { - installer::exiter::exit_program("ERROR: Gid $onegid is assigned to file(s), but not defined!", "check_defintion_of_databasegids"); - } - } - - # Second check: If there is a file defined as StarRegistry, is a file with flag UNO_COMPONENT assigned? - - for ( my $j = 0; $j <= $#{$registryfiles}; $j++ ) - { - my $onefile = ${$registryfiles}[$j]; - my $registrygid = $onefile->{'gid'}; - - my $gid_assigned = 0; - - for ( my $i = 0; $i <= $#{$databasegids}; $i++ ) - { - my $onegid = ${$databasegids}[$i]; - - if ( $onegid eq $registrygid ) - { - $gid_assigned = 1; - last; - } - } - - if ( ! $gid_assigned ) - { - my $infoline = "Warning: $registrygid is defined with flag STARREGISTRY, but no file is assigned to the registry.\n"; - push( @installer::globals::logfileinfo, $infoline); - } - else - { - push(@registryfiles, $onefile); - } - } - - return \@registryfiles; -} - -################################################################ -# Some files have flag UNO_COMPONENT, but are not registered -# with regcomp. This files use the regmerge mechanism, that -# is not used in this perl-file. Therefore this files -# have to be filtered out here. -################################################################ - -sub filter_regmergefiles -{ - my ($unocomponentfiles) = @_; - - my @regcompfiles = (); - - for ( my $i = 0; $i <= $#{$unocomponentfiles}; $i++ ) - { - my $onefile = ${$unocomponentfiles}[$i]; - my $regmergefile = ""; - - if ( $onefile->{'Regmergefile'} ) { $regmergefile = $onefile->{'Regmergefile'}; } - if ( $regmergefile ne "" ) { next; } - - push(@regcompfiles, $onefile); - } - - return \@regcompfiles; -} - -################################################################ -# Setting defaults for Creating services.rdb file by registering all uno components -################################################################ - -sub set_url_prefixes -{ - my ( $registryfile ) = @_; - - my $nativeservicesurlprefix = ""; - my $javaservicesurlprefix = ""; - - if ( $registryfile->{'NativeServicesURLPrefix'} ) { $nativeservicesurlprefix = $registryfile->{'NativeServicesURLPrefix'}; } - else { $nativeservicesurlprefix = "vnd.sun.star.expand:\$ORIGIN/"; } - - if ( $registryfile->{'JavaServicesURLPrefix'} ) { $javaservicesurlprefix = $registryfile->{'JavaServicesURLPrefix'}; } - else { $javaservicesurlprefix = "vnd.sun.star.expand:\$UNO_JAVA_COMPONENT_PATH/"; } - - return ($nativeservicesurlprefix, $javaservicesurlprefix); -} - -################################################################ -# Creating services.rdb file by registering all uno components -################################################################ - -sub create_services_rdb -{ - my ($allvariableshashref, $filesarrayref, $includepatharrayref, $languagestringref) = @_; - - # collecting all services files - my $unocomponentfiles = installer::worker::collect_all_items_with_special_flag($filesarrayref, "UNO_COMPONENT"); - $unocomponentfiles = filter_regmergefiles($unocomponentfiles); - - if ( $#{$unocomponentfiles} > -1 ) # not empty -> at least one file with flag UNO_COMPONENT - { - my $databasegids = collect_all_services_gids($unocomponentfiles); - - my $registryfiles = installer::worker::collect_all_items_with_special_flag($filesarrayref, "STARREGISTRY"); - - $registryfiles = check_defintion_of_databasegids($databasegids, $registryfiles); - - # Now the creation of all files with flag STARREGISTRY can begin - - for ( my $i = 0; $i <= $#{$registryfiles}; $i++ ) - { - my $registryfile = ${$registryfiles}[$i]; - - my $servicesname = $registryfile->{'Name'}; # not unique! - my $servicesgid = $registryfile->{'gid'}; # unique - my $uniquedirname = $servicesgid . "_servicesrdb"; - - my ($nativeservicesurlprefix, $javaservicesurlprefix) = set_url_prefixes($registryfile); - - installer::logger::include_header_into_logfile("Creating $servicesname ($servicesgid):"); - - my $servicesdir = installer::systemactions::create_directories($uniquedirname, $languagestringref); - - push(@installer::globals::removedirs, $servicesdir); - - my $servicesfile = $servicesdir . $installer::globals::separator . $servicesname; - - # If there is an older version of this file, it has to be removed - if ( -f $servicesfile ) { unlink($servicesfile); } - - if ( $installer::globals::servicesrdb_can_be_created ) # This has to be done always - { - # Creating the services.rdb in directory "inprogress" - my $origservicesdir = $servicesdir; - $servicesdir = installer::systemactions::make_numbered_dir("inprogress", $servicesdir); - $servicesfile = $servicesdir . $installer::globals::separator . $servicesname; - - # determining the location of the file regcomp - # Because the program regcomp.exe (regcomp) is used now, it has to be taken the version - # from the platform, this script is running. It is not important, for which platform the - # product is built. - - my $searchname; - - if ($installer::globals::isunix) { $searchname = "regcomp"; } - else { $searchname = "regcomp.exe"; } - - $regcompfileref = get_source_path_cygwin_safe($searchname, $includepatharrayref, 1); - if ( $$regcompfileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $searchname for registering uno components!", "create_services_rdb"); } - - # For Windows the libraries included into the mozruntime.zip have to be added to the path - if ($installer::globals::iswin) { add_path_to_pathvariable_directory($filesarrayref, "mozruntime_zip"); } - if ($installer::globals::iswin) { add_path_to_pathvariable($filesarrayref, "msvcr70.dll"); } - - # setting the LD_LIBRARY_PATH, needed by regcomp - # Linux: Take care of the lock daemon. He has to be started! - # For windows it is necessary that "msvcp7x.dll" and "msvcr7x.dll" are included into the path ! - - my $var_library_path; - my $old_library_path; - if ( $installer::globals::isunix ) { - $var_library_path = $installer::globals::ismacosx ? - 'DYLD_LIBRARY_PATH' : 'LD_LIBRARY_PATH'; - $old_library_path = $ENV{$var_library_path}; - include_libdir_into_ld_library_path( - $var_library_path, $$regcompfileref); - } - - my $regcomprdb = ""; - - if ( $installer::globals::solarjava ) # this is needed to register Java components - { - prepare_classpath_for_java_registration($includepatharrayref); - - if ( $installer::globals::isunix ) - { add_jdklib_into_ld_library_path($var_library_path); } - else { add_jrepath_into_path(); } - - # Preparing a registry which regcomp can work on (types+java services). - # Copying the "udkapi.rdb", renaming it to "regcomp.rdb" and registering the - # libraries $(REGISTERLIBS_JAVA), which are javavm.uno.so and javaloader.uno.so - # or javavm.uno.dll and javaloader.uno.dll - - $regcomprdb = prepare_regcomp_rdb($$regcompfileref, $servicesdir, $includepatharrayref); - } - - # and now iteration over all files - - my $error_during_registration = register_all_components($allvariableshashref, $servicesgid, $unocomponentfiles, $regcompfileref, $servicesfile, $regcomprdb, $includepatharrayref, $nativeservicesurlprefix, $javaservicesurlprefix); - - if (defined $var_library_path) { - if (defined $old_library_path) { - $ENV{$var_library_path} = $old_library_path; - } else { - delete $ENV{$var_library_path}; - } - } - - # Dependent from the success, the registration directory can be renamed. - - if ( $error_during_registration ) - { - $servicesdir = installer::systemactions::rename_string_in_directory($servicesdir, "inprogress", "witherror"); - push(@installer::globals::removedirs, $servicesdir); - # and exiting the packaging process - installer::exiter::exit_program("ERROR: Could not register all components for file $servicesname ($servicesgid)!", "create_services_rdb"); - } - else - { - $servicesdir = installer::systemactions::rename_directory($servicesdir, $origservicesdir); - } - - $servicesfile = $servicesdir . $installer::globals::separator . $servicesname; - } - else - { - my $infoline; - - if (!($installer::globals::servicesrdb_can_be_created)) - { - $infoline = "Warning: $servicesname was not created. Build platform and compiler do not match. Build platform: $installer::globals::plat, compiler : $installer::globals::compiler\n"; - push( @installer::globals::logfileinfo, $infoline); - } - - if ( $installer::globals::services_rdb_created ) - { - $infoline = "Info: $servicesname was not created. $servicesfile already exists.\n"; - push( @installer::globals::logfileinfo, $infoline); - } - - if ((!($installer::globals::servicesrdb_can_be_created)) && (!($installer::globals::services_rdb_created))) - { - $infoline = "ERROR: $servicesname was not created and does not exist!\n"; - push( @installer::globals::logfileinfo, $infoline); - } - } - - # Adding the new services file source path to the filearray - $registryfile->{'sourcepath'} = $servicesfile; # setting the sourcepath! - } - } - - # Setting the global variable $installer::globals::services_rdb_created - - $installer::globals::services_rdb_created = 1; -} - -1; diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm index 54959f95b66d..ea3897f10395 100644 --- a/solenv/bin/modules/installer/simplepackage.pm +++ b/solenv/bin/modules/installer/simplepackage.pm @@ -348,9 +348,10 @@ sub replace_one_variable_in_shellscript sub replace_variables_in_scriptfile { - my ($scriptfile, $volume_name, $allvariables) = @_; + my ($scriptfile, $volume_name, $volume_name_app, $allvariables) = @_; replace_one_variable_in_shellscript($scriptfile, $volume_name, "FULLPRODUCTNAME" ); + replace_one_variable_in_shellscript($scriptfile, $volume_name_app, "FULLAPPPRODUCTNAME" ); replace_one_variable_in_shellscript($scriptfile, $allvariables->{'PRODUCTNAME'}, "PRODUCTNAME" ); replace_one_variable_in_shellscript($scriptfile, $allvariables->{'PRODUCTVERSION'}, "PRODUCTVERSION" ); @@ -409,10 +410,17 @@ sub create_package $folder = $packagename; } - my $volume_name = $allvariables->{'PRODUCTNAME'} . ' ' . $allvariables->{'PRODUCTVERSION'}; - $volume_name = $volume_name . ' ' . $allvariables->{'PRODUCTEXTENSION'} if $allvariables->{'PRODUCTEXTENSION'}; + # my $volume_name = $allvariables->{'PRODUCTNAME'} . ' ' . $allvariables->{'PRODUCTVERSION'}; # Adding PRODUCTVERSION makes this difficult to maintain! + my $volume_name = $allvariables->{'PRODUCTNAME'}; + my $volume_name_classic = $allvariables->{'PRODUCTNAME'} . ' ' . $allvariables->{'PRODUCTVERSION'}; + my $volume_name_classic_app = $volume_name; # "app" should not contain version number + # $volume_name = $volume_name . ' ' . $allvariables->{'PRODUCTEXTENSION'} if $allvariables->{'PRODUCTEXTENSION'}; # Adding PRODUCTEXTENSION makes this difficult to maintain! + $volume_name_classic = $volume_name_classic . ' ' . $allvariables->{'PRODUCTEXTENSION'} if $allvariables->{'PRODUCTEXTENSION'}; + $volume_name_classic_app = $volume_name_classic_app . ' ' . $allvariables->{'PRODUCTEXTENSION'} if $allvariables->{'PRODUCTEXTENSION'}; if ( $allvariables->{'DMG_VOLUMEEXTENSION'} ) { $volume_name = $volume_name . ' ' . $allvariables->{'DMG_VOLUMEEXTENSION'}; + $volume_name_classic = $volume_name_classic . ' ' . $allvariables->{'DMG_VOLUMEEXTENSION'}; + $volume_name_classic_app = $volume_name_classic_app . ' ' . $allvariables->{'DMG_VOLUMEEXTENSION'}; } my $sla = 'sla.r'; @@ -428,12 +436,23 @@ sub create_package if (( $installer::globals::languagepack ) || ( $installer::globals::helppack ) || ( $installer::globals::patch )) { $localtempdir = "$tempdir/$packagename"; - if ( $installer::globals::languagepack ) { $volume_name = "$volume_name Language Pack"; } if ( $installer::globals::helppack ) { $volume_name = "$volume_name Help Pack"; } - if ( $installer::globals::patch ) { $volume_name = "$volume_name Patch"; } + if ( $installer::globals::languagepack ) + { + $volume_name = "$volume_name Language Pack"; + $volume_name_classic = "$volume_name_classic Language Pack"; + $volume_name_classic_app = "$volume_name_classic_app Language Pack"; + } + if ( $installer::globals::patch ) + { + $volume_name = "$volume_name Patch"; + $volume_name_classic = "$volume_name_classic Patch"; + $volume_name_classic_app = "$volume_name_classic_app Patch"; + } # Create tar ball named tarball.tar.bz2 - my $appfolder = $localtempdir . "/" . $volume_name . "\.app"; + # my $appfolder = $localtempdir . "/" . $volume_name . "\.app"; + my $appfolder = $localtempdir . "/" . $volume_name_classic_app . "\.app"; my $contentsfolder = $appfolder . "/Contents"; my $tarballname = "tarball.tar.bz2"; @@ -477,7 +496,8 @@ sub create_package if ( $installer::globals::helppack ) { $scriptfilename = "osx_install_helppack.applescript"; } if ( $installer::globals::patch ) { $scriptfilename = "osx_install_patch.applescript"; } my $scripthelpersolverfilename = "mac_install.script"; - my $scripthelperrealfilename = $volume_name; + # my $scripthelperrealfilename = $volume_name; + my $scripthelperrealfilename = $volume_name_classic_app; my $translationfilename = $installer::globals::macinstallfilename; # Finding both files in solver @@ -500,7 +520,8 @@ sub create_package my $scriptfilecontent = installer::files::read_file($scriptfilename); my $translationfilecontent = installer::files::read_file($$translationfileref); localize_scriptfile($scriptfilecontent, $translationfilecontent, $languagestringref); - replace_variables_in_scriptfile($scriptfilecontent, $volume_name, $allvariables); + # replace_variables_in_scriptfile($scriptfilecontent, $volume_name, $allvariables); + replace_variables_in_scriptfile($scriptfilecontent, $volume_name_classic, $volume_name_classic_app, $allvariables); installer::files::save_file($scriptfilename, $scriptfilecontent); chmod 0775, $scriptfilename; @@ -525,7 +546,8 @@ sub create_package # Replacing variables in Info.plist $scriptfilecontent = installer::files::read_file($destfile); - replace_one_variable_in_shellscript($scriptfilecontent, $volume_name, "FULLPRODUCTNAME" ); + # replace_one_variable_in_shellscript($scriptfilecontent, $volume_name, "FULLPRODUCTNAME" ); + replace_one_variable_in_shellscript($scriptfilecontent, $volume_name_classic_app, "FULLAPPPRODUCTNAME" ); # OpenOffice.org Language Pack installer::files::save_file($destfile, $scriptfilecontent); chdir $localfrom; diff --git a/solenv/bin/modules/installer/substfilenamefiles.pm b/solenv/bin/modules/installer/substfilenamefiles.pm index 2a2b22eab53c..98906913c159 100644 --- a/solenv/bin/modules/installer/substfilenamefiles.pm +++ b/solenv/bin/modules/installer/substfilenamefiles.pm @@ -34,8 +34,7 @@ use installer::pathanalyzer; use installer::systemactions; ######################################################### -# Analyzing files with flag SCPZIP_REPLACE -# $item can be "File" or "ScpAction" +# Analyzing files with flag SUBST_FILENAME ######################################################### sub resolving_subst_filename_flag diff --git a/solenv/bin/modules/installer/windows/component.pm b/solenv/bin/modules/installer/windows/component.pm index 498a86c2d319..da11997e5f83 100644 --- a/solenv/bin/modules/installer/windows/component.pm +++ b/solenv/bin/modules/installer/windows/component.pm @@ -198,7 +198,7 @@ sub get_registry_component_directory sub get_file_component_attributes { - my ($componentname, $filesref) = @_; + my ($componentname, $filesref, $allvariables) = @_; my $attributes; @@ -245,6 +245,9 @@ sub get_file_component_attributes $attributes = 4; # Files in shellnew dir and in non advertised startmenu entries must have user registry key as KeyPath } + # Adding 256, if this is a 64 bit installation set. + if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $attributes = $attributes + 256; } + return $attributes } @@ -256,12 +259,15 @@ sub get_file_component_attributes sub get_registry_component_attributes { - my ($componentname) = @_; + my ($componentname, $allvariables) = @_; my $attributes; $attributes = 4; + # Adding 256, if this is a 64 bit installation set. + if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $attributes = $attributes + 256; } + if ( exists($installer::globals::dontdeletecomponents{$componentname}) ) { $attributes = $attributes + 16; } return $attributes @@ -386,7 +392,7 @@ sub get_component_keypath sub create_component_table { - my ($filesref, $registryref, $dirref, $allfilecomponentsref, $allregistrycomponents, $basedir, $componentidhashref, $componentidkeypathhashref) = @_; + my ($filesref, $registryref, $dirref, $allfilecomponentsref, $allregistrycomponents, $basedir, $componentidhashref, $componentidkeypathhashref, $allvariables) = @_; my @componenttable = (); @@ -404,7 +410,7 @@ sub create_component_table $onecomponent{'guid'} = get_component_guid($onecomponent{'name'}, $componentidhashref); $onecomponent{'directory'} = get_file_component_directory($onecomponent{'name'}, $filesref, $dirref); if ( $onecomponent{'directory'} eq "IGNORE_COMP" ) { next; } - $onecomponent{'attributes'} = get_file_component_attributes($onecomponent{'name'}, $filesref); + $onecomponent{'attributes'} = get_file_component_attributes($onecomponent{'name'}, $filesref, $allvariables); $onecomponent{'condition'} = get_file_component_condition($onecomponent{'name'}, $filesref); $onecomponent{'keypath'} = get_component_keypath($onecomponent{'name'}, $filesref, $componentidkeypathhashref); @@ -423,7 +429,7 @@ sub create_component_table $onecomponent{'name'} = ${$allregistrycomponents}[$i]; $onecomponent{'guid'} = get_component_guid($onecomponent{'name'}, $componentidhashref); $onecomponent{'directory'} = get_registry_component_directory(); - $onecomponent{'attributes'} = get_registry_component_attributes($onecomponent{'name'}); + $onecomponent{'attributes'} = get_registry_component_attributes($onecomponent{'name'}, $allvariables); $onecomponent{'condition'} = get_component_condition($onecomponent{'name'}); $onecomponent{'keypath'} = get_component_keypath($onecomponent{'name'}, $registryref, $componentidkeypathhashref); diff --git a/solenv/bin/modules/installer/windows/directory.pm b/solenv/bin/modules/installer/windows/directory.pm index 98134c8ef5b6..9ab583b5ed29 100644 --- a/solenv/bin/modules/installer/windows/directory.pm +++ b/solenv/bin/modules/installer/windows/directory.pm @@ -77,19 +77,78 @@ sub overwrite_programfilesfolder } ############################################################## +# Maximum length of directory name is 72. +# Taking care of underlines, which are the separator. +############################################################## + +sub make_short_dir_version +{ + my ($longstring, $length, $displayname) = @_; + + my $shortstring = ""; + my $infoline = ""; + my $savestring = $longstring; + + # Splitting the string at each "underline" and allowing only $length characters per directory name. + # Checking also uniqueness and length. + + my $stringarray = installer::converter::convert_stringlist_into_array_without_newline(\$longstring, "_"); + + foreach my $onestring ( @{$stringarray} ) + { + my $partstring = ""; + + if ( $onestring =~ /\-/ ) + { + my $localstringarray = installer::converter::convert_stringlist_into_array_without_newline(\$onestring, "-"); + foreach my $onelocalstring ( @{$localstringarray} ) + { + if ( length($onelocalstring) > $length ) { $onelocalstring = substr($onelocalstring, 0, $length); } + $partstring = $partstring . "-" . $onelocalstring; + } + $partstring =~ s/^\s*\-//; + } + else + { + if ( length($onestring) > $length ) { $partstring = substr($onestring, 0, $length); } + else { $partstring = $onestring; } + } + + $shortstring = $shortstring . "_" . $partstring; + } + + $shortstring =~ s/^\s*\_//; + + if ( length($shortstring) > 72 ) + { + my $shortlength = length($shortstring); + $infoline = "WARNING: Failed to create unique directory name with less than 72 characters: \"$displayname\" ($shortstring ($shortlength)).\n"; + push(@installer::globals::logfileinfo, $infoline); + } + + return $shortstring; +} + +############################################################## # Adding unique directory names to the directory collection ############################################################## sub create_unique_directorynames { - my ($directoryref) = @_; + my ($directoryref, $allvariables) = @_; $installer::globals::officeinstalldirectoryset = 0; + my %conversionhash = (); + my $infoline = ""; + my $errorcount = 0; + for ( my $i = 0; $i <= $#{$directoryref}; $i++ ) { my $onedir = ${$directoryref}[$i]; - my $uniquename = $onedir->{'HostName'}; + my $hostname = $onedir->{'HostName'}; + + my $uniquename = $hostname; my $styles = ""; if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; } # get_path_from_fullqualifiedname(\$uniqueparentname); @@ -101,6 +160,42 @@ sub create_unique_directorynames $uniquename =~ s/\_//g; # removing existing underlines $uniquename =~ s/\.//g; # removing dots in directoryname $uniquename =~ s/\Q$installer::globals::separator\E/\_/g; # replacing slash and backslash with underline + $uniquename =~ s/OpenOffice/OO/g; + $uniquename =~ s/_registry/_rgy/g; + $uniquename =~ s/_registration/_rgn/g; + $uniquename =~ s/_extension/_ext/g; + $uniquename =~ s/_frame/_frm/g; + $uniquename =~ s/_table/_tbl/g; + $uniquename =~ s/_chart/_crt/g; + + my $startlength = 5; + + if ( ! $allvariables->{'NOSHORTDIRECTORYNAMES'} ) + { + # This process does not work for SDK, because of its long and similar pathes + $uniquename = make_short_dir_version($uniquename, $startlength, $hostname); # taking care of underlines! + } + + if ( exists($installer::globals::alluniquedirectorynames{$uniquename}) ) + { + # This is an error, that must stop the packaging process + $errorcount++; + + $infoline = "$errorcount: Already existing unique directory: $uniquename\n"; + push( @installer::globals::logfileinfo, $infoline); + $infoline = "$errorcount: First full directory: $conversionhash{$uniquename}\n"; + push( @installer::globals::logfileinfo, $infoline); + $infoline = "$errorcount: Current full directory: $hostname\n"; + push( @installer::globals::logfileinfo, $infoline); + } + + $conversionhash{$uniquename} = $hostname; + + $installer::globals::alluniquedirectorynames{$uniquename} = 1; + + # Important: The unique parent is generated from the string $uniquename. Therefore counters + # like adding "_1" is not allowed to achive uniqueness, because this depends from other directories + # and does not deliver always the same result. my $uniqueparentname = $uniquename; @@ -147,6 +242,11 @@ sub create_unique_directorynames $installer::globals::vendordirectoryset = 1; } } + + if ( $errorcount > 0 ) + { + installer::exiter::exit_program("ERROR: Failed to create unique directory names.", "create_unique_directorynames"); + } } ##################################################### @@ -441,8 +541,9 @@ sub create_directory_table my $infoline; overwrite_programfilesfolder($allvariableshashref); - create_unique_directorynames($directoryref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforidt_local_1.log", $directoryref); } + create_unique_directorynames($directoryref, $allvariableshashref); + if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforidt_local_1a.log", $directoryref); } create_defaultdir_directorynames($directoryref, $shortdirnamehashref); # only destdir! if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforidt_local_2.log", $directoryref); } set_installlocation_directory($directoryref, $allvariableshashref); diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm index 8396df3de157..059c394278d6 100644 --- a/solenv/bin/modules/installer/windows/file.pm +++ b/solenv/bin/modules/installer/windows/file.pm @@ -170,6 +170,40 @@ sub assign_sequencenumbers_to_files } } +######################################################### +# Create a shorter version of a long component name, +# because maximum length in msi database is 72. +# Attention: In multi msi installation sets, the short +# names have to be unique over all packages, because +# this string is used to create the globally unique id +# -> no resetting of +# %installer::globals::allshortcomponents +# after a package was created. +######################################################### + +sub generate_new_short_componentname +{ + my ($componentname) = @_; + + my $shortcomponentname = ""; + my $counter = 1; + + my $startversion = substr($componentname, 0, 60); # taking only the first 60 characters + $startversion = $startversion . "_"; + + $shortcomponentname = $startversion . $counter; + + while ( exists($installer::globals::allshortcomponents{$shortcomponentname}) ) + { + $counter++; + $shortcomponentname = $startversion . $counter; + } + + $installer::globals::allshortcomponents{$shortcomponentname} = 1; + + return $shortcomponentname; +} + ############################################### # Generating the component name from a file ############################################### @@ -178,77 +212,139 @@ sub get_file_component_name { my ($fileref, $filesref) = @_; - # In this function exists the rule to create components from files - # Rule: - # Two files get the same componentid, if: - # both have the same destination directory. - # both have the same "gid" -> both were packed in the same zip file - # All other files are included into different components! - - # my $componentname = $fileref->{'gid'} . "_" . $fileref->{'Dir'}; - - # $fileref->{'Dir'} is not sufficient! All files in a zip file have the same $fileref->{'Dir'}, - # but can be in different subdirectories. - # Solution: destination=share\Scripts\beanshell\Capitalise\capitalise.bsh - # in which the filename (capitalise.bsh) has to be removed and all backslashes (slashes) are - # converted into underline. - - my $destination = $fileref->{'destination'}; - installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination); - $destination =~ s/\s//g; - $destination =~ s/\\/\_/g; - $destination =~ s/\//\_/g; - $destination =~ s/\_\s*$//g; # removing ending underline - - my $componentname = $fileref->{'gid'} . "__" . $destination; - - # Files with different languages, need to be packed into different components. - # Then the installation of the language specific component is determined by a language condition. - - if ( $fileref->{'ismultilingual'} ) - { - my $officelanguage = $fileref->{'specificlanguage'}; - $componentname = $componentname . "_" . $officelanguage; - } - - $componentname = lc($componentname); # componentnames always lowercase - - $componentname =~ s/\-/\_/g; # converting "-" to "_" - $componentname =~ s/\./\_/g; # converting "-" to "_" - - # Attention: Maximum length for the componentname is 72 - - $componentname =~ s/gid_file_/g_f_/g; - $componentname =~ s/_extra_/_e_/g; - $componentname =~ s/_config_/_c_/g; - $componentname =~ s/_org_openoffice_/_o_o_/g; - $componentname =~ s/_program_/_p_/g; - $componentname =~ s/_typedetection_/_td_/g; - $componentname =~ s/_linguistic_/_l_/g; - $componentname =~ s/_module_/_m_/g; - $componentname =~ s/_optional_/_opt_/g; - $componentname =~ s/_packages/_pack/g; - $componentname =~ s/_menubar/_mb/g; - $componentname =~ s/_common_/_cm_/g; - $componentname =~ s/_export_/_exp_/g; - $componentname =~ s/_table_/_tb_/g; - $componentname =~ s/_sofficecfg_/_sc_/g; - $componentname =~ s/_startmodulecommands_/_smc_/g; - $componentname =~ s/_drawimpresscommands_/_dic_/g; - $componentname =~ s/_basiccommands_/_bac_/g; - $componentname =~ s/_basicidecommands_/_baic_/g; - $componentname =~ s/_genericcommands_/_genc_/g; - $componentname =~ s/_bibliographycommands_/_bibc_/g; - $componentname =~ s/_share_/_s_/g; - $componentname =~ s/_modules_/_ms_/g; - $componentname =~ s/_uiconfig_zip_/_ucz_/g; - $componentname =~ s/_soffice_cfg_/_sc_/g; - - # All this is not necessary for files, which have the flag ASSIGNCOMPOMENT + my $componentname = ""; + + # Special handling for files with ASSIGNCOMPOMENT my $styles = ""; if ( $fileref->{'Styles'} ) { $styles = $fileref->{'Styles'}; } - if ( $styles =~ /\bASSIGNCOMPOMENT\b/ ) { $componentname = get_component_from_assigned_file($fileref->{'AssignComponent'}, $filesref); } + if ( $styles =~ /\bASSIGNCOMPOMENT\b/ ) + { + $componentname = get_component_from_assigned_file($fileref->{'AssignComponent'}, $filesref); + } + else + { + # In this function exists the rule to create components from files + # Rule: + # Two files get the same componentid, if: + # both have the same destination directory. + # both have the same "gid" -> both were packed in the same zip file + # All other files are included into different components! + + # my $componentname = $fileref->{'gid'} . "_" . $fileref->{'Dir'}; + + # $fileref->{'Dir'} is not sufficient! All files in a zip file have the same $fileref->{'Dir'}, + # but can be in different subdirectories. + # Solution: destination=share\Scripts\beanshell\Capitalise\capitalise.bsh + # in which the filename (capitalise.bsh) has to be removed and all backslashes (slashes) are + # converted into underline. + + my $destination = $fileref->{'destination'}; + installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination); + $destination =~ s/\s//g; + $destination =~ s/\\/\_/g; + $destination =~ s/\//\_/g; + $destination =~ s/\_\s*$//g; # removing ending underline + + $componentname = $fileref->{'gid'} . "__" . $destination; + + # Files with different languages, need to be packed into different components. + # Then the installation of the language specific component is determined by a language condition. + + if ( $fileref->{'ismultilingual'} ) + { + my $officelanguage = $fileref->{'specificlanguage'}; + $componentname = $componentname . "_" . $officelanguage; + } + + $componentname = lc($componentname); # componentnames always lowercase + + $componentname =~ s/\-/\_/g; # converting "-" to "_" + $componentname =~ s/\./\_/g; # converting "-" to "_" + + # Attention: Maximum length for the componentname is 72 + # %installer::globals::allcomponents_in_this_database : resetted for each database + # %installer::globals::allcomponents : not resetted for each database + # Component strings must be unique for the complete product, because they are used for + # the creation of the globally unique identifier. + + my $fullname = $componentname; # This can be longer than 72 + + if (( exists($installer::globals::allcomponents{$fullname}) ) && ( ! exists($installer::globals::allcomponents_in_this_database{$fullname}) )) + { + # This is not allowed: One component cannot be installed with different packages. + installer::exiter::exit_program("ERROR: Component \"$fullname\" is already included into another package. This is not allowed.", "get_file_component_name"); + } + + if ( exists($installer::globals::allcomponents{$fullname}) ) + { + $componentname = $installer::globals::allcomponents{$fullname}; + } + else + { + if ( length($componentname) > 72 ) + { + # Using md5sum needs much time + # chomp(my $shorter = `echo $componentname | md5sum | sed -e "s/ .*//g"`); + # $componentname = "comp_$shorter"; + $componentname = generate_new_short_componentname($componentname); # This has to be unique for the complete product, not only one package + } + + $installer::globals::allcomponents{$fullname} = $componentname; + $installer::globals::allcomponents_in_this_database{$fullname} = 1; + } + + # $componentname =~ s/gid_file_/g_f_/g; + # $componentname =~ s/_extra_/_e_/g; + # $componentname =~ s/_config_/_c_/g; + # $componentname =~ s/_org_openoffice_/_o_o_/g; + # $componentname =~ s/_program_/_p_/g; + # $componentname =~ s/_typedetection_/_td_/g; + # $componentname =~ s/_linguistic_/_l_/g; + # $componentname =~ s/_module_/_m_/g; + # $componentname =~ s/_optional_/_opt_/g; + # $componentname =~ s/_packages/_pack/g; + # $componentname =~ s/_menubar/_mb/g; + # $componentname =~ s/_common_/_cm_/g; + # $componentname =~ s/_export_/_exp_/g; + # $componentname =~ s/_table_/_tb_/g; + # $componentname =~ s/_sofficecfg_/_sc_/g; + # $componentname =~ s/_soffice_cfg_/_sc_/g; + # $componentname =~ s/_startmodulecommands_/_smc_/g; + # $componentname =~ s/_drawimpresscommands_/_dic_/g; + # $componentname =~ s/_basiccommands_/_bac_/g; + # $componentname =~ s/_basicidecommands_/_baic_/g; + # $componentname =~ s/_genericcommands_/_genc_/g; + # $componentname =~ s/_bibliographycommands_/_bibc_/g; + # $componentname =~ s/_gentiumbookbasicbolditalic_/_gbbbi_/g; + # $componentname =~ s/_share_/_s_/g; + # $componentname =~ s/_extension_/_ext_/g; + # $componentname =~ s/_extensions_/_exs_/g; + # $componentname =~ s/_modules_/_ms_/g; + # $componentname =~ s/_uiconfig_zip_/_ucz_/g; + # $componentname =~ s/_productivity_/_pr_/g; + # $componentname =~ s/_wizard_/_wz_/g; + # $componentname =~ s/_import_/_im_/g; + # $componentname =~ s/_javascript_/_js_/g; + # $componentname =~ s/_template_/_tpl_/g; + # $componentname =~ s/_tplwizletter_/_twl_/g; + # $componentname =~ s/_beanshell_/_bs_/g; + # $componentname =~ s/_presentation_/_bs_/g; + # $componentname =~ s/_columns_/_cls_/g; + # $componentname =~ s/_python_/_py_/g; + + # $componentname =~ s/_tools/_ts/g; + # $componentname =~ s/_transitions/_trs/g; + # $componentname =~ s/_scriptbinding/_scrb/g; + # $componentname =~ s/_spreadsheet/_ssh/g; + # $componentname =~ s/_publisher/_pub/g; + # $componentname =~ s/_presenter/_pre/g; + # $componentname =~ s/_registry/_reg/g; + + # $componentname =~ s/screen/sc/g; + # $componentname =~ s/wordml/wm/g; + # $componentname =~ s/openoffice/oo/g; + } return $componentname; } diff --git a/solenv/bin/modules/installer/windows/idtglobal.pm b/solenv/bin/modules/installer/windows/idtglobal.pm index fddbe749a57c..333df0e8ea08 100644 --- a/solenv/bin/modules/installer/windows/idtglobal.pm +++ b/solenv/bin/modules/installer/windows/idtglobal.pm @@ -90,10 +90,8 @@ sub get_next_free_number } until (!($alreadyexists)); - if (( $counter > 9 ) && ( length($name) > 6 )) - { - $dontsave = 1; - } + if (( $counter > 9 ) && ( length($name) > 6 )) { $dontsave = 1; } + if (( $counter > 99 ) && ( length($name) > 5 )) { $dontsave = 1; } if (!($dontsave)) { @@ -191,6 +189,14 @@ sub make_eight_three_conform $name =~ s/\s*$//; # removing ending whitespaces $name = $name . "\~"; $number = get_next_free_number($name, $shortnamesref); + + if ( $number > 99 ) + { + $name = substr($name, 0, 4); # name, offset, length + $name =~ s/\s*$//; # removing ending whitespaces + $name = $name . "\~"; + $number = get_next_free_number($name, $shortnamesref); + } } $name = $name . "$number"; @@ -223,6 +229,14 @@ sub make_eight_three_conform $name =~ s/\s*$//; # removing ending whitespaces $name = $name . "\~"; $number = get_next_free_number($name, $shortnamesref); + + if ( $number > 99 ) + { + $name = substr($name, 0, 4); # name, offset, length + $name =~ s/\s*$//; # removing ending whitespaces + $name = $name . "\~"; + $number = get_next_free_number($name, $shortnamesref); + } } $name = $name . "$number"; diff --git a/solenv/bin/modules/installer/windows/msiglobal.pm b/solenv/bin/modules/installer/windows/msiglobal.pm index 1731c1997af3..07f6b73c9cbc 100644 --- a/solenv/bin/modules/installer/windows/msiglobal.pm +++ b/solenv/bin/modules/installer/windows/msiglobal.pm @@ -788,11 +788,16 @@ sub get_codepage_for_sis sub get_template_for_sis { - my ( $language ) = @_; + my ( $language, $allvariables ) = @_; my $windowslanguage = installer::windows::language::get_windows_language($language); - my $value = "\"Intel;" . $windowslanguage; # adding the Windows language + my $architecture = "Intel"; + + # Adding 256, if this is a 64 bit installation set. + if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $architecture = "x64"; } + + my $value = "\"" . $architecture . ";" . $windowslanguage; # adding the Windows language $value = $value . "\""; # adding ending '"' @@ -930,7 +935,7 @@ sub write_summary_into_msi_database my $msiversion = get_msiversion_for_sis(); my $codepage = get_codepage_for_sis($language); - my $template = get_template_for_sis($language); + my $template = get_template_for_sis($language, $allvariableshashref); my $guid = get_packagecode_for_sis(); my $title = get_title_for_sis($sislanguage,$languagefile, "OOO_SIS_TITLE"); my $author = get_author_for_sis(); @@ -1629,6 +1634,104 @@ sub set_uuid_into_component_table installer::files::save_file($componenttablename, $componenttable); } +######################################################################### +# Adding final 64 properties into msi database, if required. +# RegLocator : +16 in type column to search in 64 bit registry. +# All conditions: "VersionNT" -> "VersionNT64" (several tables). +# Already done: "+256" in Attributes column of table "Component". +# Still following: Setting "x64" instead of "Intel" in Summary +# Information Stream of msi database in "get_template_for_sis". +######################################################################### + +sub prepare_64bit_database +{ + my ($basedir, $allvariables) = @_; + + my $infoline = ""; + + if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) + { + # 1. Beginning with table "RegLocat.idt". Adding "16" to the type. + + my $reglocatfile = ""; + my $reglocatfilename = $basedir . $installer::globals::separator . "RegLocat.idt"; + + if ( -f $reglocatfilename ) + { + my $saving_required = 0; + $reglocatfile = installer::files::read_file($reglocatfilename); + + for ( my $i = 3; $i <= $#{$reglocatfile}; $i++ ) # ignoring the first three lines + { + my $oneline = ${$reglocatfile}[$i]; + + if ( $oneline =~ /^\s*\#/ ) { next; } # this is a comment line + if ( $oneline =~ /^\s*$/ ) { next; } + + if ( $oneline =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(\d+)\s*$/ ) + { + # Syntax: Signature_ Root Key Name Type + my $sig = $1; + my $root = $2; + my $key = $3; + my $name = $4; + my $type = $5; + + $type = $type + 16; + + my $newline = $sig . "\t" . $root . "\t" . $key . "\t" . $name . "\t" . $type . "\n"; + ${$reglocatfile}[$i] = $newline; + + $saving_required = 1; + } + } + + if ( $saving_required ) + { + # Saving the files + installer::files::save_file($reglocatfilename ,$reglocatfile); + $infoline = "Making idt file 64 bit conform: $reglocatfilename\n"; + push(@installer::globals::logfileinfo, $infoline); + } + } + + # 2. Replacing all occurences of "VersionNT" by "VersionNT64" + + my @versionnt_files = ("Componen.idt", "InstallE.idt", "InstallU.idt", "LaunchCo.idt"); + + foreach my $onefile ( @versionnt_files ) + { + my $fullfilename = $basedir . $installer::globals::separator . $onefile; + + if ( -f $fullfilename ) + { + my $saving_required = 0; + $filecontent = installer::files::read_file($fullfilename); + + for ( my $i = 3; $i <= $#{$filecontent}; $i++ ) # ignoring the first three lines + { + my $oneline = ${$filecontent}[$i]; + + if ( $oneline =~ /\bVersionNT\b/ ) + { + ${$filecontent}[$i] =~ s/\bVersionNT\b/VersionNT64/g; + $saving_required = 1; + } + } + + if ( $saving_required ) + { + # Saving the files + installer::files::save_file($fullfilename ,$filecontent); + $infoline = "Making idt file 64 bit conform: $fullfilename\n"; + push(@installer::globals::logfileinfo, $infoline); + } + } + } + } + +} + ################################################################# # Include all cab files into the msi database. # This works only on Windows @@ -1656,7 +1759,6 @@ sub include_cabs_into_msi $msifilename = installer::converter::make_path_conform($msifilename); # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) - $idtdirbase =~ s/\//\\\\/g; $msifilename =~ s/\//\\\\/g; $extraslash = "\\"; diff --git a/solenv/bin/modules/installer/windows/property.pm b/solenv/bin/modules/installer/windows/property.pm index 8c311e759f16..44d9a3c06598 100644 --- a/solenv/bin/modules/installer/windows/property.pm +++ b/solenv/bin/modules/installer/windows/property.pm @@ -381,8 +381,8 @@ sub set_important_properties if (( $allvariables->{'PRODUCTEXTENSION'} ) && ( $allvariables->{'PRODUCTEXTENSION'} eq "Beta" )) { - my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n"; - push(@{$propertyfile}, $registryline); + # my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n"; + # push(@{$propertyfile}, $registryline); my $betainfoline = "BETAPRODUCT" . "\t" . "1" . "\n"; push(@{$propertyfile}, $betainfoline); } diff --git a/solenv/bin/modules/par2script/check.pm b/solenv/bin/modules/par2script/check.pm index 7a975f530445..78808cee9191 100644 --- a/solenv/bin/modules/par2script/check.pm +++ b/solenv/bin/modules/par2script/check.pm @@ -139,55 +139,6 @@ sub check_module_existence } ######################################################## -# If the StarRegistry is not defined in the script, -# it has to be removed from the file definition. -######################################################## - -sub check_registry_at_files -{ - my %starregistrygid = (); - - my $item; - foreach $item ( keys %{$par2script::globals::definitions{'File'}} ) - { - if (( exists($par2script::globals::definitions{'File'}->{$item}->{'Styles'}) ) && - ( $par2script::globals::definitions{'File'}->{$item}->{'Styles'} =~ /\bSTARREGISTRY\b/ )) - { - $starregistrygid{$item} = 1; - } - } - - foreach $item ( keys %{$par2script::globals::definitions{'File'}} ) - { - if ( exists($par2script::globals::definitions{'File'}->{$item}->{'RegistryID'}) ) - { - my $registryid = $par2script::globals::definitions{'File'}->{$item}->{'RegistryID'}; - if ( ! exists($starregistrygid{$registryid}) ) - { - die "\nERROR: No definition found for $registryid at file $item\n\n"; - } - - # if ( ! ( $par2script::globals::definitions{'File'}->{$item}->{'Styles'} =~ /\bUNO_COMPONENT\b/ )) - # { - # die "\nERROR: Flag UNO_COMPONENT required for file $item\n\n"; - # } - # -> also possible, that Regmergefile is defined (does not require flag UNO_COMPONENT) - } - - # and also vice versa - - if (( exists($par2script::globals::definitions{'File'}->{$item}->{'Styles'}) ) && - ( $par2script::globals::definitions{'File'}->{$item}->{'Styles'} =~ /\bUNO_COMPONENT\b/ )) - { - if ( ! exists($par2script::globals::definitions{'File'}->{$item}->{'RegistryID'}) ) - { - die "\nERROR: Flag UNO_COMPONENT defined, but no file as \"RegistryID\" at file $item !\n\n"; - } - } - } -} - -######################################################## # Every script has to contain exactly one root module. # This module has no ParentID or an empty ParentID. ######################################################## diff --git a/solenv/bin/packcomponents.xslt b/solenv/bin/packcomponents.xslt new file mode 100644 index 000000000000..6e037a677f73 --- /dev/null +++ b/solenv/bin/packcomponents.xslt @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:uc="http://openoffice.org/2010/uno-components"> + <xsl:param name="prefix"/> + <xsl:strip-space elements="*"/> + <xsl:template match="/"> + <xsl:element name="components" + namespace="http://openoffice.org/2010/uno-components"> + <xsl:for-each select="list/filename"> + <xsl:variable name="doc" select="document(concat($prefix, .))"/> + <xsl:choose> + <xsl:when test="count($doc/uc:component) = 1"> + <xsl:copy-of select="$doc/uc:component"/> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes"> + <xsl:text>cannot process </xsl:text> + <xsl:value-of select="."/> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </xsl:element> + </xsl:template> +</xsl:stylesheet> diff --git a/solenv/bin/packmodule b/solenv/bin/packmodule new file mode 100755 index 000000000000..d3ae30d48dcd --- /dev/null +++ b/solenv/bin/packmodule @@ -0,0 +1,63 @@ +#! /usr/bin/env python +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* +import os, os.path, sys, zipfile + +def paths_to_pack(loglines): + """Returns a generator iterating the outdir fields (with platform) of gb_deliver.log lines.""" + lines=[] + for line in loglines: + fields = line.split() + if len(fields) >= 3: + lines.append(fields[2]) + return lines + +def stripped_paths_to_pack(loglines): + """returns a generator iterating the outdir fields (stripped of the platform) of gb_deliver.log lines.""" + return (path.partition('/')[2] for path in paths_to_pack(loglines)) + +def main(args): + """creates/overwrites a file at OUTDIR/zip/MODULE.zip containing the contents of the gb_deliver.log.""" + if len(args) != 3: + print('usage: packmodule OUTDIR MODULE') + sys.exit(2) + (executable, outdir, module) = args + os.chdir(outdir) + zipdir = 'zip' + try: + os.makedirs(zipdir) + except OSError: + pass + deliverlog = open(os.path.join('inc', module, 'gb_deliver.log')) + packedmodule = zipfile.ZipFile(os.path.join(zipdir,module+'.zip'), 'w') + [packedmodule.write(path) for path in stripped_paths_to_pack(deliverlog)] + packedmodule.close() + +if __name__ == "__main__": + main(sys.argv) + +# vim:set et sw=4 ts=4 filetype=python: diff --git a/solenv/bin/par2script.pl b/solenv/bin/par2script.pl index 0789c460d510..06928ad68439 100644 --- a/solenv/bin/par2script.pl +++ b/solenv/bin/par2script.pl @@ -86,8 +86,6 @@ print "Checking module definitions ...\n"; par2script::check::check_module_existence(); print "Checking module assignments ...\n"; par2script::check::check_moduleid_at_items(); -print "Checking StarRegistry ...\n"; -par2script::check::check_registry_at_files(); print "Checking Root Module ..."; par2script::check::check_rootmodule(); print "Checking Shortcut assignments ...\n"; diff --git a/solenv/bin/soirpm.sh b/solenv/bin/soirpm.sh index 86f8a3e269fd..86f8a3e269fd 100644..100755 --- a/solenv/bin/soirpm.sh +++ b/solenv/bin/soirpm.sh diff --git a/solenv/bin/subsequenttests b/solenv/bin/subsequenttests index 3caa84293f3e..ae9b61922bd8 100755 --- a/solenv/bin/subsequenttests +++ b/solenv/bin/subsequenttests @@ -30,6 +30,8 @@ eval 'exec "$PERL" -Sw "$0" "$@"' use lib("$ENV{SOLARENV}/bin/modules"); use SourceConfig; +my $keep_going = 0; +my $dry_run = 0; my $max_running = 1; while (@ARGV) { my $arg = shift(@ARGV); @@ -38,17 +40,36 @@ while (@ARGV) { } elsif ($arg eq '--') { last; } else { - print STDERR "unknown argument \"$arg\"\n"; - print STDERR "usage: $0 [-P<n>] [-- <args>]\n"; - print STDERR " -P<n> number of parallel dmake invocations\n"; - print STDERR " <args> are passed to dmake invocations\n"; - exit(1); + my $n = substr($arg, 0, 1) eq '-' ? 1 : 0; + while ($n && $n < length($arg)) { + my $c = substr($arg, $n++, 1); + if ($c eq 'k') { + $keep_going = 1; + } elsif ($c eq 'n') { + $dry_run = 1; + } else { + $n = 0; + last; + } + } + if (!$n) { + print STDERR "unknown argument \"$arg\"\n"; + print STDERR "usage: $0 [-kn] [-P<n>] [-- <args>]\n"; + print STDERR " -k continue with other dmake invocations upon\n"; + print STDERR " failure\n"; + print STDERR " -n write directories that would be processed\n"; + print STDERR " to standard output\n"; + print STDERR " -P<n> number of parallel dmake invocations\n"; + print STDERR " <args> are passed to dmake invocations\n"; + exit(1); + } } } my @testpaths = (); my $sc = SourceConfig->new($ENV{'SOLARSRC'}); my $module; +my $gbuildpath = "$ENV{'SOLARSRC'}/GNUmakefile"; foreach $module ($sc->get_active_modules()) { my $buildlst = $sc->get_module_build_list($module); next unless defined($buildlst); @@ -82,6 +103,26 @@ foreach $module ($sc->get_active_modules()) { } } +if ($dry_run) { + foreach $path (@testpaths) { + print "$path\n"; + } + print "$gbuildpath\n"; + exit(0); +} + +my @failedpaths = (); +my @gbuildargs = ("-j$max_running", "-s"); +if ($keep_going) { + push(@gbuildargs,"-k"); +} +push(@gbuildargs, "--file=$gbuildpath"); +push(@gbuildargs, "subsequentcheck"); +if (system($ENV{'GNUMAKE'}, @gbuildargs) != 0) { + push(@failedpaths,$gbuildpath); + @testpaths = () unless $keep_going; +} + my $cmd = 'dmake'; foreach (@ARGV) { s/'/'\''/g; @@ -90,7 +131,6 @@ foreach (@ARGV) { $cmd .= ' 2>&1 |'; my %pids = (); -my @failedpaths = (); my $running = 0; my $counter = 0; while (@testpaths || $running > 0) { @@ -119,8 +159,8 @@ while (@testpaths || $running > 0) { my $testpath = delete($pids{$pid}); defined($testpath) or die("unmatched PID $pid"); if ($? != 0) { - @testpaths = (); push(@failedpaths, $testpath); + @testpaths = () unless $keep_going; } --$running; } diff --git a/solenv/bin/transform_description.pl b/solenv/bin/transform_description.pl index 9a7f850713dd..ff99df425049 100644 --- a/solenv/bin/transform_description.pl +++ b/solenv/bin/transform_description.pl @@ -1,9 +1,9 @@ #!/usr/bin/perl #************************************************************************* -#* +# # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2009 by Sun Microsystems, Inc. +# Copyright 2000, 2011 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite # @@ -24,7 +24,7 @@ # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. # -#************************************************************************/ +#************************************************************************* parse_args(); execute_args(); |