diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-10-09 18:56:58 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-10-09 18:56:58 +0200 |
commit | 08f512a43f6e90eadc6f280e4a6752e54664255c (patch) | |
tree | 9f9706bec20fa861635b987caa18d735bfa53a27 /solenv/bin | |
parent | 2572209a92a6ed172f1650f7805f7e5829541ea3 (diff) | |
parent | d711de79b44b5282a12d829620fcbc69b0f83391 (diff) |
CWS changehid: resync to m89
Diffstat (limited to 'solenv/bin')
24 files changed, 1115 insertions, 1844 deletions
diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl index 66afeec6e2c7..bff6e870f2e9 100755..100644 --- a/solenv/bin/build.pl +++ b/solenv/bin/build.pl @@ -45,6 +45,7 @@ use lib ("$ENV{SOLARENV}/bin/modules"); use SourceConfig; + use RepositoryHelper; my $in_so_env = 0; if (defined $ENV{COMMON_ENV_TOOLS}) { @@ -139,6 +140,8 @@ $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 = (); @@ -167,8 +170,8 @@ $html_last_updated = 0; %jobs_hash = (); $html_path = undef; - $html_file = CorrectPath($ENV{SOLARSRC} . '/' . $ENV{INPATH}. '.build.html'); $build_finished = 0; + $html_file = ''; %had_error = (); # hack for misteriuos windows problems - try run dmake 2 times if first time there was an error $mkout = CorrectPath("$ENV{SOLARENV}/bin/mkout.pl"); %weights_hash = (); # hash contains info about how many modules are dependent from one module @@ -209,7 +212,6 @@ get_options(); - $html_file = CorrectPath($html_path . '/' . $ENV{INPATH}. '.build.html') if (defined $html_path); # my $temp_html_file = CorrectPath($tmp_dir. '/' . $ENV{INPATH}. '.build.html'); get_build_modes(); %deliver_env = (); @@ -225,12 +227,26 @@ $deliver_env{'OUTPATH'}++; $deliver_env{'L10N_framework'}++; }; + $StandDir = get_stand_dir(); # This also sets $initial_module + $source_config = SourceConfig -> new($StandDir); + + if ($html) { + if (defined $html_path) { + $html_file = CorrectPath($html_path . '/' . $ENV{INPATH}. '.build.html'); + } else { + my $log_directory = Cwd::realpath(CorrectPath($StandDir . '/..')) . '/log'; + if ((!-d $log_directory) && (!mkdir($log_directory))) { + print_error("Cannot create $log_directory for writing html file\n"); + }; + $html_file = $log_directory . '/' . $ENV{INPATH}. '.build.html'; + print "\nPath to html status page: $html_file\n"; + }; + }; if ($generate_config && ($clear_config || (scalar keys %remove_from_config)||(scalar keys %add_to_config))) { generate_config_file(); exit 0; } - $StandDir = get_stand_dir(); # This also sets $initial_module get_module_and_buildlist_paths(); provide_consistency() if (defined $ENV{CWS_WORK_STAMP} && defined($ENV{COMMON_ENV_TOOLS})); @@ -342,7 +358,6 @@ sub rename_file { }; sub generate_config_file { - my $source_config = SourceConfig->new(); $source_config->add_active_modules([keys %add_to_config], 1) if (scalar %add_to_config); $source_config->remove_activated_modules([keys %remove_from_config], 1) if (scalar %remove_from_config); $source_config->remove_all_activated_modules() if ($clear_config); @@ -556,23 +571,36 @@ sub get_build_list_path { # Get dependencies hash of the current and all parent projects # sub get_parent_deps { - my (%parents_deps_hash, $module, $parent); my $prj_dir = shift; my $deps_hash = shift; - my @unresolved_parents = get_parents_array($prj_dir); - $parents_deps_hash{$_}++ foreach (@unresolved_parents); - $$deps_hash{$prj_dir} = \%parents_deps_hash; - while ($module = pop(@unresolved_parents)) { + my @unresolved_parents = ($prj_dir); + my %skipped_branches = (); + while (my $module = pop(@unresolved_parents)) { + next if (defined $$deps_hash{$module}); my %parents_deps_hash = (); - $parents_deps_hash{$_}++ foreach (get_parents_array($module)); + foreach (get_parents_array($module)) { + if (defined $exclude_branches{$_}) { + $skipped_branches{$_}++; + next; + }; + $parents_deps_hash{$_}++; + } $$deps_hash{$module} = \%parents_deps_hash; foreach $Parent (keys %parents_deps_hash) { - if (!defined($$deps_hash{$Parent})) { + if (!defined($$deps_hash{$Parent}) && (!defined $exclude_branches{$module})) { push (@unresolved_parents, $Parent); }; }; }; check_deps_hash($deps_hash); + foreach (keys %skipped_branches) { + print $echo . "Skipping module's $_ branch\n"; + delete $exclude_branches{$_}; + }; + my @missing_branches = keys %exclude_branches; + if (scalar @missing_branches) { + print_error("For $prj_dir branche(s): \"@missing_branches\" not found\n"); + }; }; sub store_weights { @@ -605,18 +633,18 @@ sub expand_dependencies { }; # -# This procedure fills out the %reversed_dependencies hash, -# the hash contaninig the info about modules "waiting" for the module +# This procedure fills the second hash with reversed dependencies, +# ie, with info about modules "waiting" for the module # sub reverse_dependensies { - my $deps_hash = shift; + my ($deps_hash, $reversed) = @_; foreach my $module (keys %$deps_hash) { foreach (keys %{$$deps_hash{$module}}) { - if (defined $reversed_dependencies{$_}) { - ${$reversed_dependencies{$_}}{$module}++ + if (defined $$reversed{$_}) { + ${$$reversed{$_}}{$module}++ } else { my %single_module_dep_hash = ($module => 1); - $reversed_dependencies{$_} = \%single_module_dep_hash; + $$reversed{$_} = \%single_module_dep_hash; }; }; }; @@ -635,10 +663,16 @@ sub build_all { }; modules_classify(keys %global_deps_hash); expand_dependencies (\%global_deps_hash); -# prepare_build_from(\%global_deps_hash) if (scalar keys %incompatibles); - prepare_incompatible_build(\%global_deps_hash) if ($incompatible); + prepare_incompatible_build(\%global_deps_hash) if ($incompatible && (!$build_from_with_branches)); + if ($build_from_with_branches) { + my %reversed_full_deps_hash = (); + reverse_dependensies(\%global_deps_hash, \%reversed_full_deps_hash); + 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; @@ -653,13 +687,13 @@ sub build_all { 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"); }; }; - foreach my $module (%dead_parents) { + foreach my $module (keys %dead_parents, keys %skip_modules) { remove_from_dependencies($module, \%global_deps_hash); delete ($global_deps_hash{$module}) if (defined $global_deps_hash{$module}); }; store_weights(\%global_deps_hash); backup_deps_hash(\%global_deps_hash, \%global_deps_hash_backup); - reverse_dependensies(\%global_deps_hash_backup); + reverse_dependensies(\%global_deps_hash_backup, \%reversed_dependencies); $modules_number = scalar keys %global_deps_hash; initialize_html_info($_) foreach (keys %global_deps_hash); if ($processes_to_run) { @@ -1100,6 +1134,7 @@ sub get_commands { while ($arg = pop(@dmake_args)) { $dmake .= ' '.$arg; }; + $dmake .= ' verbose=true' if ($html); }; # @@ -1110,34 +1145,44 @@ sub get_stand_dir { $ENV{mk_tmp} = ''; die "No environment set\n"; }; - my $StandDir; - if ( defined $ENV{PWD} ) { - $StandDir = $ENV{PWD}; - } elsif (defined $ENV{_cwd}) { - $StandDir = $ENV{_cwd}; - } else { - $StandDir = cwd(); - }; - my $previous_dir = ''; - do { - foreach (@possible_build_lists) {# ('build.lst', 'build.xlist'); - if (-e $StandDir . '/prj/'.$_) { - $initial_module = File::Basename::basename($StandDir); - $build_list_paths{$initial_module} =$StandDir . '/prj/'.$_; - $StandDir = File::Basename::dirname($StandDir); - $module_paths{$initial_module} = $StandDir . "/$initial_module"; + my $repository_helper = RepositoryHelper->new(); + my $StandDir = $repository_helper->get_repository_root(); + my $initial_dir = $repository_helper->get_initial_directory(); + if ($StandDir eq $initial_dir) { + print_error('Found no project to build'); + }; + $initial_module = substr($initial_dir, length($StandDir) + 1); + if ($initial_module =~ /(\\|\/)/) { + $initial_module = $`; + }; + $module_paths{$initial_module} = $StandDir . "/$initial_module"; +# $build_list_paths{$initial_module} =$StandDir . '/prj/'.$_; +# if ( defined $ENV{PWD} ) { +# $StandDir = $ENV{PWD}; +# } elsif (defined $ENV{_cwd}) { +# $StandDir = $ENV{_cwd}; +# } else { +# $StandDir = cwd(); +# }; +# my $previous_dir = ''; +# do { +# foreach (@possible_build_lists) {# ('build.lst', 'build.xlist'); +# if (-e $StandDir . '/prj/'.$_) { +# $initial_module = File::Basename::basename($StandDir); +# $build_list_paths{$initial_module} =$StandDir . '/prj/'.$_; +# $StandDir = File::Basename::dirname($StandDir); +# $module_paths{$initial_module} = $StandDir . "/$initial_module"; return $StandDir; - } elsif ($StandDir eq $previous_dir) { - $ENV{mk_tmp} = ''; - print_error('Found no project to build'); - }; - }; - $previous_dir = $StandDir; - $StandDir = File::Basename::dirname(Cwd::realpath($StandDir)); - print_error('Found no project to build') if (!$StandDir); - } -# while (chdir '..'); - while (chdir "$StandDir"); +# } elsif ($StandDir eq $previous_dir) { +# $ENV{mk_tmp} = ''; +# print_error('Found no project to build'); +# }; +# }; +# $previous_dir = $StandDir; +# $StandDir = File::Basename::dirname(Cwd::realpath($StandDir)); +# print_error('Found no project to build') if (!$StandDir); +# } +# while (chdir "$StandDir"); }; # @@ -1236,7 +1281,7 @@ sub check_deps_hash { $jobs_hash{$key} = { SHORT_NAME => $string, BUILD_NUMBER => $build_number, STATUS => 'waiting', - LOG_PATH => $module . "/$ENV{INPATH}/misc/logs/$log_name", + 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"), START_TIME => 0, FINISH_TIME => 0, @@ -1279,7 +1324,10 @@ sub find_indep_prj { $Dependencies = shift; if (scalar keys %$Dependencies) { foreach my $job (keys %$Dependencies) { - push(@candidates, $job) if (!scalar keys %{$$Dependencies{$job}}); + if (!scalar keys %{$$Dependencies{$job}}) { + push(@candidates, $job); + last if (!$processes_to_run); + }; }; if (scalar @candidates) { $all_dependent = 0; @@ -1392,7 +1440,7 @@ sub print_error { sub usage { print STDERR "\nbuild\n"; - print STDERR "Syntax: build [--all|-a[:prj_name]]|[--from|-f prj_name1[:prj_name2] [prj_name3 [...]]]|[--since|-c prj_name] [--with_branches|-b]|[--prepare|-p][:platform] [--deliver|-d [--dlv_switch deliver_switch]]] [-P processes|--server [--setenvstring \"string\"] [--client_timeout MIN] [--port port1[:port2:...:portN]]] [--show|-s] [--help|-h] [--file|-F] [--ignore|-i] [--version|-V] [--mode|-m OOo[,SO[,EXT]] [--html [--html_path html_file_path] [--dontgraboutput]] [--pre_job=pre_job_sring] [--job=job_string|-j] [--post_job=post_job_sring] [--stoponerror] [--genconf [--removeall|--clear|--remove|--add [module1,module2[,...,moduleN]]]] [--interactive]\n"; + print STDERR "Syntax: build [--all|-a[:prj_name]]|[--from|-f prj_name1[:prj_name2] [prj_name3 [...]]]|[--since|-c prj_name] [--with_branches prj_name1[:prj_name2] [--skip prj_name1[:prj_name2] [prj_name3 [...]] [prj_name3 [...]|-b]|[--prepare|-p][:platform] [--deliver|-d [--dlv_switch deliver_switch]]] [-P processes|--server [--setenvstring \"string\"] [--client_timeout MIN] [--port port1[:port2:...:portN]]] [--show|-s] [--help|-h] [--file|-F] [--ignore|-i] [--version|-V] [--mode|-m OOo[,SO[,EXT]] [--html [--html_path html_file_path] [--dontgraboutput]] [--pre_job=pre_job_sring] [--job=job_string|-j] [--post_job=post_job_sring] [--stoponerror] [--genconf [--removeall|--clear|--remove|--add [module1,module2[,...,moduleN]]]] [--exclude_branch_from prj_name1[:prj_name2] [prj_name3 [...]]] [--interactive]\n"; print STDERR "Example1: build --from sfx2\n"; print STDERR " - build all projects dependent from sfx2, starting with sfx2, finishing with the current module\n"; print STDERR "Example2: build --all:sfx2\n"; @@ -1405,9 +1453,11 @@ sub usage { print STDERR "\nSwitches:\n"; print STDERR " --all - build all projects from very beginning till current one\n"; print STDERR " --from - build all projects dependent from the specified (including it) till current one\n"; + print STDERR " --exclude_branch_from - exclude module(s) and its branch from the build\n"; print STDERR " --mode OOo - build only projects needed for OpenOffice.org\n"; print STDERR " --prepare - clear all projects for incompatible build from prj_name till current one [for platform] (cws version)\n"; - print STDERR " --with_branches- build all projects in neighbour branches and current branch starting from actual project\n"; + print STDERR " --with_branches- the same as \"--from\" but with build all projects in neighbour branches\n"; + print STDERR " --skip - do not build certain module(s)\n"; print STDERR " --since - build all projects beginning from the specified till current one (the same as \"--all:prj_name\", but skipping prj_name)\n"; print STDERR " --checkmodules - check if all required parent projects are availlable\n"; print STDERR " --show - show what is going to be built\n"; @@ -1462,19 +1512,25 @@ sub get_options { $arg =~ /^--dlv_switch$/ and $dlv_switch = shift @ARGV and next; $arg =~ /^--file$/ and $cmd_file = shift @ARGV and next; $arg =~ /^-F$/ and $cmd_file = shift @ARGV and next; + $arg =~ /^--skip$/ and get_modules_passed(\%skip_modules) and next; - $arg =~ /^--with_branches$/ and $build_all_parents = 1 - and $build_from_with_branches = shift @ARGV and next; - $arg =~ /^-b$/ and $build_all_parents = 1 - and $build_from_with_branches = shift @ARGV and next; - + if ($arg =~ /^--with_branches$/ || $arg =~ /^-b$/) { + $build_from_with_branches = 1; + $build_all_parents = 1; + get_modules_passed(\%incompatibles); + next; + }; $arg =~ /^--all:(\S+)$/ and $build_all_parents = 1 and $build_all_cont = $1 and next; $arg =~ /^-a:(\S+)$/ and $build_all_parents = 1 and $build_all_cont = $1 and next; if ($arg =~ /^--from$/ || $arg =~ /^-f$/) { $build_all_parents = 1; - get_incomp_projects(); + get_modules_passed(\%incompatibles); + next; + }; + if ($arg =~ /^--exclude_branch_from$/) { + get_modules_passed(\%exclude_branches); next; }; $arg =~ /^--prepare$/ and $prepare = 1 and next; @@ -1527,8 +1583,12 @@ sub get_options { print_error("\"--html_path\" switch is used only with \"--html\"") if ($html_path); print_error("\"--dontgraboutput\" switch is used only with \"--html\"") if ($dont_grab_output); }; + if ((scalar keys %exclude_branches) && !$build_all_parents) { + print_error("\"--exclude_branch_from\" is not applicable for one module builds!!"); + }; $grab_output = 0 if ($dont_grab_output); print_error('Switches --with_branches and --all collision') if ($build_from_with_branches && $build_all_cont); + print_error('Switch --skip is for building multiple modules only!!') if ((scalar keys %skip_modules) && (!$build_all_parents)); # print_error('Please prepare the workspace on one of UNIX platforms') if ($prepare && ($ENV{GUI} ne 'UNX')); print_error('Switches --with_branches and --since collision') if ($build_from_with_branches && $build_since); if ($show) { @@ -1593,7 +1653,6 @@ sub get_options { sub get_module_and_buildlist_paths { if ($build_all_parents || $checkparents) { - my $source_config = SourceConfig -> new($StandDir); $source_config_file = $source_config->get_config_file_path(); $active_modules{$_}++ foreach ($source_config->get_active_modules()); my %active_modules_copy = %active_modules; @@ -1652,7 +1711,13 @@ sub cancel_build { $message_part .= "--from @broken_modules_names\n"; }; } else { - $message_part .= "--all:@broken_modules_names\n"; + if ($processes_to_run) { + $message_part .= "--from "; + } else { + $message_part .= "--all:"; + }; + $message_part .= "@broken_modules_names\n"; + }; if ($broken_modules_number && $build_all_parents) { print "\n"; @@ -2109,12 +2174,12 @@ sub modules_classify { # # This procedure provides consistency for cws -# and optimized build (ie in case of -with_branches, -all:prj_name +# and optimized build (ie in case of --with_branches, -all:prj_name # and -since switches) # sub provide_consistency { check_dir(); - foreach $var_ref (\$build_from_with_branches, \$build_all_cont, \$build_since) { + foreach $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); @@ -2257,6 +2322,20 @@ sub fix_permissions { chmod '0664', $file; }; +sub prepare_build_from_with_branches { + ($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}) { + remove_from_dependencies($prerequisite, $full_deps_hash); + delete $$full_deps_hash{$prerequisite}; +# print "Removed $prerequisite\n"; + last; + }; + }; + }; +}; + # # Removes projects which it is not necessary to build # in incompatible build @@ -2268,7 +2347,6 @@ sub prepare_incompatible_build { if (!defined $$deps_hash{$module}) { print_error("The module $initial_module is independent from $module\n"); } - delete $incompatibles{$module}; $incompatibles{$module} = $$deps_hash{$module}; delete $$deps_hash{$module}; } @@ -2286,8 +2364,8 @@ sub prepare_incompatible_build { @modules_built = keys %$deps_hash; %add_to_config = %$deps_hash; if ($prepare) { - if ((!defined $ENV{UPDATER}) || (defined $ENV{CWS_WORK_STAMP})) { - SourceConfig->new()->add_active_modules([keys %add_to_config], 0); + if ((!(defined $ENV{UPDATER} && (!defined $ENV{CWS_WORK_STAMP}))) || (defined $ENV{CWS_WORK_STAMP})) { + $source_config->add_active_modules([keys %add_to_config], 0); } clear_delivered(); } @@ -2332,21 +2410,6 @@ sub prepare_incompatible_build { # # Removes projects which it is not necessary to build -# with -with_branches switch -# -#sub prepare_build_from { -# my ($prj, $deps_hash); -# $deps_hash = shift; -# my %from_deps_hash = (); # hash of dependencies of the -from project -# get_parent_deps($build_from_with_branches, \%from_deps_hash); -# foreach $prj (keys %from_deps_hash) { -# delete $$deps_hash{$prj}; -# remove_from_dependencies($prj, $deps_hash); -# }; -#}; - -# -# Removes projects which it is not necessary to build # with --all:prj_name or --since switch # sub prepare_build_all_cont { @@ -2412,7 +2475,8 @@ sub get_list_of_modules { # }; }; -sub get_incomp_projects { +sub get_modules_passed { + my $hash_ref = shift; my $option = ''; while ($option = shift @ARGV) { if ($option =~ /^-+/) { @@ -2424,7 +2488,7 @@ sub get_incomp_projects { print_error("\'--from\' switch collision") if ($build_all_cont); $build_all_cont = $'; }; - $incompatibles{$option}++; + $$hash_ref{$option}++; }; }; }; 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 ab91ae34c01f..5c604d27b309 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 = "-"); @@ -404,6 +404,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; @@ -423,15 +425,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) { @@ -679,6 +679,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 ) { diff --git a/solenv/bin/jpropex b/solenv/bin/jpropex deleted file mode 100755 index 2d62d13b093e..000000000000 --- a/solenv/bin/jpropex +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -if [ x${SOLARENV}x = xx ]; then - echo No environment found, please use 'configure' or 'setsolar' - exit 1 -fi -if [ x${JAVA_HOME}x = xx ]; then - echo No Java found! - exit 1 -fi -exec java -DSOLARSRC=${SOLARSRC} -DWORK_STAMP=${WORK_STAMP} -DUSE_SHELL= -jar ${SOLARVER}/${INPATH}/bin${UPDMINOREXT}/jpropex.jar "$@" diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl index 335ecf961253..d28a2e7e3fa0 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; @@ -892,43 +890,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) - { - # 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::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 ############################################ diff --git a/solenv/bin/mhids.pl b/solenv/bin/mhids.pl index 990e17bb959c..82e50d1b9c91 100644 --- a/solenv/bin/mhids.pl +++ b/solenv/bin/mhids.pl @@ -59,7 +59,10 @@ sub cleandie print STDERR "$errstring\n"; if ( not $debug ) { foreach my $i (@cleanuplist) { - unlink "$workfile$i" if -f "$workfile$i" or print STDERR "ERROR - couldn't remove $workfile$i\n"; +# unlink "$workfile$i" if -f "$workfile$i" or print STDERR "ERROR - couldn't remove $workfile$i\n"; + if ( -f "$workfile$i" ) { + unlink "$workfile$i" or print STDERR "ERROR - couldn't remove $workfile$i\n"; + } } } die "$erroreval\n"; @@ -386,6 +389,7 @@ rename("$srs/$filebase.hid.$ENV{INPATH}", "$srs/$filebase.hid") or cleandie("ERR if ( not $debug ) { foreach my $i (@cleanuplist) { + sleep 1; if ( -f "$workfile$i" ) { unlink "$workfile$i" or cleandie(""); } diff --git a/solenv/bin/modules/RepositoryHelper.pm b/solenv/bin/modules/RepositoryHelper.pm new file mode 100644 index 000000000000..8ea7996f6bc6 --- /dev/null +++ b/solenv/bin/modules/RepositoryHelper.pm @@ -0,0 +1,210 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +#************************************************************************* +# +# RepositoryHelper - Perl for working with repositories and underlying SCM +# +# usage: see below +# +#************************************************************************* + +package RepositoryHelper; + +use strict; + + +use Carp; +use Cwd qw (cwd); +use File::Basename; +#use File::Temp qw(tmpnam); + +my $debug = 0; + +##### profiling ##### + +##### ctor ##### + +sub new { + my $proto = shift; + my $class = ref($proto) || $proto; + my $initial_directory = shift; + if ($initial_directory) { + $initial_directory = Cwd::realpath($initial_directory); + } else { + if ( defined $ENV{PWD} ) { + $initial_directory = $ENV{PWD}; + } elsif (defined $ENV{_cwd}) { + $initial_directory = $ENV{_cwd}; + } else { + $initial_directory = cwd(); + }; + }; + my $self = {}; + $self->{INITIAL_DIRECTORY} = $initial_directory; + $self->{REPOSITORY_ROOT} = undef; + $self->{REPOSITORY_NAME} = undef; + $self->{SCM_NAME} = undef; + detect_repository($self); + bless($self, $class); + return $self; +} + +##### methods ##### +sub get_repository_root +{ + my $self = shift; + return $self->{REPOSITORY_ROOT}; +} + +sub get_initial_directory +{ + my $self = shift; + return $self->{INITIAL_DIRECTORY}; +} + +sub get_scm_name +{ + my $self = shift; + return$self->{SCM_NAME}; +} + +##### private methods ##### +sub search_for_hg { + my $self = shift; + my $hg_root; + my $scm_name = 'hg'; + if (open(COMMAND, "$scm_name root 2>&1 |")) { + foreach (<COMMAND>) { + next if (/^Not trusting file/); + chomp; + $hg_root = $_; + last; + }; + close COMMAND; + chomp $hg_root; + if ($hg_root !~ /There is no Mercurial repository here/) { + $self->{REPOSITORY_ROOT} = $hg_root; + $self->{SCM_NAME} = $scm_name; + return 1; + }; + }; + return 0; +}; + +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 lists names + my $previous_dir = ''; + my $rep_root_candidate = $self->{INITIAL_DIRECTORY}; + do { + foreach (@possible_build_lists) { + 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; + }; + }; + $previous_dir = $rep_root_candidate; + $rep_root_candidate = File::Basename::dirname(Cwd::realpath($rep_root_candidate)); + return 0 if ((!$rep_root_candidate) || ($rep_root_candidate eq $previous_dir)); + } + while (chdir "$rep_root_candidate"); +}; + +sub detect_repository { + my $self = shift; + return if (search_via_build_lst($self)); + chdir $self->{INITIAL_DIRECTORY}; + return if (search_for_hg($self)); + croak('Cannot determine source directory/repository for ' . $self->{INITIAL_DIRECTORY}); +}; + +##### finish ##### + +1; # needed by use or require + +__END__ + +=head1 NAME + +RepositoryHelper - Perl module for working with repositories and underlying SCM + +=head1 SYNOPSIS + + # example that will analyze sources and return the source root directory + + use RepositoryHelper; + + # Create a new instance: + $a = RepositoryHelper->new(); + + # Get repositories for the actual workspace: + $a->get_repository_root(); + + +=head1 DESCRIPTION + +RepositoryHelper is a perlPerl module for working with repositories and underlying SCM +in the database. + +Methods: + +RepositoryHelper::new() + +Creates a new instance of RepositoryHelper. Can be initialized by: some path which likely to belong to a repository, default - empty, the current dir will be taken. + +RepositoryHelper::get_repository_root() + +Returns the repository root, retrieved by SCM methods or on educated guess... + +RepositoryHelper::get_initial_directory() + +Returns full path to the initialistion directory. + +=head2 EXPORT + +RepositoryHelper::new() +RepositoryHelper::get_repository_root() +RepositoryHelper::get_scm_name() +RepositoryHelper::get_initial_directory() + +=head1 AUTHOR + +Vladimir Glazunov, vg@openoffice.org + +=head1 SEE ALSO + +perl(1). + +=cut diff --git a/solenv/bin/modules/SourceConfig.pm b/solenv/bin/modules/SourceConfig.pm index 9379b7764d0a..dfaa797d8f48 100644..100755 --- a/solenv/bin/modules/SourceConfig.pm +++ b/solenv/bin/modules/SourceConfig.pm @@ -38,10 +38,11 @@ package SourceConfig; use strict; use constant SOURCE_CONFIG_FILE_NAME => 'source_config'; -use constant SOURCE_CONFIG_VERSION => 2; +use constant SOURCE_CONFIG_VERSION => 3; use Carp; use Cwd; +use RepositoryHelper; use File::Basename; use File::Temp qw(tmpnam); @@ -75,8 +76,9 @@ sub new { $source_root .= '/..'; } } else { - $source_root = Cwd::realpath($ENV{SOURCE_ROOT_DIR}); + $source_root = $ENV{SOURCE_ROOT_DIR}; }; + $source_root = Cwd::realpath($source_root); $self->{SOURCE_ROOT} = $source_root; $self->{DEBUG} = 0; $self->{VERBOSE} = 0; @@ -94,14 +96,16 @@ sub new { $self->{WARNINGS} = []; $self->{REPORT_MESSAGES} = []; $self->{CONFIG_FILE_CONTENT} = []; - $self->{DEFAULT_REPOSITORY} = undef; if (defined $self->{USER_SOURCE_ROOT}) { ${$self->{REPOSITORIES}}{File::Basename::basename($self->{USER_SOURCE_ROOT})} = $self->{USER_SOURCE_ROOT}; - $self->{DEFAULT_REPOSITORY} = File::Basename::basename($self->{USER_SOURCE_ROOT}); }; $self->{SOURCE_CONFIG_FILE} = get_config_file($self->{SOURCE_ROOT}) if (!defined $self->{SOURCE_CONFIG_FILE}); $self->{SOURCE_CONFIG_DEFAULT} = $self->{SOURCE_ROOT} .'/'.SOURCE_CONFIG_FILE_NAME; + if (defined $self->{USER_SOURCE_ROOT}) { + ${$self->{REPOSITORIES}}{File::Basename::basename($self->{USER_SOURCE_ROOT})} = $self->{USER_SOURCE_ROOT}; + }; read_config_file($self); + get_module_paths($self); bless($self, $class); return $self; } @@ -118,6 +122,19 @@ sub get_repositories return sort keys %{$self->{REPOSITORIES}}; } +sub add_repository +{ + my $self = shift; + my $new_rep_path = shift; + $new_rep_path = Cwd::realpath($new_rep_path); + my $new_rep_name = File::Basename::basename($new_rep_path); + if (defined ${$self->{REPOSITORIES}}{$new_rep_name}) { + croak("Repository $new_rep_name is already defined!!"); + }; + ${$self->{REPOSITORIES}}{$new_rep_name} = $new_rep_path; + $self -> get_repository_module_paths($new_rep_name); +} + sub get_config_file_default_path { my $self = shift; return $self->{SOURCE_CONFIG_DEFAULT}; @@ -131,7 +148,6 @@ sub get_config_file_path { sub get_module_repository { my $self = shift; my $module = shift; - $self -> get_module_paths() if (!scalar keys %{$self->{MODULE_PATHS}}); if (defined ${$self->{MODULE_REPOSITORY}}{$module}) { return ${$self->{MODULE_REPOSITORY}}{$module}; } else { @@ -143,7 +159,6 @@ sub get_module_repository { sub get_module_path { my $self = shift; my $module = shift; - $self -> get_module_paths() if (!scalar keys %{$self->{MODULE_PATHS}}); if (defined ${$self->{MODULE_PATHS}}{$module}) { return ${$self->{MODULE_PATHS}}{$module}; } else { @@ -155,10 +170,17 @@ sub get_module_path { sub get_module_build_list { my $self = shift; my $module = shift; - $self -> get_buildlist_paths() if (!scalar keys %{$self->{MODULE_BUILD_LIST_PATHS}}); if (defined ${$self->{MODULE_BUILD_LIST_PATHS}}{$module}) { return ${$self->{MODULE_BUILD_LIST_PATHS}}{$module}; } else { + my @possible_build_lists = ('build.lst', 'build.xlist'); # build lists names + foreach (@possible_build_lists) { + my $possible_path = ${$self->{MODULE_PATHS}}{$module} . "/prj/$_"; + if (-e $possible_path) { + ${$self->{MODULE_BUILD_LIST_PATHS}}{$module} = $possible_path; + return $possible_path; + }; + }; Carp::cluck("No build list in module $module found!!\n") if ($self->{DEBUG}); return undef; }; @@ -168,7 +190,6 @@ sub get_all_modules { my $self = shift; my $module = shift; - $self -> get_module_paths() if (!scalar keys %{$self->{MODULE_PATHS}}); return sort keys %{$self->{MODULE_PATHS}}; }; @@ -178,7 +199,6 @@ sub get_active_modules if (scalar keys %{$self->{ACTIVATED_MODULES}}) { return sort keys %{$self->{ACTIVATED_MODULES}}; } - $self -> get_module_paths() if (!scalar keys %{$self->{MODULE_PATHS}}); return sort keys %{$self->{REAL_MODULES}}; } @@ -189,49 +209,42 @@ sub is_active if (scalar keys %{$self->{ACTIVATED_MODULES}}) { return exists ($self->{ACTIVATED_MODULES}{$module}); } - $self -> get_module_paths() if (!scalar keys %{$self->{MODULE_PATHS}}); return exists ($self->{REAL_MODULES}{$module}); } ##### private methods ##### -sub get_buildlist_paths { +sub get_repository_module_paths { my $self = shift; - $self -> get_module_paths() if (!scalar keys %{$self->{MODULE_PATHS}}); - my @possible_build_lists = ('build.lst', 'build.xlist'); # build lists names - foreach my $module (keys %{$self->{MODULE_PATHS}}) { - foreach (@possible_build_lists) { - my $possible_path = ${$self->{MODULE_PATHS}}{$module} . "/prj/$_"; - ${$self->{MODULE_BUILD_LIST_PATHS}}{$module} = $possible_path if (-e $possible_path); + my $repository = shift; + my $repository_path = ${$self->{REPOSITORIES}}{$repository}; + if (opendir DIRHANDLE, $repository_path) { + foreach my $module (readdir(DIRHANDLE)) { + next if (($module =~ /^\.+/) || (!-d "$repository_path/$module")); + my $module_entry = $module; + if (($module !~ s/\.lnk$//) && ($module !~ s/\.link$//)) { + $self->{REAL_MODULES}{$module}++; + } + my $possible_path = "$repository_path/$module_entry"; + if (-d $possible_path) { + if (defined ${$self->{MODULE_PATHS}}{$module}) { + close DIRHANDLE; + croak("Ambiguous paths for module $module: $possible_path and " . ${$self->{MODULE_PATHS}}{$module}); + }; + ${$self->{MODULE_PATHS}}{$module} = $possible_path; + ${$self->{MODULE_REPOSITORY}}{$module} = $repository; + } }; + close DIRHANDLE; + } else { + croak("Cannot read $repository_path repository content"); }; }; sub get_module_paths { my $self = shift; foreach my $repository (keys %{$self->{REPOSITORIES}}) { - my $repository_path = ${$self->{REPOSITORIES}}{$repository}; - if (opendir DIRHANDLE, $repository_path) { - foreach my $module (readdir(DIRHANDLE)) { - next if (($module =~ /^\.+/) || (!-d "$repository_path/$module")); - my $module_entry = $module; - if (($module !~ s/\.lnk$//) && ($module !~ s/\.link$//)) { - $self->{REAL_MODULES}{$module}++; - } - my $possible_path = "$repository_path/$module_entry"; - if (-d $possible_path) { - if (defined ${$self->{MODULE_PATHS}}{$module}) { - close DIRHANDLE; - croak("Ambiguous paths for module $module: $possible_path and " . ${$self->{MODULE_PATHS}}{$module}); - }; - ${$self->{MODULE_PATHS}}{$module} = $possible_path; - ${$self->{MODULE_REPOSITORY}}{$module} = $repository; - } - }; - close DIRHANDLE; - } else { - croak("Cannot read $_ repository content"); - }; + get_repository_module_paths($self, $repository); }; my @false_actives = (); foreach (keys %{$self->{ACTIVATED_MODULES}}) { @@ -248,31 +261,21 @@ sub get_config_file { return ''; }; -sub get_hg_root { +# +# Fallback - fallback repository is based on RepositoryHelper educated guess +# +sub get_fallback_repository { my $self = shift; - return $self->{USER_SOURCE_ROOT} if (defined $self->{USER_SOURCE_ROOT}); - my $hg_root; - if (open(COMMAND, "hg root 2>&1 |")) { - foreach (<COMMAND>) { - next if (/^Not trusting file/); - chomp; - $hg_root = $_; - last; - }; - close COMMAND; - chomp $hg_root; - if ($hg_root !~ /There is no Mercurial repository here/) { - return $hg_root; - }; - }; - croak('Cannot open find source_config and/or determine hg root directory for ' . cwd()); + my $repository_root = RepositoryHelper->new()->get_repository_root(); + ${$self->{REPOSITORIES}}{File::Basename::basename($repository_root)} = $repository_root; }; sub read_config_file { my $self = shift; if (!$self->{SOURCE_CONFIG_FILE}) { - my $repository_root = get_hg_root($self); - ${$self->{REPOSITORIES}}{File::Basename::basename($repository_root)} = $repository_root; + if (!defined $self->{USER_SOURCE_ROOT}) { + get_fallback_repository($self); + }; return; }; my $repository_section = 0; @@ -304,11 +307,9 @@ sub read_config_file { my $repository_source_path = $self->{SOURCE_ROOT} . "/$1"; if (defined $ENV{UPDMINOREXT}) { $repository_source_path .= $ENV{UPDMINOREXT}; - }; - if ((defined $self->{DEFAULT_REPOSITORY}) && (${$self->{REPOSITORIES}}{$self->{DEFAULT_REPOSITORY}} eq $repository_source_path)) { - delete ${$self->{REPOSITORIES}}{$self->{DEFAULT_REPOSITORY}}; - $self->{DEFAULT_REPOSITORY} = undef; - + if (defined ${$self->{REPOSITORIES}}{$1.$ENV{UPDMINOREXT}}) { + delete ${$self->{REPOSITORIES}}{$1.$ENV{UPDMINOREXT}}; + }; }; ${$self->{REPOSITORIES}}{$1} = $repository_source_path; ${$self->{ACTIVATED_REPOSITORIES}}{$1}++; @@ -323,9 +324,7 @@ sub read_config_file { }; close SOURCE_CONFIG_FILE; if (!scalar keys %{$self->{REPOSITORIES}}) { - # Fallback - default repository is the directory where is our module... - my $hg_root = get_hg_root($self); - ${$self->{REPOSITORIES}}{File::Basename::basename($hg_root)} = $hg_root; + get_fallback_repository($self); }; } else { croak('Cannot open ' . $self->{SOURCE_CONFIG_FILE} . 'for reading'); @@ -379,15 +378,18 @@ sub remove_activated_modules { sub add_active_repositories { my $self = shift; $self->{NEW_REPOSITORIES} = shift; - croak('Empty module list passed for adding to source_config') if (!scalar @{$self->{NEW_REPOSITORIES}}); + croak('Empty repository list passed for addition to source_config') if (!scalar @{$self->{NEW_REPOSITORIES}}); $self->{VERBOSE} = shift; + foreach (@{$self->{NEW_REPOSITORIES}}) { + $self->add_repository($_); + }; generate_config_file($self); }; sub add_active_modules { my $self = shift; $self->{NEW_MODULES} = shift; - croak('Empty module list passed for adding to source_config') if (!scalar @{$self->{NEW_MODULES}}); + croak('Empty module list passed for addition to source_config') if (!scalar @{$self->{NEW_MODULES}}); $self->{VERBOSE} = shift; generate_config_file($self); }; @@ -535,6 +537,8 @@ SourceConfig - Perl extension for parsing general info databases # Get repositories for the actual workspace: $a->get_repositories(); + # Add a repository new_repository for the actual workspace (via full path): + $a->add_repository(/DEV300/new_repository); =head1 DESCRIPTION @@ -559,6 +563,11 @@ SourceConfig::get_repositories() Returns sorted list of active repositories for the actual workspace +SourceConfig::add_repository(REPOSITORY_PATH) + +Adds a repository to the list of active repositories + + SourceConfig::get_active_modules() Returns a sorted list of active modules @@ -622,6 +631,7 @@ Removes all activated repositories from the source_config file SourceConfig::new() SourceConfig::get_version() SourceConfig::get_repositories() +SourceConfig::add_repository() SourceConfig::get_active_modules() SourceConfig::get_all_modules() SourceConfig::get_module_path($module) 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/environment.pm b/solenv/bin/modules/installer/environment.pm index b54912b72616..98bdffb3122a 100644 --- a/solenv/bin/modules/installer/environment.pm +++ b/solenv/bin/modules/installer/environment.pm @@ -117,9 +117,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; } diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm index f8e35f208251..8b828b85335f 100644 --- a/solenv/bin/modules/installer/epmfile.pm +++ b/solenv/bin/modules/installer/epmfile.pm @@ -762,33 +762,13 @@ sub replace_many_variables_in_shellscripts foreach $key (keys %{$variableshashref}) { my $value = $variableshashref->{$key}; - if ( ! $value =~ /.oxt/ ) { $value = lc($value); } # lowercase ! - if ( $installer::globals::issolarisbuild) { $value =~ s/\.org/org/g; } # openofficeorg instead of openoffice.org + # $value = lc($value); # lowercase ! + # if ( $installer::globals::issolarisbuild) { $value =~ s/\.org/org/g; } # openofficeorg instead of openoffice.org replace_variable_in_shellscripts($scriptref, $value, $key); } } ####################################### -# Setting oxt file name variable -####################################### - -sub set_oxt_filename -{ - my ($filesinpackage, $allvariables) = @_; - - for ( my $i = 0; $i <= $#{$filesinpackage}; $i++ ) - { - my $onefile = ${$filesinpackage}[$i]; - if ( $onefile->{'Name'} =~ /.oxt\s*$/ ) - { - $allvariables->{'OXTFILENAME'} = $onefile->{'Name'}; - # $allvariables->{'FULLOXTFILENAME'} = $onefile->{'destination'}; - last; # only one oxt file for each rpm! - } - } -} - -####################################### # Adding shell scripts to epm file ####################################### @@ -796,9 +776,6 @@ sub adding_shellscripts_to_epm_file { my ($epmfileref, $shellscriptsfilename, $localrootpath, $allvariableshashref, $filesinpackage) = @_; - # Setting variable for ${OXTFILENAME} into $allvariableshashref, if this is a RPM with an extension - set_oxt_filename($filesinpackage, $allvariableshashref); - # $installer::globals::shellscriptsfilename push( @{$epmfileref}, "\n\n" ); @@ -1803,26 +1780,27 @@ sub is_extension_package # share/extension/install ###################################################################### -sub get_extension_name +sub contains_extension_dir { my ($prototypefile) = @_; - my $extensionName = ""; + my $contains_extension_dir = 0; + + # d none opt/openoffice.org3/share/extensions/ for ( my $i = 0; $i <= $#{$prototypefile}; $i++ ) { my $line = ${$prototypefile}[$i]; - if ( $line =~ /^\s*f\s+none\s+share\/extension\/install\/(\w+?\.oxt)\s*\=/ ) + if ( $line =~ /^\s*d\s+none\s.*\/share\/extensions\// ) { - $extensionName = $1; + $contains_extension_dir = 1; last; } } - return $extensionName; + return $contains_extension_dir; } - ############################################################ # A Solaris patch contains 7 specific scripts ############################################################ @@ -1839,9 +1817,9 @@ sub add_scripts_into_prototypefile $path = $path . $installer::globals::separator; my @newlines = (); - my $extensionname = get_extension_name($prototypefile); + my $is_extension_package = contains_extension_dir($prototypefile); - if ( $extensionname ne "" ) + if ( $is_extension_package ) { for ( my $i = 0; $i <= $#installer::globals::solarispatchscriptsforextensions; $i++ ) { @@ -1865,9 +1843,7 @@ sub add_scripts_into_prototypefile my $scriptfile = installer::files::read_file($sourcefilename); # Replacing variables - my $oldstring = "\$\{OXTFILENAME\}"; - replace_variables_in_shellscripts_for_patch($scriptfile, $destpath, $oldstring, $extensionname); - $oldstring = "PRODUCTDIRECTORYNAME"; + my $oldstring = "PRODUCTDIRECTORYNAME"; replace_variables_in_shellscripts_for_patch($scriptfile, $destpath, $oldstring, $staticpath); # Saving file diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index ccef960e0337..7d6e8c4a9b8f 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -118,8 +118,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; @@ -184,7 +182,7 @@ BEGIN $installertypedir = ""; $controlledmakecabversion = "5"; $saved_packages_path = ""; - $max_lang_length = 65; + $max_lang_length = 50; $globalblock = "Globals"; $rootmodulegid = ""; %alllangmodules = (); @@ -238,9 +236,6 @@ BEGIN $creating_windows_installer_patch = 0; $strip = 1; - $solarjava = 0; - $jdklib = ""; - $jrepath = ""; $globallogging = 0; $globalloggingform21 = 1; @@ -409,9 +404,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 +446,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 =(); @featurecollector =(); $msiassemblyfiles = ""; @@ -502,7 +492,6 @@ BEGIN $separator = "/"; $pathseparator = "\:"; $libextension = "\.dll"; - $quote = "\'"; $isunix = 0; $iswin = 1; $archiveformat = ".zip"; @@ -527,7 +516,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 d3ce8a1d3a32..70bc32e36c7c 100644 --- a/solenv/bin/modules/installer/parameter.pm +++ b/solenv/bin/modules/installer/parameter.pm @@ -368,19 +368,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"; } @@ -638,8 +625,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 1c2821549131..000000000000 --- a/solenv/bin/modules/installer/regmerge.pm +++ /dev/null @@ -1,340 +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_occured = 0; - - for ( my $i = 0; $i <= $#{$registerfiles}; $i++ ) - { - my $registerfile = $databasedir . $installer::globals::separator . $i . ".tmp"; - open (IN, '<', $registerfiles->[$i]) or $error_occured = 1; - open (OUT, '>', $registerfile) or $error_occured = 1; - while (<IN>) - { - s/^ComponentName=/ComponentName=$prefix/; - print OUT $_ or $error_occured = 1; - } - close IN or $error_occured = 1; - close OUT or $error_occured = 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_occured = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - } - } - - return $error_occured; -} - -################################################################ -# 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 = "starregistryrdb"; <- not unique! - 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 7a2c4cb3f5e3..54d22df1e19e 100644 --- a/solenv/bin/modules/installer/scriptitems.pm +++ b/solenv/bin/modules/installer/scriptitems.pm @@ -1223,7 +1223,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; } @@ -1352,12 +1352,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 ) { - 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_occured = 1; - if ( ! $installer::globals::languagepack ) + next; # removing this file from list, if sourcepath is empty + } + else # 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); @@ -1367,27 +1376,14 @@ sub remove_Files_Without_Sourcedirectory next; # removing this file from list, if sourcepath is empty } - else # 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_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 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 } } } diff --git a/solenv/bin/modules/installer/servicesfile.pm b/solenv/bin/modules/installer/servicesfile.pm deleted file mode 100644 index 63e5f44125c8..000000000000 --- a/solenv/bin/modules/installer/servicesfile.pm +++ /dev/null @@ -1,1073 +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_occured = 0; - my $filestring = ""; - for ( my $i = 0; $i <= $#{$unocomponents}; ++$i ) - { - my $local_error1_occured = 0; - my $local_error2_occured = 0; - - my $sourcepath = make_file_url(${$unocomponents}[$i]->{'sourcepath'}); - my $urlprefix = ${$unocomponents}[$i]->{'NativeServicesURLPrefix'}; - if (defined($urlprefix)) - { - $local_error1_occured = 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_occured = call_regcomp($regcompfileref, $servicesfile, $filestring, $nativeservicesurlprefix); - $filestring = ""; - } - - if (( $local_error1_occured ) || ( $local_error2_occured )) { $error_occured = 1; } - } - - return $error_occured; -} - -sub call_regcomp -{ - my ($regcompfileref, $servicesfile, $filestring, $urlprefix) = @_; - my @regcompoutput = (); - - my $error_occured = 0; - - my $systemcall = "$installer::globals::wrapcmd $$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_occured = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - } - - return $error_occured; -} - -################################################################ -# 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_occured = 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 = "$installer::globals::wrapcmd $$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_occured = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - } - - push( @installer::globals::logfileinfo, $infoline); - - $filestring = ""; - } - else - { - $filestring = $filestring . ";"; - } - } - } - - return $error_occured; -} - - - -################################################################ -# Helper routine to change cygwin (POSIX) path to DOS notation -# if needed -################################################################ -sub fix_cygwin_path -{ - my ( $path ) = @_; - - if ( $installer::globals::iswin eq 1 && $installer::globals::wrapcmd eq "" ) - { - $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_occured = 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 = "$installer::globals::wrapcmd $$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_occured = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - } - - chdir($from); - - $counter = 0; - $filestring = ""; - } - } - } - - return $error_occured; -} - -################################################################ -# 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_occured = 0; - $java_error_occured = 0; - $python_error_occured = 0; - - if ( $#unocomponents > -1 ) { $uno_error_occured = register_unocomponents($allvariableshashref, \@unocomponents, $regcompfileref, $servicesfile, $nativeservicesurlprefix); } - if ( $#javacomponents > -1 ) { $java_error_occured = register_javacomponents($allvariableshashref, \@javacomponents, $regcompfileref, $servicesfile, $regcomprdb, $javaservicesurlprefix); } - if ( $#pythoncomponents > -1 ) { $python_error_occured = register_pythoncomponents(\@pythoncomponents, $regcompfileref, $servicesfile, $includepatharrayref); } - - if ( $uno_error_occured || $java_error_occured || $python_error_occured ) { $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 = "$installer::globals::wrapcmd $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_occured = 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_occured = 1; - } - } - - if ( $error_occured ) - { - 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 = "services.rdb"; - my $servicesname = $registryfile->{'Name'}; # not unique! - my $servicesgid = $registryfile->{'gid'}; # unique - my $uniquedirname = $servicesgid . "_servicesrdb"; - # my $uniquedirname = $servicesgid; - - my ($nativeservicesurlprefix, $javaservicesurlprefix) = set_url_prefixes($registryfile); - - installer::logger::include_header_into_logfile("Creating $servicesname ($servicesgid):"); - - # my $servicesdir = installer::systemactions::create_directories($servicesname, $languagestringref); - my $servicesdir = installer::systemactions::create_directories($uniquedirname, $languagestringref); - -# if ( $^O =~ /cygwin/i ) -# { # $servicesdir is used as a parameter for regcomp and has to be DOS style -# $servicesdir = qx{cygpath -d "$servicesdir"}; -# chomp($servicesdir); -# $servicesdir =~ s/\\/\//g; -# } - - 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 ((-f $servicesfile) && (!($installer::globals::services_rdb_created))) { $installer::globals::services_rdb_created = 1; } - # if ((!($installer::globals::services_rdb_created)) && $installer::globals::servicesrdb_can_be_created ) # This has to be done once - 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($filesarrayref, $regcompfileref, $servicesfile, $regcomprdb, $includepatharrayref); - 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! - # add_services_sourcepath_into_filearray( $filesarrayref, $servicesfile, $servicesname ); - } - } - - # 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 fdf9fc6fa4c3..518edc683c3d 100644 --- a/solenv/bin/modules/installer/simplepackage.pm +++ b/solenv/bin/modules/installer/simplepackage.pm @@ -71,9 +71,10 @@ sub get_extensions_dir my $extensiondir = $subfolderdir . $installer::globals::separator; if ( $installer::globals::officedirhostname ne "" ) { $extensiondir = $extensiondir . $installer::globals::officedirhostname . $installer::globals::separator; } - $extensiondir = $extensiondir . "share" . $installer::globals::separator . "extensions"; + my $extensionsdir = $extensiondir . "share" . $installer::globals::separator . "extensions"; + my $preregdir = $extensiondir . "share" . $installer::globals::separator . "prereg" . $installer::globals::separator . "bundled"; - return $extensiondir; + return ( $extensionsdir, $preregdir ); } #################################################### @@ -82,21 +83,24 @@ sub get_extensions_dir sub register_extensions { - my ($officedir, $languagestringref) = @_; + my ($officedir, $languagestringref, $preregdir) = @_; + + my $infoline = ""; + + if ( $preregdir eq "" ) + { + $infoline = "ERROR: Failed to determine directory \"prereg\" for extension registration! Please check your installation set.\n"; + push( @installer::globals::logfileinfo, $infoline); + installer::exiter::exit_program($infoline, "register_extensions"); + } my $programdir = $officedir . $installer::globals::separator; - # if ( $installer::globals::sundirhostname ne "" ) { $programdir = $programdir . $installer::globals::sundirhostname . $installer::globals::separator; } if ( $installer::globals::officedirhostname ne "" ) { $programdir = $programdir . $installer::globals::officedirhostname . $installer::globals::separator; } $programdir = $programdir . "program"; my $from = cwd(); chdir($programdir); - my $infoline = ""; - - # my $unopkgfile = $officedir . $installer::globals::separator . "program" . - # $installer::globals::separator . $installer::globals::unopkgfile; - my $unopkgfile = $installer::globals::unopkgfile; my $unopkgexists = 1; @@ -107,87 +111,73 @@ sub register_extensions push( @installer::globals::logfileinfo, $infoline); } - # my $extensiondir = $officedir . $installer::globals::separator . "share" . - # $installer::globals::separator . "extension" . - # $installer::globals::separator . "install"; - - my $extensiondir = ".." . $installer::globals::separator . "share" . $installer::globals::separator . "extension" . $installer::globals::separator . "install"; - - my $allextensions = installer::systemactions::find_file_with_file_extension("oxt", $extensiondir); + if ( ! -f $unopkgfile ) + { + $unopkgexists = 0; + $infoline = "Info: File $unopkgfile does not exist! Extensions cannot be registered.\n"; + push( @installer::globals::logfileinfo, $infoline); + } - if (( $#{$allextensions} > -1 ) && ( $unopkgexists )) + if ( $unopkgexists ) { my $currentdir = cwd(); print "... current dir: $currentdir ...\n"; $infoline = "Current dir: $currentdir\n"; push( @installer::globals::logfileinfo, $infoline); - for ( my $i = 0; $i <= $#{$allextensions}; $i++ ) - { - my $oneextension = $extensiondir . $installer::globals::separator . ${$allextensions}[$i]; - - # my $systemcall = $unopkgfile . " add --shared --suppress-license " . "\"" . $oneextension . "\""; + if ( ! -f $unopkgfile ) { installer::exiter::exit_program("ERROR: $unopkgfile not found!", "register_extensions"); } - if ( ! -f $unopkgfile ) { installer::exiter::exit_program("ERROR: $unopkgfile not found!", "register_extensions"); } - if ( ! -f $oneextension ) { installer::exiter::exit_program("ERROR: $oneextension not found!", "register_extensions"); } + my $localtemppath = installer::systemactions::create_directories("uno", $languagestringref); - my $localtemppath = installer::systemactions::create_directories("uno", $languagestringref); + my $slash = ""; - if ( $installer::globals::iswindowsbuild ) + if ( $installer::globals::iswindowsbuild ) + { + if ( $^O =~ /cygwin/i ) { - if ( $^O =~ /cygwin/i ) - { - $localtemppath = $installer::globals::cyg_temppath; - } - else - { - $windowsslash = "\/"; - } - $localtemppath =~ s/\\/\//g; - $localtemppath = "/".$localtemppath; + $localtemppath = $installer::globals::cyg_temppath; + $preregdir = qx{cygpath -m "$preregdir"}; + chomp($preregdir); } - my $systemcall = $unopkgfile . " add --shared --suppress-license --verbose " . $oneextension . " -env:UserInstallation=file://" . $localtemppath . " 2\>\&1 |"; + $localtemppath =~ s/\\/\//g; + $slash = "/"; # Third slash for Windows. Other OS pathes already start with "/" + } - print "... $systemcall ...\n"; + $preregdir =~ s/\/\s*$//g; - $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); + my $systemcall = $unopkgfile . " sync --verbose -env:BUNDLED_EXTENSIONS_USER=\"file://" . $slash . $preregdir . "\"" . " -env:UserInstallation=file://" . $slash . $localtemppath . " 2\>\&1 |"; - my @unopkgoutput = (); + print "... $systemcall ...\n"; - open (UNOPKG, $systemcall); - while (<UNOPKG>) - { - my $lastline = $_; - push(@unopkgoutput, $lastline); - } - close (UNOPKG); + $infoline = "Systemcall: $systemcall\n"; + push( @installer::globals::logfileinfo, $infoline); - my $returnvalue = $?; # $? contains the return value of the systemcall + my @unopkgoutput = (); - if ($returnvalue) - { - # Writing content of @unopkgoutput only in the error case into the log file. Sometimes it - # contains strings like "Error" even in the case of success. This causes a packaging error - # when the log file is analyzed at the end, even if there is no real error. - for ( my $j = 0; $j <= $#unopkgoutput; $j++ ) { push( @installer::globals::logfileinfo, "$unopkgoutput[$j]"); } + open (UNOPKG, $systemcall); + while (<UNOPKG>) + { + my $lastline = $_; + push(@unopkgoutput, $lastline); + } + close (UNOPKG); - $infoline = "ERROR: Could not execute \"$systemcall\"!\nExitcode: '$returnvalue'\n"; - push( @installer::globals::logfileinfo, $infoline); - installer::exiter::exit_program("ERROR: $systemcall failed!", "register_extensions"); - } - else - { - $infoline = "Success: Executed \"$systemcall\" successfully!\n"; - push( @installer::globals::logfileinfo, $infoline); - } + my $returnvalue = $?; # $? contains the return value of the systemcall + + if ($returnvalue) + { + # Writing content of @unopkgoutput only in the error case into the log file. Sometimes it + # contains strings like "Error" even in the case of success. This causes a packaging error + # when the log file is analyzed at the end, even if there is no real error. + for ( my $j = 0; $j <= $#unopkgoutput; $j++ ) { push( @installer::globals::logfileinfo, "$unopkgoutput[$j]"); } + + $infoline = "ERROR: Could not execute \"$systemcall\"!\nExitcode: '$returnvalue'\n"; + push( @installer::globals::logfileinfo, $infoline); + installer::exiter::exit_program("ERROR: $systemcall failed!", "register_extensions"); } - } - else - { - if ( ! ( $#{$allextensions} > -1 )) + else { - $infoline = "No extensions located in directory $extensiondir.\n"; + $infoline = "Success: Executed \"$systemcall\" successfully!\n"; push( @installer::globals::logfileinfo, $infoline); } } @@ -662,6 +652,7 @@ sub create_simple_package if ( $onedir->{'HostName'} ) { my $destdir = $subfolderdir . $installer::globals::separator . $onedir->{'HostName'}; + if ( ! -d $destdir ) { if ( $^O =~ /cygwin/i ) # Cygwin performance check @@ -787,19 +778,18 @@ sub create_simple_package system($localcall); } - # Registering the extensions - - # installer::logger::print_message( "... registering extensions ...\n" ); - # installer::logger::include_header_into_logfile("Registering extensions:"); - # register_extensions($subfolderdir, $languagestringref); - installer::logger::print_message( "... removing superfluous directories ...\n" ); installer::logger::include_header_into_logfile("Removing superfluous directories:"); - my $extensionfolder = get_extensions_dir($subfolderdir); - + my ( $extensionfolder, $preregdir ) = get_extensions_dir($subfolderdir); installer::systemactions::remove_empty_dirs_in_folder($extensionfolder); + # Registering the extensions + + installer::logger::print_message( "... registering extensions ...\n" ); + installer::logger::include_header_into_logfile("Registering extensions:"); + register_extensions($subfolderdir, $languagestringref, $preregdir); + if ( $installer::globals::compiler =~ /^unxmacx/ ) { installer::worker::put_scpactions_into_installset("$installdir/$packagename"); diff --git a/solenv/bin/modules/installer/windows/property.pm b/solenv/bin/modules/installer/windows/property.pm index e9f122a54d86..35866103d9fa 100644 --- a/solenv/bin/modules/installer/windows/property.pm +++ b/solenv/bin/modules/installer/windows/property.pm @@ -316,6 +316,11 @@ sub set_important_properties { my $onepropertyline = "OFFICEDIRHOSTNAME" . "\t" . $installer::globals::officedirhostname . "\n"; push(@{$propertyfile}, $onepropertyline); + + my $localofficedirhostname = $installer::globals::officedirhostname; + $localofficedirhostname =~ s/\//\\/g; + $onepropertyline = "OFFICEDIRHOSTNAME_" . "\t" . $localofficedirhostname . "\n"; + push(@{$propertyfile}, $onepropertyline); } if ( $installer::globals::sundirhostname ) diff --git a/solenv/bin/modules/installer/ziplist.pm b/solenv/bin/modules/installer/ziplist.pm index ddc98c43bdb7..9a5460cacb3c 100644 --- a/solenv/bin/modules/installer/ziplist.pm +++ b/solenv/bin/modules/installer/ziplist.pm @@ -806,6 +806,7 @@ sub add_variables_to_allvariableshashref $variableshashref->{'PRODUCTMINOR'} = $localminor; $variableshashref->{'PRODUCTBUILDID'} = $installer::globals::buildid; + $variableshashref->{'SYSTEM_LIBTEXTCAT_DATA'} = $ENV{'SYSTEM_LIBTEXTCAT_DATA'} , if( defined $ENV{'SYSTEM_LIBTEXTCAT_DATA'} && $ENV{'SYSTEM_LIBTEXTCAT_DATA'} ne "" ); } 1; 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/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/subsequenttests b/solenv/bin/subsequenttests index 34e6b8034c70..8b52f45a6b12 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,16 +40,34 @@ 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(); +my $sc = SourceConfig->new($ENV{'SOLARSRC'}); my $module; foreach $module ($sc->get_active_modules()) { my $buildlst = $sc->get_module_build_list($module); @@ -82,6 +102,13 @@ foreach $module ($sc->get_active_modules()) { } } +if ($dry_run) { + foreach $path (@testpaths) { + print "$path\n"; + } + exit(0); +} + my $cmd = 'dmake'; foreach (@ARGV) { s/'/'\''/g; @@ -119,8 +146,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 0d6ab34583b3..87dcb21deb53 100644 --- a/solenv/bin/transform_description.pl +++ b/solenv/bin/transform_description.pl @@ -55,9 +55,9 @@ sub parse_args # check which languages to use my $languages = $ENV{WITH_LANG}; - if ( ! defined $languages ) + if ( ( ! defined $languages ) || ( "$languages" eq "" ) ) { - print STDERR "$0: WITH_LANG not set, defaulting to 'en-US'\n"; + print STDERR "$0: WITH_LANG not set or empty, defaulting to 'en-US'\n"; $languages = "en-US"; } @languages = split ( ' ', $languages ); |