diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-03-08 19:43:29 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-03-08 19:43:29 -0600 |
commit | f0e5895d5baa04826d1884fc4720c6180f2eda04 (patch) | |
tree | d839e9131057f9d1271ec2578d1b370dcb89e032 /solenv/bin/modules | |
parent | 7572bcf0b17da4b37bf4ba834347196567ec3c37 (diff) | |
parent | 853a58836446858b75bf82916272e9fd27a7a892 (diff) |
Merge commit 'ooo/DEV300_m101' into integration/dev300_m101
* commit 'ooo/DEV300_m101': (500 commits)
masterfix DEV300: #i10000# remove hard dep
masterfix DEV300: #i10000# usage of L10N build_type
masterfix DEV300: #i10000# usage of L10N build_type
masterfix DEV300: #i100000# dep. fix
masterfix DEV300: #i10000# removed one hard dep
masterfix DEV300: #i10000# fixed patch handling
masterfix DEV300: #i10000# new configure
DEV300
masterfix DEV300: #i10000# nawk -> awk
l10nmove: adjust repository handling
l10nmove: fixed regex
l10nmove: minor fixes
l10nmove: add l10n repo to gb_REPOS
DEV300 masterfix: gnumake3: subsequenttests requires in environment
ab80: Adding changes of cws mib21, ab77, ab77run2, dr77i to dev300
DEV300 masterfix: #i10000#: windows: more bizare hacks ...
locales34: have a matching configure as well
DEV300
locales34: back out change from autoreconf
gnumake3: JunitTest.mk: bizarre hacks to make it work on windows
...
Conflicts:
configure
configure.in
instsetoo_native/prj/build.lst
instsetoo_native/util/makefile.mk
instsetoo_native/util/openoffice.lst
instsetoo_native/util/pack.lst
ooo.lst
scp2/source/canvas/canvascommons.scp
scp2/source/canvas/mtfrenderer.scp
scp2/source/ooo/common_brand.scp
scp2/source/ooo/directory_ooo.scp
scp2/source/ooo/file_library_ooo.scp
scp2/source/ooo/file_ooo.scp
scp2/source/ooo/makefile.mk
scp2/source/ooo/module_hidden_ooo.scp
scp2/source/ooo/module_langpack.ulf
scp2/source/ooo/ure.scp
scp2/source/python/file_python.scp
scp2/source/sdkoo/sdkoo.scp
scp2/source/templates/module_langpack_accessories_templates.sct
scp2/source/templates/module_langpack_accessories_templates_root.sct
set_soenv.in
soldep/bootstrp/appdef.cxx
soldep/bootstrp/dep.cxx
soldep/bootstrp/hashtbl.cxx
soldep/bootstrp/makefile.mk
soldep/bootstrp/minormk.cxx
soldep/bootstrp/prj.cxx
soldep/bootstrp/prodmap.cxx
soldep/inc/dep.hxx
soldep/inc/minormk.hxx
soldep/inc/prodmap.hxx
soldep/inc/soldep/appdef.hxx
soldep/inc/soldep/connctr.hxx
soldep/inc/soldep/depper.hxx
soldep/inc/soldep/depwin.hxx
soldep/inc/soldep/hashtbl.hxx
soldep/inc/soldep/objwin.hxx
soldep/inc/soldep/prj.hxx
soldep/inc/soldep/sdtresid.hxx
soldep/inc/soldep/soldep.hxx
soldep/inc/soldep/soldlg.hxx
soldep/inc/soldep/tbox.hxx
soldep/prj/d.lst
soldep/source/connctr.cxx
soldep/source/depapp.hxx
soldep/source/depper.cxx
soldep/source/depwin.cxx
soldep/source/makefile.mk
soldep/source/objwin.cxx
soldep/source/soldep.cxx
soldep/source/soldlg.cxx
soldep/source/soldlg.src
soldep/source/tbox.cxx
solenv/bin/build.pl
solenv/bin/cws.pl
solenv/bin/make_installer.pl
solenv/bin/mhids.pl
solenv/bin/modules/CwsConfig.pm
solenv/bin/modules/RepositoryHelper.pm
solenv/bin/modules/installer/regmerge.pm
solenv/bin/modules/installer/scriptitems.pm
solenv/bin/modules/installer/servicesfile.pm
solenv/bin/modules/installer/simplepackage.pm
solenv/bin/modules/installer/substfilenamefiles.pm
solenv/config/ssolar.cmn
solenv/inc/_tg_rslb.mk
solenv/inc/extension_post.mk
solenv/inc/libs.mk
solenv/inc/minor.mk
solenv/inc/postset.mk
solenv/inc/settings.mk
solenv/inc/tg_rslb.mk
solenv/inc/unxlng.mk
solenv/inc/wntmsc.mk
soltools/HIDCompiler/hidclex.l
stlport/prj/d.lst
stlport/systemstlguards/postextstl.h
Diffstat (limited to 'solenv/bin/modules')
20 files changed, 1003 insertions, 1642 deletions
diff --git a/solenv/bin/modules/CreatePDBRelocators.pm b/solenv/bin/modules/CreatePDBRelocators.pm index c31e3a053b0c..753075a2bfea 100644 --- a/solenv/bin/modules/CreatePDBRelocators.pm +++ b/solenv/bin/modules/CreatePDBRelocators.pm @@ -45,8 +45,11 @@ sub new { my $Object = shift; my $solarversion = shift; + my $workdir; + my $relworkdir; my $self = {}; - my @repositories; + my @basedirs; + my @repos; if (!defined ($solarversion)) { $solarversion = $ENV{SOLARVERSION}; @@ -58,14 +61,33 @@ sub new $self->{SOLARVERSION} = $solarversion; - my $SourceConfigObj = SourceConfig->new(); - @repositories = $SourceConfigObj->get_repositories(); + $workdir = $ENV{WORKDIR}; + if ( !$workdir ) { + print STDERR "can't determine WORKDIR.\n"; + exit (1); + } - if (!scalar @repositories) { - print STDERR "no repository and no working directory found.\n"; + if ( $workdir =~ /^$solarversion/ ) { + $relworkdir = $workdir; + $relworkdir =~ s/^$solarversion\///; + } else { + print STDERR "ERROR: workdir outside $solarversion unsupported\n"; + exit (2); + } + my $SourceConfigObj = SourceConfig->new(); + @repos = $SourceConfigObj->get_repositories(); + if ( defined $ENV{UPDMINOREXT} ) { + foreach my $onedir ( @repos ) { + push( @basedirs, $onedir.$ENV{UPDMINOREXT} ); + } + } + # basdirs is repositories (dmake) + workdir (gnu make) + push(@basedirs, $relworkdir); + if (!scalar @basedirs) { + print STDERR "no basedir and no working directory found.\n"; exit (2); } - $self->{REPOSITORIES} = \@repositories; + $self->{BASEDIRS} = \@basedirs; bless($self, $Object); return $self; } @@ -106,10 +128,10 @@ sub create_pdb_relocators } # collect files - foreach my $repository (@{$self->{REPOSITORIES}}) { + foreach my $basedir (@{$self->{BASEDIRS}}) { my @pdb_files; - my $o = $self->{SOLARVERSION} . "/$repository"; - $repository =~ s/(.*?)\.(.*)/$1/; + my $o = $self->{SOLARVERSION} . "/$basedir"; + $basedir =~ s/(.*?)\.(.*)/$1/; $self->collect_files( $o, $inpath, \@pdb_files); foreach (@pdb_files) { @@ -122,12 +144,12 @@ sub create_pdb_relocators my $target = ""; if ( $src_location =~ /\/so\// ) { - $location = "../../../$repository$milestoneext/" . $src_location; + $location = "../../../$basedir$milestoneext/" . $src_location; $target = "$pdb_dir/so/$relocator"; } else { - $location = "../../$repository$milestoneext/" . $src_location; + $location = "../../$basedir$milestoneext/" . $src_location; $target = "$pdb_dir/$relocator"; } @@ -142,14 +164,14 @@ sub create_pdb_relocators return 1; } -sub collect_files_from_all_repositories +sub collect_files_from_all_basedirs { my $self = shift; my ($platform, $filesref) = @_; - my $repository; + my $basedir; my $ret; - foreach $repository (@{$self->{REPOSITORIES}}) { - my $srcdir = $self->{SOLARVERSION} . "/$repository"; + foreach $basedir (@{$self->{BASEDIRS}}) { + my $srcdir = $self->{SOLARVERSION} . "/$basedir"; $ret |= $self->collect_files ($srcdir, $platform, $filesref); } return $ret; @@ -160,14 +182,16 @@ sub collect_files my $self = shift; my ($srcdir, $platform, $filesref) = @_; my $template = "$srcdir/*/$platform"; + my $template2 = "$srcdir/LinkTarget"; if ( $ENV{GUI} eq "WNT" ) { # collect all pdb files on o: # regular glob does not work with two wildcard on WNT my @bin = glob("$template/bin/*.pdb"); my @bin_so = glob("$template/bin/so/*.pdb"); + my @workdir = glob("$template2/*/*.pdb"); # we are only interested in pdb files which are accompanied by # .exe or .dll which the same name - foreach (@bin, @bin_so) { + foreach (@bin, @bin_so, @workdir) { my $dir = dirname($_); my $base = basename($_, ".pdb"); my $exe = "$dir/$base.exe"; @@ -180,13 +204,16 @@ sub collect_files else { # collect all shared libraries on o: my @lib = glob("$template/lib/*.so*"); + my @workdir_lib = glob("$template2/Library/*.so*"); my @lib_so = glob("$template/lib/so/*.so*"); my @mac_lib = glob("$template/lib/*.dylib*"); + my @mac_workdir_lib = glob("$template2/Library/*.dylib*"); my @mac_lib_so = glob("$template/lib/so/*.dylib*"); # collect all binary executables on o: my @bin = $self->find_binary_execs("$template/bin"); + my @workdir_bin = $self->find_binary_execs("$template2/Executable"); my @bin_so = $self->find_binary_execs("$template/bin/so"); - push(@$filesref, (@lib, @lib_so, @mac_lib, @mac_lib_so, @bin, @bin_so)); + push(@$filesref, (@lib, @lib_so, @workdir_lib, @mac_lib, @mac_workdir_lib, @mac_lib_so, @bin, @workdir_bin, @bin_so)); } return 1; } diff --git a/solenv/bin/modules/RepositoryHelper.pm b/solenv/bin/modules/RepositoryHelper.pm index 31c97e35d1c2..9bf4b841c7be 100644 --- a/solenv/bin/modules/RepositoryHelper.pm +++ b/solenv/bin/modules/RepositoryHelper.pm @@ -118,21 +118,26 @@ sub search_for_hg { sub search_via_build_lst { my $self = shift; - my @possible_build_lists = ('build.lst', 'build.xlist'); # build lists names +# my @possible_build_lists = ('build.lst', 'build.xlist'); # build lists names + my @possible_build_lists = ('build.lst'); # build lists names my $previous_dir = ''; my $rep_root_candidate = $self->{INITIAL_DIRECTORY}; do { foreach (@possible_build_lists) { - if (-e $rep_root_candidate . '/prj/'.$_) { + my $test_file; + if ($rep_root_candidate eq '/') { + $test_file = '/prj/' . $_; + } else { + $test_file = $rep_root_candidate . '/prj/' . $_; + }; + if (-e $test_file) { $self->{REPOSITORY_ROOT} = File::Basename::dirname($rep_root_candidate); return 1; - } elsif ($rep_root_candidate eq $previous_dir) { - return 0; }; }; $previous_dir = $rep_root_candidate; $rep_root_candidate = File::Basename::dirname($rep_root_candidate); - return 0 if (!$rep_root_candidate); + return 0 if ((!$rep_root_candidate) || ($rep_root_candidate eq $previous_dir)); } while (chdir "$rep_root_candidate"); }; diff --git a/solenv/bin/modules/SourceConfig.pm b/solenv/bin/modules/SourceConfig.pm index dfaa797d8f48..e7b526e2cfca 100755 --- a/solenv/bin/modules/SourceConfig.pm +++ b/solenv/bin/modules/SourceConfig.pm @@ -320,14 +320,14 @@ sub read_config_file { next; }; }; - croak("Line $line in " . $self->{SOURCE_CONFIG_FILE} . 'violates format. Please make your checks!!'); + croak("Line $line in " . $self->{SOURCE_CONFIG_FILE} . ' violates format. Please make your checks!'); }; close SOURCE_CONFIG_FILE; if (!scalar keys %{$self->{REPOSITORIES}}) { get_fallback_repository($self); }; } else { - croak('Cannot open ' . $self->{SOURCE_CONFIG_FILE} . 'for reading'); + croak('Cannot open ' . $self->{SOURCE_CONFIG_FILE} . ' for reading'); }; }; @@ -388,7 +388,18 @@ sub add_active_repositories { sub add_active_modules { my $self = shift; - $self->{NEW_MODULES} = shift; + my $module_list_ref = shift; + my $ignored_modules_string = ''; + my @real_modules = (); + foreach my $module (sort @$module_list_ref) { + if ($self->get_module_path($module)) { + push(@real_modules, $module); + } else { + $ignored_modules_string .= " $module"; + }; + }; + push (@{$self->{WARNINGS}}, "\nWARNING: following modules are not found in active repositories, and have not been added to the " . $self->get_config_file_default_path() . ":$ignored_modules_string\n") if ($ignored_modules_string); + $self->{NEW_MODULES} = \@real_modules; croak('Empty module list passed for addition to source_config') if (!scalar @{$self->{NEW_MODULES}}); $self->{VERBOSE} = shift; generate_config_file($self); diff --git a/solenv/bin/modules/SourceConfigHelper.pm b/solenv/bin/modules/SourceConfigHelper.pm new file mode 100644 index 000000000000..84ffbe0ca3f7 --- /dev/null +++ b/solenv/bin/modules/SourceConfigHelper.pm @@ -0,0 +1,422 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +#************************************************************************* +# +# SourceConfigHelper - Perl extension for parsing general info databases +# +# usage: see below +# +#************************************************************************* + +package SourceConfigHelper; + +use strict; + +use RepositoryHelper; +use SourceConfig; +use Cwd qw (cwd); +use Carp; + +my $debug = 0; +my @source_config_list; # array of sourceconfig objects + +#----------------------------------------------------------------------- +# Constants +#----------------------------------------------------------------------- + +use constant SOURCE_CONFIG_NONE => 0; +use constant SOURCE_CONFIG_CURRENT_FIRST => 1; +use constant SOURCE_CONFIG_ENVIRONMENT_FIRST => 2; +use constant SOURCE_CONFIG_CURRENT_ONLY => 3; +use constant SOURCE_CONFIG_ENVIRONMENT_ONLY => 4; + +use constant SOURCE_CONFIG_DEFAULT => SOURCE_CONFIG_CURRENT_FIRST; + +##### profiling ##### + +##### ctor ##### + +sub new { + my $proto = shift; + my $class = ref($proto) || $proto; + my $init_action = shift; + my $self = {}; + my $SourceConfigCurrent; + my $SourceConfigEnvironment; + + $init_action = SOURCE_CONFIG_DEFAULT if (!defined ($init_action)); + if (!eval ($init_action) or ($init_action < SOURCE_CONFIG_NONE) or ($init_action > SOURCE_CONFIG_ENVIRONMENT_ONLY)) { + croak("wrong initial parameter: $init_action\n"); + } + + if ($init_action != SOURCE_CONFIG_NONE) { + my $repositoryHash_ref = {}; + if ($init_action != SOURCE_CONFIG_ENVIRONMENT_ONLY) { + my $initial_directory = cwd(); + my $result = is_repository($initial_directory, $repositoryHash_ref); + if ($result) { + $SourceConfigCurrent = SourceConfig->new($repositoryHash_ref->{REPOSITORY_ROOT}); + } + } + if ($init_action != SOURCE_CONFIG_CURRENT_ONLY) { + my $source_config = $ENV{SOURCE_ROOT_DIR} . '/' . SourceConfig::SOURCE_CONFIG_FILE_NAME; + if (-f $source_config) { + $SourceConfigEnvironment = SourceConfig->new($source_config); + } + } + + # fill array + + if (($init_action == SOURCE_CONFIG_CURRENT_FIRST) or ($init_action == SOURCE_CONFIG_CURRENT_ONLY)) { + if (defined ($SourceConfigCurrent)) { + push (@source_config_list, $SourceConfigCurrent); + } + if ($init_action == SOURCE_CONFIG_CURRENT_FIRST) { + if (defined ($SourceConfigEnvironment)) { + push (@source_config_list, $SourceConfigEnvironment); + } + } + } + elsif (($init_action == SOURCE_CONFIG_ENVIRONMENT_FIRST) or ($init_action == SOURCE_CONFIG_ENVIRONMENT_ONLY)) { + if (defined ($SourceConfigEnvironment)) { + push (@source_config_list, $SourceConfigEnvironment); + } + if ($init_action == SOURCE_CONFIG_ENVIRONMENT_FIRST) { + if (defined ($SourceConfigCurrent)) { + push (@source_config_list, $SourceConfigCurrent); + } + } + } + } + + $self->{SOURCE_CONFIG_LIST} = \@source_config_list; + + bless($self, $class); + return $self; +} + +##### methods ##### + +############################################################################################ + +sub add_SourceConfig { + my $self = shift; + my $source_config = shift; + push (@{$self->{SOURCE_CONFIG_LIST}}, $source_config); +} + +############################################################################################ + +sub get_SourceConfigList { + my $self = shift; + return @{$self->{SOURCE_CONFIG_LIST}}; +} + +############################################################################################ + +sub has_SourceConfig { + my $self = shift; + my $result = 0; + my $count = @{$self->{SOURCE_CONFIG_LIST}}; + $result = 1 if ($count > 0); + return $result; +} + +############################################################################################ + +sub get_module_path { + my $self = shift; + my $module = shift; + my $function = \&SourceConfig::get_module_path; + my $result; + $result = $self->get_StringResult ($function, $module); + return $result; +} + +############################################################################################ + +sub get_active_modules { + my $self = shift; + my $parameter; # empty + my $function = \&SourceConfig::get_active_modules; + my $array_ref; + $array_ref = $self->get_ArrayResult ($function, $parameter); + return @$array_ref; +} + +############################################################################################ + +sub get_repositories { + my $self = shift; + my $parameter; # empty + my $function = \&SourceConfig::get_repositories; + my $array_ref; + $array_ref = $self->get_ArrayResult ($function, $parameter); + return @$array_ref; +} + +############################################################################################ + +sub get_module_repository { + my $self = shift; + my $module = shift; + my $function = \&SourceConfig::get_module_repository; + my $result; + $result = $self->get_StringResult ($function, $module); + return $result; +} + +############################################################################################ + +sub is_active { + my $self = shift; + my $module = shift; + my $function = \&SourceConfig::is_active; + my $result_ref; + my $is_active = 0; + $result_ref = $self->get_ResultOfList ($function, $module); + my $count = @$result_ref; + if ($count>0) { + foreach my $active (@$result_ref) { + if ($active) { + $is_active = $active; + } + } + } + return $is_active; +} + +##### private methods ##### + +############################################################################################ +# +# is_repository () : check if the directory is a valid repository +# +# input: - directory +# - hash reference, where the output will be stored +# +# output: 0 = FALSE, the directory is no valid repository +# 1 = TRUE, the repository root can be found in $repositoryHash_ref->{REPOSITORY_ROOT} +# +############################################################################################ + +sub is_repository { + my $directory = shift; + my $repositoryHash_ref = shift; + $repositoryHash_ref->{INITIAL_DIRECTORY} = $directory; + $repositoryHash_ref->{REPOSITORY_ROOT} = undef; + $repositoryHash_ref->{REPOSITORY_NAME} = undef; + my $result = RepositoryHelper::search_via_build_lst($repositoryHash_ref); + chdir $repositoryHash_ref->{INITIAL_DIRECTORY}; + if (!$result) { + $result = RepositoryHelper::search_for_hg($repositoryHash_ref); + } + return $result; +} + +############################################################################################ +# +# get_ResultOfList(): give back an array reference from all SourceConfig Objects results +# +# input: - function : reference to the called function of each SourceConfig Object +# - parameter : parameter for the called function +# +# output: result : array of all results +# +############################################################################################ + +sub get_ResultOfList { + my $self = shift; + my $function = shift; + my $parameter = shift; + my @result; + foreach my $source_config (@{$self->{SOURCE_CONFIG_LIST}}) { + push (@result, &$function ($source_config, $parameter)); + } + return \@result; +} + +############################################################################################ +# +# get_StringResult(): give back the first defined result from all SourceConfig Objects +# +# input: - function : reference to the called function of each SourceConfig Object +# - parameter : parameter for the called function +# +# output: result : scalar variable (string), undef if no result +# +############################################################################################ + +sub get_StringResult { + my $self = shift; + my $function = shift; + my $parameter = shift; + my $result_ref; + $result_ref = $self->get_ResultOfList ($function, $parameter); + my $count = @$result_ref; + if ($count>0) { + my $value; + my $i = 0; + while (($i < $count) and !defined ($value)) { # search the first defined result + $value = $$result_ref[$i]; + $i++; + } + return $value; + } + return undef; +} + +############################################################################################ +# +# get_StringResult(): give back a sorted and uniqe array reference of the results +# from all SourceConfig Objects +# +# input: - function : reference to the called function of each SourceConfig Object +# - parameter : parameter for the called function +# +# output: result : sorted and uniqe array reference +# +############################################################################################ + +sub get_ArrayResult { + my $self = shift; + my $function = shift; + my $parameter = shift; + my $result_ref; + my @modules; + $result_ref = $self->get_ResultOfList ($function, $parameter); + my $count = @$result_ref; + if ($count>0) { + my %moduleHash; + foreach my $module (@$result_ref) { + $moduleHash{$module}++; + } + @modules = sort keys %moduleHash; + } + return \@modules; +} + + ##### finish ##### + +1; # needed by use or require + +__END__ + +=head1 NAME + +SourceConfigHelper - Perl extension for handling with SourceConfigObjetcs + +=head1 SYNOPSIS + + # example that will read source_config file and return the active repositories + + use SourceConfigHelper; + + # Create a new instance: + $a = SourceConfigHelper->new(); + + # Get repositories for the actual workspace: + $a->get_repositories(); + +=head1 DESCRIPTION + +SourceConfigHelper is a perl extension to handle more than one objects of SourceConfig +to set up a search order for modules. + +Methods: + +SourceConfigHelper::new() + +Creates a new instance of SourceConfigHelper. Can be initialized by: default - empty or with a constant of search order. default: the source_config will be taken first from the current repository and second from the environment +Possible parameters are: +SourceConfigHelper::SOURCE_CONFIG_NONE - no SourceConfig Object will be created +SourceConfigHelper::SOURCE_CONFIG_CURRENT_FIRST - use the current repository first +SourceConfigHelper::SOURCE_CONFIG_ENVIRONMENT_FIRST - use the repository of the environment first +SourceConfigHelper::SOURCE_CONFIG_CURRENT_ONLY - use only the current repository +SourceConfigHelper::SOURCE_CONFIG_ENVIRONMENT_ONLY - use only the repository of the environment + +SourceConfigHelper::get_repositories() + +Returns sorted list of active repositories for the actual workspace + +SourceConfigHelper::get_active_modules() + +Returns a sorted list of active modules + +SourceConfigHelper::get_all_modules() + +Returns sorted list of all modules in active repositories. + +SourceConfigHelper::get_module_path($module) + +Returns absolute module path. If the module is not active or don't exists, "undef" will be returned. + +SourceConfigHelper::get_module_repository($module) + +Returns the module's repository. If the module is not active or don't exists, "undef" will be returned. + +SourceConfigHelper::is_active() + +Returns 1 (TRUE) if a module is active +Returns 0 (FALSE) if a module is not active + +SourceConfigHelper::add_SourceConfig($SourceConfigObject) + +Add the SourceConfigObject to the end of the list + +SourceConfigHelper::get_SourceConfigList() + +Return an array of SourceConfigObjects + +SourceConfigHelper::has_SourceConfig() + +Returns 1 (TRUE) if one or more SourceConfig Objects is in the list +Returns 0 (FALSE) if no SourceConfig Object is in the list (can happen if there is no valid repository) + +=head2 EXPORT + +SourceConfigHelper::new() +SourceConfigHelper::get_repositories() +SourceConfigHelper::get_active_modules() +SourceConfigHelper::get_all_modules() +SourceConfigHelper::get_module_path($module) +SourceConfigHelper::get_module_repository($module) +SourceConfigHelper::is_active($module) +SourceConfigHelper::add_SourceConfig($SourceConfigObject) +SourceConfigHelper::get_SourceConfigList() +SourceConfigHelper::has_SourceConfig() + +=head1 AUTHOR + +Kurt Zenker, kz@openoffice.org + +=head1 SEE ALSO + +perl(1). + +=cut diff --git a/solenv/bin/modules/installer/control.pm b/solenv/bin/modules/installer/control.pm index 9fdfae4d9c66..3f6b43f563fb 100644 --- a/solenv/bin/modules/installer/control.pm +++ b/solenv/bin/modules/installer/control.pm @@ -320,6 +320,11 @@ sub check_logfile my @output = (); my $contains_error = 0; + my $ignore_error = 0; + my $make_error_to_warning = 0; + + if (( ! $installer::globals::pro ) && ( $installer::globals::ignore_error_in_logfile )) { $ignore_error = 1; } + for ( my $i = 0; $i <= $#{$logfile}; $i++ ) { my $line = ${$logfile}[$i]; @@ -337,6 +342,12 @@ sub check_logfile { $contains_error = 1; push(@errors, $line); + + if ( $ignore_error ) + { + $contains_error = 0; + $make_error_to_warning = 1; + } } } @@ -358,7 +369,26 @@ sub check_logfile } else { - my $line = "\n***********************************************************\n"; + my $line = ""; + + if ( $make_error_to_warning ) + { + $line = "\n*********************************************************************\n"; + push(@output, $line); + $line = "The following errors in the log file were ignored:\n\n"; + push(@output, $line); + + for ( my $i = 0; $i <= $#errors; $i++ ) + { + $line = "$errors[$i]"; + push(@output, $line); + } + + $line = "*********************************************************************\n"; + push(@output, $line); + } + + $line = "\n***********************************************************\n"; push(@output, $line); $line = "Successful packaging process!\n"; push(@output, $line); diff --git a/solenv/bin/modules/installer/environment.pm b/solenv/bin/modules/installer/environment.pm index 4b4d93aa3723..5c8c4ab25e40 100644 --- a/solenv/bin/modules/installer/environment.pm +++ b/solenv/bin/modules/installer/environment.pm @@ -115,9 +115,6 @@ sub set_global_environment_variables if ( $ENV{'LAST_MINOR'} ) { $installer::globals::lastminor = $ENV{'LAST_MINOR'}; } if ( $ENV{'PROEXT'} ) { $installer::globals::pro = 1; } - if ( $ENV{'SOLAR_JAVA'} ) { $installer::globals::solarjava = 1; } - if ( $ENV{'JDKLIB'} ) { $installer::globals::jdklib = $ENV{'JDKLIB'}; } - if ( $ENV{'JREPATH'} ) { $installer::globals::jrepath = $ENV{'JREPATH'}; } if ( $ENV{'VERBOSE'} && ( (lc $ENV{'VERBOSE'}) eq "false" ) ) { $installer::globals::quiet = 1; } if ( $ENV{'PREPARE_WINPATCH'} ) { $installer::globals::prepare_winpatch = 1; } @@ -129,6 +126,7 @@ sub set_global_environment_variables if ( $ENV{'SOLAR_JAVA'} ) { $installer::globals::solarjavaset = 1; } if ( $ENV{'RPM'} ) { $installer::globals::rpm = $ENV{'RPM'}; } if ( $ENV{'DONTCOMPRESS'} ) { $installer::globals::solarisdontcompress = 1; } + if ( $ENV{'IGNORE_ERROR_IN_LOGFILE'} ) { $installer::globals::ignore_error_in_logfile = 1; } if (( $ENV{'DISABLE_STRIP'} ) && ( $ENV{'DISABLE_STRIP'} ne '' )) { $installer::globals::strip = 0; } if ( $installer::globals::localinstalldir ) { $installer::globals::localinstalldirset = 1; } diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index 0d3bc2603f6b..6b82c17885d0 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -87,7 +87,8 @@ BEGIN "oc", "ml", "as", - "ast" + "ast", + "ht" ); @items_at_modules = ("Files", "Dirs", "Unixlinks"); @asianlanguages = ("ja", "ko", "zh-CN", "zh-TW"); @@ -118,8 +119,6 @@ BEGIN $dounzip = 1; $languages_defined_in_productlist = 0; $setupscript_defined_in_productlist = 0; - $services_rdb_created = 0; - $servicesrdb_can_be_created = 0; $islinux = 0; $issolaris = 0; $ismacosx = 0; @@ -238,9 +237,6 @@ BEGIN $creating_windows_installer_patch = 0; $strip = 1; - $solarjava = 0; - $jdklib = ""; - $jrepath = ""; $globallogging = 0; $globalloggingform21 = 1; @@ -248,6 +244,7 @@ BEGIN @logfileinfo = (); @errorlogfileinfo = (); @globallogfileinfo = (); + $ignore_error_in_logfile = 0; $exitlog = ""; $globalinfo_copied = 0; $quiet = 0; @@ -378,6 +375,10 @@ BEGIN %spellcheckerlanguagehash = (); %spellcheckerfilehash = (); $registryrootcomponent = ""; + %allcomponents = (); + %allcomponents_in_this_database = (); + %allshortcomponents = (); + %alluniquedirectorynames = (); $installlocationdirectory = ""; $installlocationdirectoryset = 0; @@ -409,9 +410,6 @@ BEGIN %usedtreeconditions = (); %moduledestination = (); - $unomaxservices = 1800; # regcomp -c argument length - $javamaxservices = 15; - $one_cab_file = 0; $fix_number_of_cab_files = 1; $cab_file_per_component = 0; @@ -454,8 +452,6 @@ BEGIN @solarispatchfiles = (".diPatch", "patchinfo"); @environmentvariables = ( "SOLARVERSION", "GUI", "WORK_STAMP", "OUTPATH", "LOCAL_OUT", "LOCAL_COMMON_OUT" ); @packagelistitems = ("module", "solarispackagename", "packagename", "copyright", "vendor", "description" ); - @regcompjars = ( "unoil.jar", "java_uno.jar", "ridl.jar", "jurt.jar", "juh.jar", "xmerge.jar", "commonwizards.jar" ); - @regcompregisterlibs = ( "javavm.uno", "javaloader.uno", "stocservices.uno" ); @languagepackfeature =(); @helppackfeature =(); @featurecollector =(); @@ -503,7 +499,6 @@ BEGIN $separator = "/"; $pathseparator = "\:"; $libextension = "\.dll"; - $quote = "\'"; $isunix = 0; $iswin = 1; $archiveformat = ".zip"; @@ -528,7 +523,6 @@ BEGIN $libextension = "\.so"; } $archiveformat = ".tar.gz"; - $quote = "\'"; $isunix = 1; $iswin = 0; } diff --git a/solenv/bin/modules/installer/parameter.pm b/solenv/bin/modules/installer/parameter.pm index 2d58d585599e..f17965fa3d7f 100644 --- a/solenv/bin/modules/installer/parameter.pm +++ b/solenv/bin/modules/installer/parameter.pm @@ -386,19 +386,6 @@ sub setglobalvariables if ( ! $installer::globals::packageformat ) { $installer::globals::packageformat = "native"; } - # $installer::globals::servicesrdb_can_be_created can only be set, if regcomp (regcomp.exe) can be executed. - - if ( $installer::globals::iswin && $installer::globals::iswindowsbuild ) { $installer::globals::servicesrdb_can_be_created = 1; } - if ( $installer::globals::islinux && $installer::globals::islinuxbuild ) { $installer::globals::servicesrdb_can_be_created = 1; } - if ( $installer::globals::issolaris && $installer::globals::issolarisbuild ) { $installer::globals::servicesrdb_can_be_created = 1; } - - # ToDo: Needs to be expanded for additional compiler (setting $installer::globals::servicesrdb_can_be_created = 1 for all external platforms) - - if ((!($installer::globals::iswindowsbuild)) && (!($installer::globals::islinuxbuild)) && (!($installer::globals::issolarisbuild))) - { - $installer::globals::servicesrdb_can_be_created = 1; - } - # extension, if $installer::globals::pro is set if ($installer::globals::pro) { $installer::globals::productextension = ".pro"; } @@ -655,8 +642,6 @@ sub outputparameter if ( $installer::globals::debian ) { push(@output, "Linux: Creating Debian packages\n"); } if ( $installer::globals::dounzip ) { push(@output, "Unzip ARCHIVE files\n"); } else { push(@output, "Not unzipping ARCHIVE files\n"); } - if ( $installer::globals::servicesrdb_can_be_created ) { push(@output, "services.rdb can be created\n"); } - else { push(@output, "services.rdb cannot be created !\n"); } if (!($installer::globals::languages_defined_in_productlist)) { push(@output, "Languages:\n"); diff --git a/solenv/bin/modules/installer/regmerge.pm b/solenv/bin/modules/installer/regmerge.pm deleted file mode 100644 index 2f31a0bbc64c..000000000000 --- a/solenv/bin/modules/installer/regmerge.pm +++ /dev/null @@ -1,339 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -package installer::regmerge; - -use Cwd; -use installer::converter; -use installer::existence; -use installer::exiter; -use installer::globals; -use installer::logger; -use installer::pathanalyzer; -use installer::remover; -use installer::scriptitems; -use installer::systemactions; - -################################################################ -# Collecting all files with content: -# Regmergefile = "mydatabasepart.rdb"; -################################################################ - -sub collect_all_regmergefiles -{ - my ($filesarrayref) = @_; - - my @regmergefiles = (); - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - if ( $onefile->{'Regmergefile'} ) { push(@regmergefiles, $onefile); } - } - - return \@regmergefiles; -} - -################################################################ -# Collecting all gids of the databases, that are part of -# the file definition -################################################################ - -sub collect_all_database_gids -{ - my ($filesarrayref) = @_; - - my @databasegids = (); - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - - if ( $onefile->{'RegistryID'} ) - { - my $databasegid = $onefile->{'RegistryID'}; - if (! installer::existence::exists_in_array($databasegid, \@databasegids)) { push(@databasegids, $databasegid); } - } - else - { - installer::exiter::exit_program("ERROR: File defintion error. File :$onefile->{'gid'} without RegistryID!", "collect_all_database_gids"); - } - } - - return \@databasegids; -} - -################################################################ -# Returning the database file from the files collector. In the -# future this file does not need to exist, but currently it -# has to exist already in the files collector. -################################################################ - -sub get_database_file -{ - my ($databasegid, $filesarrayref) = @_; - - my $found = 0; - my $onefile; - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - $onefile = ${$filesarrayref}[$i]; - my $gid = $onefile->{'gid'}; - - if ( $databasegid eq $gid ) - { - $found = 1; - last; - } - } - - if ( ! $found ) { installer::exiter::exit_program("ERROR: Did not find StarRegistry file $databasegid!", "get_database_file"); } - - return $onefile; -} - -################################################################ -# The regmerge file has to be found the in include pathes -################################################################ - -sub get_regmerge_file -{ - my ($includepatharrayref) = @_; - - my $searchname; - - if ($installer::globals::isunix) { $searchname = "regcomplazy"; } - else { $searchname = "regcomplazy.exe"; } - - my $regmergefileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$searchname, $includepatharrayref, 1); - if ( $$regmergefileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $searchname for merging the StarRegistry!", "get_regmerge_file"); } - - return $$regmergefileref; -} - -################################################################ -# Collecting all files that are merged to one defined -# StarRegistry database -################################################################ - -sub collect_all_files_for_one_registry -{ - my ($regmergefiles, $databasegid) = @_; - - my @regmergefiles = (); - - for ( my $i = 0; $i <= $#{$regmergefiles}; $i++ ) - { - my $onefile = ${$regmergefiles}[$i]; - if ( $onefile->{'RegistryID'} eq $databasegid ) { push(@regmergefiles, $onefile); } - } - - return \@regmergefiles; -} - -################################################################ -# Collecting all particles from the regmerge files -################################################################ - -sub collect_all_regmerge_particles -{ - my ($databaseregisterfiles) = @_; - - my @regmergeparticles = (); - - for ( my $i = 0; $i <= $#{$databaseregisterfiles}; $i++ ) - { - my $onefile = ${$databaseregisterfiles}[$i]; - if ( $onefile->{'Regmergefile'} ) { push(@regmergeparticles, $onefile->{'Regmergefile'}); } - else { installer::exiter::exit_program("ERROR: Could not find entry for \"Regmergefile\" in $onefile->{'gid'}!", "collect_all_regmerge_particles"); } - } - - return \@regmergeparticles; -} - -################################################################ -# Collecting all source pathes of the regmerge particles -################################################################ - -sub get_all_source_pathes -{ - my ($regmergeparticles, $includepatharrayref) = @_; - - my @regmergeparticles = (); - - for ( my $i = 0; $i <= $#{$regmergeparticles}; $i++ ) - { - my $filename = ${$regmergeparticles}[$i]; - - my $fileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 1); - if ( $$fileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $filename for merging the StarRegistry!", "get_all_source_pathes"); } - - push(@regmergeparticles, $$fileref); - } - - return \@regmergeparticles; -} - -################################################################ -# Merging the rdb files into the StarRegistry database -################################################################ - -sub merge_files -{ - my ($regmergefile, $databasefile, $registerfiles, $databasedir, $allvariableshashref) = @_; - - my $databasesource = $databasefile->{'sourcepath'}; - my $databasename = $databasefile->{'Name'}; - my $databasedest = $databasedir . $installer::globals::separator . $databasename; - - installer::systemactions::copy_one_file($databasesource, $databasedest); - $databasefile->{'sourcepath'} = $databasedest; # new sourcepath for the StarRegistry file - - # One call for every merge particle. This is only possible, if there are only a few merge particles. - - my $prefix = $databasefile->{'NativeServicesURLPrefix'}; - # TODO: "NativeServicesURLPrefix" or "JavaServicesURLPrefix" - - my $error_occurred = 0; - - for ( my $i = 0; $i <= $#{$registerfiles}; $i++ ) - { - my $registerfile = $databasedir . $installer::globals::separator . $i . ".tmp"; - open (IN, '<', $registerfiles->[$i]) or $error_occurred = 1; - open (OUT, '>', $registerfile) or $error_occurred = 1; - while (<IN>) - { - s/^ComponentName=/ComponentName=$prefix/; - print OUT $_ or $error_occurred = 1; - } - close IN or $error_occurred = 1; - close OUT or $error_occurred = 1; - - my $systemcall = $regmergefile . " -v " . $databasedest . " " . $registerfile . " 2\>\&1 |"; - - my @regmergeoutput = (); - - my $var_library_path; - my $old_library_path; - if ($installer::globals::isunix) { - $var_library_path = $installer::globals::ismacosx ? - 'DYLD_LIBRARY_PATH' : 'LD_LIBRARY_PATH'; - $old_library_path = $ENV{$var_library_path}; - installer::servicesfile::include_libdir_into_ld_library_path( - $var_library_path, $regmergefile); - } - - open (REG, "$systemcall"); - while (<REG>) {push(@regmergeoutput, $_); } - close (REG); - - my $returnvalue = $?; # $? contains the return value of the systemcall - - if (defined $var_library_path) { - if (defined $old_library_path) { - $ENV{$var_library_path} = $old_library_path; - } else { - delete $ENV{$var_library_path}; - } - } - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $j = 0; $j <= $#regmergeoutput; $j++ ) { push( @installer::globals::logfileinfo, "$regmergeoutput[$j]"); } - - if ($returnvalue) - { - $infoline = "ERROR: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - $error_occurred = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - } - } - - return $error_occurred; -} - -################################################################ -# Expanding the registry database files by merging rdb files -# into this registry database files. -################################################################ - -sub merge_registration_files -{ - my ($filesarrayref, $includepatharrayref, $languagestringref, $allvariableshashref) = @_; - - installer::logger::include_header_into_logfile("Creating starregistry databases:"); - - # Test if there is something to do. At least one file has to have the content: - # Regmergefile = "mydatabasepart.rdb"; - - my $regmergefiles = collect_all_regmergefiles($filesarrayref); - - if ( $#{$regmergefiles} > -1 ) # not empty -> at least one regmerge file - { - # prepare registration - - my $regmergefile = get_regmerge_file($includepatharrayref); # searching for regmerge (regcomplazy.exe) - - my $databasegids = collect_all_database_gids($regmergefiles); - - # iterating over all database gids - - my $regmergeerror = 0; - - for ( my $i = 0; $i <= $#{$databasegids}; $i++ ) - { - $databasegid = ${$databasegids}[$i]; - - my $databasedirname = $databasegid . "_rdb"; # <- unique! - my $databasedir = installer::systemactions::create_directories($databasedirname, $languagestringref); - push(@installer::globals::removedirs, $databasedir); - - my $databasefile = get_database_file($databasegid, $filesarrayref); - my $databaseregisterfiles = collect_all_files_for_one_registry($regmergefiles, $databasegid); - - if ( $#{$databaseregisterfiles} > -1 ) # not empty -> at least one regmerge file - { - my $regmergeparticles = collect_all_regmerge_particles($databaseregisterfiles); - $regmergeparticles = get_all_source_pathes($regmergeparticles, $includepatharrayref); - my $oneregmergeerror = merge_files($regmergefile, $databasefile, $regmergeparticles, $databasedir, $allvariableshashref); - if ($oneregmergeerror) { $regmergeerror = 1; } - } - } - - if ( $regmergeerror ) { installer::exiter::exit_program("ERROR: regmerge !", "merge_registration_files"); } - - } -} - -1; diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm index c23cd9e1a817..555b64196cb3 100644 --- a/solenv/bin/modules/installer/scriptitems.pm +++ b/solenv/bin/modules/installer/scriptitems.pm @@ -1222,7 +1222,7 @@ sub get_Source_Directory_For_Files_From_Includepathlist my $styles = ""; my $file_can_miss = 0; if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } - if (( $styles =~ /\bSTARREGISTRY\b/ ) || ( $styles =~ /\bFILE_CAN_MISS\b/ )) { $file_can_miss = 1; } + if ( $styles =~ /\bFILE_CAN_MISS\b/ ) { $file_can_miss = 1; } if (( $installer::globals::languagepack ) && ( ! $onefile->{'ismultilingual'} ) && ( ! ( $styles =~ /\bFORCELANGUAGEPACK\b/ ))) { $file_can_miss = 1; } if (( $installer::globals::helppack ) && ( ! $onefile->{'ismultilingual'} ) && ( ! ( $styles =~ /\bFORCEHELPPACK\b/ ))) { $file_can_miss = 1; } @@ -1350,12 +1350,21 @@ sub remove_Files_Without_Sourcedirectory if ($sourcepath eq "") { my $styles = $onefile->{'Styles'}; + my $filename = $onefile->{'Name'}; - if ( ! ( $styles =~ /\bSTARREGISTRY\b/ )) # StarRegistry files will be created later + if ( ! $installer::globals::languagepack && !$installer::globals::helppack) { - my $filename = $onefile->{'Name'}; + $infoline = "ERROR: Removing file $filename from file list.\n"; + push( @installer::globals::logfileinfo, $infoline); + + push(@missingfiles, "ERROR: File not found: $filename\n"); + $error_occurred = 1; - if ( ! $installer::globals::languagepack && !$installer::globals::helppack) + next; # removing this file from list, if sourcepath is empty + } + elsif ( $installer::globals::languagepack ) # special case for language packs + { + if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ )) { $infoline = "ERROR: Removing file $filename from file list.\n"; push( @installer::globals::logfileinfo, $infoline); @@ -1365,51 +1374,38 @@ sub remove_Files_Without_Sourcedirectory next; # removing this file from list, if sourcepath is empty } - elsif ( $installer::globals::languagepack ) # special case for language packs + else { - if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCELANGUAGEPACK\b/ )) - { - $infoline = "ERROR: Removing file $filename from file list.\n"; - push( @installer::globals::logfileinfo, $infoline); - - push(@missingfiles, "ERROR: File not found: $filename\n"); - $error_occurred = 1; - - next; # removing this file from list, if sourcepath is empty - } - else - { - $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "INFO: It is not language dependent and can be ignored in language packs.\n"; - push( @installer::globals::logfileinfo, $infoline); + $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; + push( @installer::globals::logfileinfo, $infoline); + $infoline = "INFO: It is not language dependent and can be ignored in language packs.\n"; + push( @installer::globals::logfileinfo, $infoline); - next; # removing this file from list, if sourcepath is empty - } + next; # removing this file from list, if sourcepath is empty } - else # special case for help packs + } + else # special case for help packs + { + if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCEHELPPACK\b/ )) { - if (( $onefile->{'ismultilingual'} ) || ( $styles =~ /\bFORCEHELPPACK\b/ )) - { - $infoline = "ERROR: Removing file $filename from file list.\n"; - push( @installer::globals::logfileinfo, $infoline); + $infoline = "ERROR: Removing file $filename from file list.\n"; + push( @installer::globals::logfileinfo, $infoline); - push(@missingfiles, "ERROR: File not found: $filename\n"); - $error_occured = 1; + push(@missingfiles, "ERROR: File not found: $filename\n"); + $error_occured = 1; - next; # removing this file from list, if sourcepath is empty - } - else - { - $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "INFO: It is not language dependent and can be ignored in help packs.\n"; - push( @installer::globals::logfileinfo, $infoline); + next; # removing this file from list, if sourcepath is empty + } + else + { + $infoline = "INFO: Removing file $filename from file list. It is not language dependent.\n"; + push( @installer::globals::logfileinfo, $infoline); + $infoline = "INFO: It is not language dependent and can be ignored in help packs.\n"; + push( @installer::globals::logfileinfo, $infoline); - next; # removing this file from list, if sourcepath is empty - } + next; # removing this file from list, if sourcepath is empty } - } + } } push(@newfilesarray, $onefile); diff --git a/solenv/bin/modules/installer/servicesfile.pm b/solenv/bin/modules/installer/servicesfile.pm deleted file mode 100644 index 948287b206f8..000000000000 --- a/solenv/bin/modules/installer/servicesfile.pm +++ /dev/null @@ -1,1059 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -package installer::servicesfile; - -use Cwd; -use installer::converter; -use installer::existence; -use installer::exiter; -use installer::globals; -use installer::logger; -use installer::pathanalyzer; -use installer::remover; -use installer::scriptitems; -use installer::systemactions; - -################################################################ -# Adding the newly created file into the files collector -################################################################ - -sub add_services_sourcepath_into_filearray -{ - my ( $filesarrayref, $servicesfile, $servicesname ) = @_; - - my $found = 0; - my $onefile; - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - $onefile = ${$filesarrayref}[$i]; - my $name = $onefile->{'Name'}; - - if ( $servicesname eq $name ) - { - $found = 1; - $onefile->{'sourcepath'} = $servicesfile; # setting the sourcepath! - last; - } - } - - if ( ! $found ) { installer::exiter::exit_program("ERROR: Did not find $servicesname in files collector!", "add_services_sourcepath_into_filearray"); } - -} - -################################################################ -# Generating a file url from a path -################################################################ - -sub make_file_url -{ - my ( $path ) = @_; - - my $fileurl = ""; - - # removing ending slash/backslash - - installer::remover::remove_ending_pathseparator(\$path); - - if ($installer::globals::iswin) - { - $path =~ s/\\/\//g; - $fileurl = "file\:\/\/\/" . $path; - } - else - { - $fileurl = "file\:\/\/" . $path; - } - - return $fileurl; -} - -################################################################ -# Determining all sourcepath from the uno components -################################################################ - -sub get_all_sourcepathes -{ - my ( $filesref ) = @_; - - my @pathes = (); - - for ( my $i = 0; $i <= $#{$filesref}; $i++ ) - { - my $onefile = ${$filesref}[$i]; - my $path = $onefile->{'sourcepath'}; - - installer::pathanalyzer::get_path_from_fullqualifiedname(\$path); - - if (! installer::existence::exists_in_array($path, \@pathes)) - { - push(@pathes, $path); - } - } - - return \@pathes; -} - -################################################################ -# Registering all uno component files in the services.rdb -################################################################ - -sub register_unocomponents -{ - my ($allvariableshashref, $unocomponents, $regcompfileref, $servicesfile, $nativeservicesurlprefix) = @_; - - installer::logger::include_header_into_logfile("Registering UNO components:"); - - my $error_occurred = 0; - my $filestring = ""; - for ( my $i = 0; $i <= $#{$unocomponents}; ++$i ) - { - my $local_error1_occurred = 0; - my $local_error2_occurred = 0; - - my $sourcepath = make_file_url(${$unocomponents}[$i]->{'sourcepath'}); - my $urlprefix = ${$unocomponents}[$i]->{'NativeServicesURLPrefix'}; - if (defined($urlprefix)) - { - $local_error1_occurred = call_regcomp($regcompfileref, $servicesfile, $sourcepath, $urlprefix); - } - else - { - $filestring .= ";" unless $filestring eq ""; - $filestring .= $sourcepath; - } - if (length($filestring) > $installer::globals::unomaxservices || - ($i == $#{$unocomponents} && $filestring ne "")) - { - $local_error2_occurred = call_regcomp($regcompfileref, $servicesfile, $filestring, $nativeservicesurlprefix); - $filestring = ""; - } - - if (( $local_error1_occurred ) || ( $local_error2_occurred )) { $error_occurred = 1; } - } - - return $error_occurred; -} - -sub call_regcomp -{ - my ($regcompfileref, $servicesfile, $filestring, $urlprefix) = @_; - my @regcompoutput = (); - - my $error_occurred = 0; - - my $systemcall = "$$regcompfileref -register -r ".fix_cygwin_path($servicesfile)." -c " . $installer::globals::quote . $filestring . $installer::globals::quote . " -wop=" . $installer::globals::quote . $urlprefix . $installer::globals::quote . " 2\>\&1 |"; - - open (REG, "$systemcall"); - while (<REG>) {push(@regcompoutput, $_); } - close (REG); - - my $returnvalue = $?; # $? contains the return value of the systemcall - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $j = 0; $j <= $#regcompoutput; $j++ ) { push( @installer::globals::logfileinfo, "$regcompoutput[$j]"); } - - if ($returnvalue) - { - $infoline = "ERROR: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - $error_occurred = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - } - - return $error_occurred; -} - -################################################################ -# Registering all java component files in the services.rdb -################################################################ - -sub register_javacomponents -{ - my ($allvariableshashref, $javacomponents, $regcompfileref, $servicesfile, $regcomprdb, $javaservicesurlprefix) = @_; - - installer::logger::include_header_into_logfile("Registering Java components:"); - - my $ridljar_ref = "ridl.jar"; - my $ure_internal_java_dir_ref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$ridljar_ref, "", 1); - installer::pathanalyzer::get_path_from_fullqualifiedname($ure_internal_java_dir_ref); - if ( $$ure_internal_java_dir_ref eq "" ) { installer::exiter::exit_program("Could not determine URE_INTERNAL_JAVA_DIR when registering Java components!", "register_javacomponents"); } - - my $error_occurred = 0; - - my $do_register = 1; - if (!( $installer::globals::solarjava )) { $do_register = 0; } - - if ( $do_register ) - { - my $filestring = ""; - - for ( my $i = 0; $i <= $#{$javacomponents}; ) - { - my $sourcepath = ${$javacomponents}[$i++]->{'sourcepath'}; - - $filestring = $filestring . make_file_url($sourcepath); - - if ( $i % $installer::globals::javamaxservices == 0 || $i > $#{$javacomponents} ) # limiting to $installer::globals::maxservices files - { - my @regcompoutput = (); - - my $systemcall = "$$regcompfileref -register -br ".fix_cygwin_path($regcomprdb)." -r ".fix_cygwin_path($servicesfile)." -c " . $installer::globals::quote . $filestring . $installer::globals::quote . " -l com.sun.star.loader.Java2 -wop=" . $installer::globals::quote . $javaservicesurlprefix . $installer::globals::quote ." -env:URE_INTERNAL_JAVA_DIR=" . $installer::globals::quote . make_file_url($$ure_internal_java_dir_ref) . $installer::globals::quote . " 2\>\&1 |"; - - open (REG, "$systemcall"); - while (<REG>) {push(@regcompoutput, $_); } - close (REG); - - my $returnvalue = $?; # $? contains the return value of the systemcall - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $k = 0; $k <= $#regcompoutput; $k++ ) { push( @installer::globals::logfileinfo, "$regcompoutput[$k]"); } - - if ($returnvalue) - { - $infoline = "ERROR: $systemcall\n"; - $error_occurred = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - } - - push( @installer::globals::logfileinfo, $infoline); - - $filestring = ""; - } - else - { - $filestring = $filestring . ";"; - } - } - } - - return $error_occurred; -} - - - -################################################################ -# Helper routine to change cygwin (POSIX) path to DOS notation -# if needed -################################################################ -sub fix_cygwin_path -{ - my ( $path ) = @_; - - if ( $installer::globals::iswin eq 1 ) - { - $path = qx{cygpath -m "$path"}; - chomp($path); - } - - return $path; -} - - - -################################################################ -# Registering all uno component files in the services.rdb -################################################################ -sub get_source_path_cygwin_safe -{ - my ( $name, $array, $int ) = @_; - - my $ret = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$name, $array, $int); - if ( $installer::globals::iswin eq 1 ) - { - if( substr( $$ret, 1,1 ) eq ":" ) - { - chomp($$ret = qx{cygpath -u "$$ret"}); - } - } - return $ret; -} - -sub register_pythoncomponents -{ - my ($pythoncomponents, $regcompfileref, $servicesfile,$includepatharrayref) = @_; - - installer::logger::include_header_into_logfile("Registering python UNO components:"); - - my $error_occurred = 0; - my $counter = 0; - - my $systemcall = ""; - - my $allsourcepathes = get_all_sourcepathes($pythoncomponents); - - for ( my $j = 0; $j <= $#{$allsourcepathes}; $j++ ) - { - my $filestring = ""; - my $onesourcepath = ${$allsourcepathes}[$j]; - my $to = ""; - my $from = cwd(); - if ( $installer::globals::iswin ) { $from =~ s/\//\\/g; } - - my $typesrdbname = "types.rdb"; - - # FIXME: Remove the unneeded - # get_source_path_cygwin_safe() -> fix_cygwin_path() - # when WRAPCMD is gone - my $typesrdbref = get_source_path_cygwin_safe($typesrdbname, $includepatharrayref, 1); - - if ( $$typesrdbref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $typesrdbname !", "register_pythoncomponents"); } - - my $pyunoservicesrdbname = "pyuno_services.rdb"; - my $pyunoservicesrdbref = get_source_path_cygwin_safe($pyunoservicesrdbname, $includepatharrayref, 1); - - if ( $$pyunoservicesrdbref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $pyunoservicesrname !", "register_pythoncomponents"); } - - for ( my $i = 0; $i <= $#{$pythoncomponents}; $i++ ) - { - my $doinclude = 1; - my $sourcepath = ${$pythoncomponents}[$i]->{'sourcepath'}; - - $to = $sourcepath; - installer::pathanalyzer::get_path_from_fullqualifiedname(\$to); - - if (!($to eq $onesourcepath)) { $doinclude = 0; } - - if ( $doinclude ) - { - my $filename = ${$pythoncomponents}[$i]->{'Name'}; - $filestring = $filestring . $filename . "\;"; - $counter++; - } - - if ( $counter > 0 ) - { - $filestring =~ s/\;\s*$//; - $filestring = substr( $filestring, 0, length($filestring)-3); - chdir($onesourcepath); - - my @regcompoutput = (); - - $systemcall = "$$regcompfileref -register" - . " -br " . fix_cygwin_path($$typesrdbref) - . " -br " . fix_cygwin_path($$pyunoservicesrdbref) - . " -r " . fix_cygwin_path($servicesfile) - . " -c vnd.openoffice.pymodule:" . $filestring . " -l com.sun.star.loader.Python 2\>\&1 |"; - - open (REG, "$systemcall"); - while (<REG>) {push(@regcompoutput, $_); } - close (REG); - - my $returnvalue = $?; # $? contains the return value of the systemcall - - my $infoline = "Systemcall: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - - for ( my $j = 0; $j <= $#regcompoutput; $j++ ) { push( @installer::globals::logfileinfo, "$regcompoutput[$j]"); } - - if ($returnvalue) - { - $infoline = "ERROR: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - $error_occurred = 1; - } - else - { - $infoline = "SUCCESS: $systemcall\n"; - push( @installer::globals::logfileinfo, $infoline); - } - - chdir($from); - - $counter = 0; - $filestring = ""; - } - } - } - - return $error_occurred; -} - -################################################################ -# Iterating over all files, to find all files with the -# style UNO_COMPONENT. This can be libraries and jar files. -################################################################ - -sub register_all_components -{ - my ( $allvariableshashref, $servicesgid, $filesarrayref, $regcompfileref, $servicesfile, $regcomprdb, $includepatharrayref, $nativeservicesurlprefix, $javaservicesurlprefix ) = @_; - - my $registererrorflag = 0; - - my @unocomponents = (); - my @javacomponents = (); - my @pythoncomponents = (); - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - my $styles = ""; - my $regmergefile = ""; - my $registryid = ""; - - if ( $onefile->{'RegistryID'} ) { $registryid = $onefile->{'RegistryID'}; } - - if ( $servicesgid ne $registryid ) { next; } # only registration for the current $servicesgid - - if ( $onefile->{'Regmergefile'} ) { $regmergefile = $onefile->{'Regmergefile'}; } - - if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } - - if (( $styles =~ /\bUNO_COMPONENT\b/ ) && ( $regmergefile eq "" )) # regmergefiles will not be registered with regcomp - { - my $filename = $onefile->{'Name'}; - - if ( $filename =~ /\.jar\s*$/ ) # java component - { - push(@javacomponents, $onefile); - } - elsif( $filename =~ /\.py\s*$/ ) # python_component - { - push(@pythoncomponents, $onefile); - } - else # uno component - { - push(@unocomponents, $onefile); - } - } - } - - $uno_error_occurred = 0; - $java_error_occurred = 0; - $python_error_occurred = 0; - - if ( $#unocomponents > -1 ) { $uno_error_occurred = register_unocomponents($allvariableshashref, \@unocomponents, $regcompfileref, $servicesfile, $nativeservicesurlprefix); } - if ( $#javacomponents > -1 ) { $java_error_occurred = register_javacomponents($allvariableshashref, \@javacomponents, $regcompfileref, $servicesfile, $regcomprdb, $javaservicesurlprefix); } - if ( $#pythoncomponents > -1 ) { $python_error_occurred = register_pythoncomponents(\@pythoncomponents, $regcompfileref, $servicesfile, $includepatharrayref); } - - if ( $uno_error_occurred || $java_error_occurred || $python_error_occurred ) { $registererrorflag = 1; } - - return $registererrorflag; -} - -################################################### -# Include the solver lib directory into -# the LD_LIBRARY_PATH for Unix platforms -################################################### - -sub include_libdir_into_ld_library_path -{ - my ( $var, $binfile ) = @_; - - my $ld_library_path = $binfile; - installer::pathanalyzer::get_path_from_fullqualifiedname(\$ld_library_path); - $ld_library_path =~ s/\/\s*$//; # removing ending slashes - $ld_library_path =~ s/\/bin\./\/lib\./; - $ld_library_path =~ s/\/bin\s*$/\/lib/; # when packing from flat - - my $oldldlibrarypathstring = $ENV{$var}; - my $new_ld_library_path = $ld_library_path; - if ( defined $oldldlibrarypathstring ) { - $new_ld_library_path = $new_ld_library_path . $installer::globals::pathseparator . $oldldlibrarypathstring; - } - if ( $ENV{'SYSTEM_MOZILLA'} && $ENV{'SYSTEM_MOZILLA'} eq "YES" && - (!$ENV{'WITH_OPENLDAP'} || $ENV{'WITH_OPENLDAP'} ne "YES")) { - $new_ld_library_path = $new_ld_library_path . $installer::globals::pathseparator . $ENV{'MOZ_LIB'}; - } - $ENV{$var} = $new_ld_library_path; - - my $infoline = "Setting $var to $ENV{$var}\n"; - push( @installer::globals::logfileinfo, $infoline); -} - -################################################################## -# Setting the needed jar files into the CLASSPATH -# They are needed from regcomp. -# The jar files are defined in @installer::globals::regcompjars -################################################################## - -sub prepare_classpath_for_java_registration -{ - my ( $includepatharrayref ) = @_; - my $local_pathseparator = $installer::globals::pathseparator; - - if( $^O =~ /cygwin/i ) - { # $CLASSPATH must use DOS separator even when using cygwin's perl - $local_pathseparator = ';'; - } - - for ( my $i = 0; $i <= $#installer::globals::regcompjars; $i++ ) - { - my $filename = $installer::globals::regcompjars[$i]; - - my $jarfileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 1); - - if ( $$jarfileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $filename for registering java components!", "prepare_classpath_for_java_registration"); } - - my $oldclasspathstring = ""; - if ( $ENV{'CLASSPATH'} ) { $oldclasspathstring = $ENV{'CLASSPATH'}; } - else { $oldclasspathstring = "\."; } - my $classpathstring = $$jarfileref . $local_pathseparator . $oldclasspathstring; - if ( $^O =~ /cygwin/i ) { - $classpathstring =~ s/\//\\/g; # guw.pl likes '\' in $PATH. - } - $ENV{'CLASSPATH'} = $classpathstring; - - my $infoline = "Setting CLASSPATH to $ENV{'CLASSPATH'}\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -################################################################## -# Setting the jdk lib into the LD_LIBRARY_PATH (Unix) -# This is used by regcomp to register Java components. -# The jdk lib is defined in $installer::globals::jdklib -################################################################## - -sub add_jdklib_into_ld_library_path -{ - my ($var) = @_; - if (defined $installer::globals::jdklib) { - my $oldldlibrarypathstring = $ENV{$var}; - my $new_ld_library_path = $installer::globals::jdklib; - if (defined $oldldlibrarypathstring) { - $new_ld_library_path .= - $installer::globals::pathseparator . $oldldlibrarypathstring; - } - $ENV{$var} = $new_ld_library_path; - my $infoline = "Setting $var to $ENV{$var}\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -################################################################## -# Adding the libraries included in zip files into path variable -# (for example mozruntime.zip). This is needed to register all -# libraries successfully. -################################################################## - -sub add_path_to_pathvariable_directory -{ - my ( $filesarrayref, $searchstring ) = @_; - - # determining the path - - my $path = ""; - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - my $sourcepath = $onefile->{'sourcepath'}; - - installer::pathanalyzer::get_path_from_fullqualifiedname(\$sourcepath); - installer::remover::remove_ending_pathseparator(\$sourcepath); - - if ( $sourcepath =~ /\Q$searchstring\E\s*$/ ) - { - $path = $sourcepath; - last; - } - } - - # adding the path to the PATH variable - - if ( $path ne "" ) - { - my $oldpath = ""; - if ( $ENV{'PATH'} ) { $oldpath = $ENV{'PATH'}; } - else { $oldpath = "\."; } - if ( $^O =~ /cygwin/i ) { - $path = qx(cygpath -u "$path"); - chomp $path; - } - my $newpath = $path . $installer::globals::pathseparator . $oldpath; - $ENV{'PATH'} = $newpath; - - my $infoline = "Setting PATH to $ENV{'PATH'}\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -################################################################## -# Adding the path of a specified library to the path variable -# (for example msvcr70.dll). This is needed to register all -# libraries successfully. -################################################################## - -sub add_path_to_pathvariable -{ - my ( $filesarrayref, $searchstring ) = @_; - - # determining the path - - my $path = ""; - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - my $sourcepath = $onefile->{'sourcepath'}; - - if ( $sourcepath =~ /\Q$searchstring\E\s*$/ ) - { - installer::pathanalyzer::get_path_from_fullqualifiedname(\$sourcepath); - installer::remover::remove_ending_pathseparator(\$sourcepath); - $path = $sourcepath; - last; - } - } - - # adding the path to the PATH variable - - if ( $path ne "" ) - { - my $oldpath = ""; - if ( $ENV{'PATH'} ) { $oldpath = $ENV{'PATH'}; } - else { $oldpath = "\."; } - if ( $^O =~ /cygwin/i ) { - $path = qx(cygpath -u "$path"); - chomp $path; - } - my $newpath = $path . $installer::globals::pathseparator . $oldpath; - $ENV{'PATH'} = $newpath; - - my $infoline = "Setting PATH to $ENV{'PATH'}\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -################################################################## -# Setting the jre path into the PATH (Windows only) -# This is used by regcomp.exe to register Java components. -# The jre path is saved in $installer::globals::jrepath -################################################################## - -sub add_jrepath_into_path -{ - my $oldpath = ""; - if ( $ENV{'PATH'} ) { $oldpath = $ENV{'PATH'}; } - else { $oldpath = "\."; } - - if ( $installer::globals::jrepath ne "" ) - { - my $newpath = $installer::globals::jrepath . $installer::globals::pathseparator . $oldpath; - $ENV{'PATH'} = $newpath; - - my $infoline = "Setting PATH to $ENV{'PATH'}\n"; - push( @installer::globals::logfileinfo, $infoline); - } -} - -####################################################################################### -# Preparing a registry "regcomp.rdb" which regcomp can work on (types+java services). -# Copying the "udkapi.rdb", renaming it to "regcomp.rdb" and registering the -# libraries @installer::globals::regcompregisterlibs, which are javavm.uno.so -# and javaloader.uno.so or javavm.uno.dll and javaloader.uno.dll -####################################################################################### - -sub prepare_regcomp_rdb -{ - my ( $regcompfile, $servicesdir, $includepatharrayref) = @_; - - # udkapi.rdb has to be found in the sourcepath - - my $filename = "udkapi.rdb"; - my $udkapirdbref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 1); - if ( $$udkapirdbref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $filename for creating regcomp.rdb!", "prepare_regcomp_rdb"); } - - my $regcompfilename = "regcomp.rdb"; - my $regcomprdb = $servicesdir . $installer::globals::separator . $regcompfilename; - - # If there is an older version of this file, it has to be removed - if ( -f $regcomprdb ) { unlink($regcomprdb); } - - installer::systemactions::copy_one_file($$udkapirdbref, $regcomprdb); - - # now the libraries in @installer::globals::regcompregisterlibs can be registered in the "regcomp.rdb" - - for ( my $i = 0; $i <= $#installer::globals::regcompregisterlibs; $i++ ) - { - my $libfilename = $installer::globals::regcompregisterlibs[$i] . $installer::globals::libextension; - my $libfileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$libfilename, $includepatharrayref, 1); - if ( $$libfileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $libfilename for creating regcomp.rdb!", "prepare_regcomp_rdb"); } - - my $from = cwd(); - if ( $installer::globals::iswin ) { $from =~ s/\//\\/g; } - - my $to = $$libfileref; - installer::pathanalyzer::get_path_from_fullqualifiedname(\$to); - - chdir($to); - - my $systemcall = "$regcompfile -register -s -r " . fix_cygwin_path($regcomprdb) . " -c $libfilename"; - - my $returnvalue = system($systemcall); - - chdir($from); - - my $infoline; - if ($returnvalue) { $infoline = "ERROR: $systemcall\n"; } - else { $infoline = "SUCCESS: $systemcall\n"; } - - push( @installer::globals::logfileinfo, $infoline); - } - - return $regcomprdb; -} - -################################################################ -# Collecting all gids of the databases, that are part of -# the file definition -################################################################ - -sub collect_all_services_gids -{ - my ($filesarrayref) = @_; - - my @databasegids = (); - my $error_occurred = 0; - my @error_files = (); - - for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) - { - my $onefile = ${$filesarrayref}[$i]; - - if ( $onefile->{'RegistryID'} ) - { - my $databasegid = $onefile->{'RegistryID'}; - if (! installer::existence::exists_in_array($databasegid, \@databasegids)) { push(@databasegids, $databasegid); } - } - else - { - push(@error_files, $onefile->{'gid'}); - $error_occurred = 1; - } - } - - if ( $error_occurred ) - { - my $infoline = "ERROR: Style UNO_COMPONENT is set, but no RegistryID is assigned!\n"; - push( @installer::globals::logfileinfo, $infoline); - print $infoline; - - for ( my $j = 0; $j <= $#error_files; $j++ ) - { - $infoline = "$error_files[$j]\n"; - push( @installer::globals::logfileinfo, $infoline); - print $infoline; - } - - installer::exiter::exit_program("ERROR: File defintion error.", "collect_all_services_gids"); - } - - return \@databasegids; -} - -###################################################################### -# All gids in $databasegids are as RegistryID assigned to files. -# For all this Registry Files a definition has to exist. -###################################################################### - -sub check_defintion_of_databasegids -{ - my ($databasegids, $registryfiles) = @_; - - my @registryfiles = (); - - # First check: For all assigned Registry files, a definition of - # a file with flag STARREGISTRY has to exist. - - for ( my $i = 0; $i <= $#{$databasegids}; $i++ ) - { - my $onegid = ${$databasegids}[$i]; - my $gid_defined = 0; - - for ( my $j = 0; $j <= $#{$registryfiles}; $j++ ) - { - my $registrygid = ${$registryfiles}[$j]->{'gid'}; - - if ( $onegid eq $registrygid ) - { - $gid_defined = 1; - last; - } - } - - if ( ! $gid_defined ) - { - installer::exiter::exit_program("ERROR: Gid $onegid is assigned to file(s), but not defined!", "check_defintion_of_databasegids"); - } - } - - # Second check: If there is a file defined as StarRegistry, is a file with flag UNO_COMPONENT assigned? - - for ( my $j = 0; $j <= $#{$registryfiles}; $j++ ) - { - my $onefile = ${$registryfiles}[$j]; - my $registrygid = $onefile->{'gid'}; - - my $gid_assigned = 0; - - for ( my $i = 0; $i <= $#{$databasegids}; $i++ ) - { - my $onegid = ${$databasegids}[$i]; - - if ( $onegid eq $registrygid ) - { - $gid_assigned = 1; - last; - } - } - - if ( ! $gid_assigned ) - { - my $infoline = "Warning: $registrygid is defined with flag STARREGISTRY, but no file is assigned to the registry.\n"; - push( @installer::globals::logfileinfo, $infoline); - } - else - { - push(@registryfiles, $onefile); - } - } - - return \@registryfiles; -} - -################################################################ -# Some files have flag UNO_COMPONENT, but are not registered -# with regcomp. This files use the regmerge mechanism, that -# is not used in this perl-file. Therefore this files -# have to be filtered out here. -################################################################ - -sub filter_regmergefiles -{ - my ($unocomponentfiles) = @_; - - my @regcompfiles = (); - - for ( my $i = 0; $i <= $#{$unocomponentfiles}; $i++ ) - { - my $onefile = ${$unocomponentfiles}[$i]; - my $regmergefile = ""; - - if ( $onefile->{'Regmergefile'} ) { $regmergefile = $onefile->{'Regmergefile'}; } - if ( $regmergefile ne "" ) { next; } - - push(@regcompfiles, $onefile); - } - - return \@regcompfiles; -} - -################################################################ -# Setting defaults for Creating services.rdb file by registering all uno components -################################################################ - -sub set_url_prefixes -{ - my ( $registryfile ) = @_; - - my $nativeservicesurlprefix = ""; - my $javaservicesurlprefix = ""; - - if ( $registryfile->{'NativeServicesURLPrefix'} ) { $nativeservicesurlprefix = $registryfile->{'NativeServicesURLPrefix'}; } - else { $nativeservicesurlprefix = "vnd.sun.star.expand:\$ORIGIN/"; } - - if ( $registryfile->{'JavaServicesURLPrefix'} ) { $javaservicesurlprefix = $registryfile->{'JavaServicesURLPrefix'}; } - else { $javaservicesurlprefix = "vnd.sun.star.expand:\$UNO_JAVA_COMPONENT_PATH/"; } - - return ($nativeservicesurlprefix, $javaservicesurlprefix); -} - -################################################################ -# Creating services.rdb file by registering all uno components -################################################################ - -sub create_services_rdb -{ - my ($allvariableshashref, $filesarrayref, $includepatharrayref, $languagestringref) = @_; - - # collecting all services files - my $unocomponentfiles = installer::worker::collect_all_items_with_special_flag($filesarrayref, "UNO_COMPONENT"); - $unocomponentfiles = filter_regmergefiles($unocomponentfiles); - - if ( $#{$unocomponentfiles} > -1 ) # not empty -> at least one file with flag UNO_COMPONENT - { - my $databasegids = collect_all_services_gids($unocomponentfiles); - - my $registryfiles = installer::worker::collect_all_items_with_special_flag($filesarrayref, "STARREGISTRY"); - - $registryfiles = check_defintion_of_databasegids($databasegids, $registryfiles); - - # Now the creation of all files with flag STARREGISTRY can begin - - for ( my $i = 0; $i <= $#{$registryfiles}; $i++ ) - { - my $registryfile = ${$registryfiles}[$i]; - - my $servicesname = $registryfile->{'Name'}; # not unique! - my $servicesgid = $registryfile->{'gid'}; # unique - my $uniquedirname = $servicesgid . "_servicesrdb"; - - my ($nativeservicesurlprefix, $javaservicesurlprefix) = set_url_prefixes($registryfile); - - installer::logger::include_header_into_logfile("Creating $servicesname ($servicesgid):"); - - my $servicesdir = installer::systemactions::create_directories($uniquedirname, $languagestringref); - - push(@installer::globals::removedirs, $servicesdir); - - my $servicesfile = $servicesdir . $installer::globals::separator . $servicesname; - - # If there is an older version of this file, it has to be removed - if ( -f $servicesfile ) { unlink($servicesfile); } - - if ( $installer::globals::servicesrdb_can_be_created ) # This has to be done always - { - # Creating the services.rdb in directory "inprogress" - my $origservicesdir = $servicesdir; - $servicesdir = installer::systemactions::make_numbered_dir("inprogress", $servicesdir); - $servicesfile = $servicesdir . $installer::globals::separator . $servicesname; - - # determining the location of the file regcomp - # Because the program regcomp.exe (regcomp) is used now, it has to be taken the version - # from the platform, this script is running. It is not important, for which platform the - # product is built. - - my $searchname; - - if ($installer::globals::isunix) { $searchname = "regcomp"; } - else { $searchname = "regcomp.exe"; } - - $regcompfileref = get_source_path_cygwin_safe($searchname, $includepatharrayref, 1); - if ( $$regcompfileref eq "" ) { installer::exiter::exit_program("ERROR: Could not find file $searchname for registering uno components!", "create_services_rdb"); } - - # For Windows the libraries included into the mozruntime.zip have to be added to the path - if ($installer::globals::iswin) { add_path_to_pathvariable_directory($filesarrayref, "mozruntime_zip"); } - if ($installer::globals::iswin) { add_path_to_pathvariable($filesarrayref, "msvcr70.dll"); } - - # setting the LD_LIBRARY_PATH, needed by regcomp - # Linux: Take care of the lock daemon. He has to be started! - # For windows it is necessary that "msvcp7x.dll" and "msvcr7x.dll" are included into the path ! - - my $var_library_path; - my $old_library_path; - if ( $installer::globals::isunix ) { - $var_library_path = $installer::globals::ismacosx ? - 'DYLD_LIBRARY_PATH' : 'LD_LIBRARY_PATH'; - $old_library_path = $ENV{$var_library_path}; - include_libdir_into_ld_library_path( - $var_library_path, $$regcompfileref); - } - - my $regcomprdb = ""; - - if ( $installer::globals::solarjava ) # this is needed to register Java components - { - prepare_classpath_for_java_registration($includepatharrayref); - - if ( $installer::globals::isunix ) - { add_jdklib_into_ld_library_path($var_library_path); } - else { add_jrepath_into_path(); } - - # Preparing a registry which regcomp can work on (types+java services). - # Copying the "udkapi.rdb", renaming it to "regcomp.rdb" and registering the - # libraries $(REGISTERLIBS_JAVA), which are javavm.uno.so and javaloader.uno.so - # or javavm.uno.dll and javaloader.uno.dll - - $regcomprdb = prepare_regcomp_rdb($$regcompfileref, $servicesdir, $includepatharrayref); - } - - # and now iteration over all files - - my $error_during_registration = register_all_components($allvariableshashref, $servicesgid, $unocomponentfiles, $regcompfileref, $servicesfile, $regcomprdb, $includepatharrayref, $nativeservicesurlprefix, $javaservicesurlprefix); - - if (defined $var_library_path) { - if (defined $old_library_path) { - $ENV{$var_library_path} = $old_library_path; - } else { - delete $ENV{$var_library_path}; - } - } - - # Dependent from the success, the registration directory can be renamed. - - if ( $error_during_registration ) - { - $servicesdir = installer::systemactions::rename_string_in_directory($servicesdir, "inprogress", "witherror"); - push(@installer::globals::removedirs, $servicesdir); - # and exiting the packaging process - installer::exiter::exit_program("ERROR: Could not register all components for file $servicesname ($servicesgid)!", "create_services_rdb"); - } - else - { - $servicesdir = installer::systemactions::rename_directory($servicesdir, $origservicesdir); - } - - $servicesfile = $servicesdir . $installer::globals::separator . $servicesname; - } - else - { - my $infoline; - - if (!($installer::globals::servicesrdb_can_be_created)) - { - $infoline = "Warning: $servicesname was not created. Build platform and compiler do not match. Build platform: $installer::globals::plat, compiler : $installer::globals::compiler\n"; - push( @installer::globals::logfileinfo, $infoline); - } - - if ( $installer::globals::services_rdb_created ) - { - $infoline = "Info: $servicesname was not created. $servicesfile already exists.\n"; - push( @installer::globals::logfileinfo, $infoline); - } - - if ((!($installer::globals::servicesrdb_can_be_created)) && (!($installer::globals::services_rdb_created))) - { - $infoline = "ERROR: $servicesname was not created and does not exist!\n"; - push( @installer::globals::logfileinfo, $infoline); - } - } - - # Adding the new services file source path to the filearray - $registryfile->{'sourcepath'} = $servicesfile; # setting the sourcepath! - } - } - - # Setting the global variable $installer::globals::services_rdb_created - - $installer::globals::services_rdb_created = 1; -} - -1; diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm index 54959f95b66d..ea3897f10395 100644 --- a/solenv/bin/modules/installer/simplepackage.pm +++ b/solenv/bin/modules/installer/simplepackage.pm @@ -348,9 +348,10 @@ sub replace_one_variable_in_shellscript sub replace_variables_in_scriptfile { - my ($scriptfile, $volume_name, $allvariables) = @_; + my ($scriptfile, $volume_name, $volume_name_app, $allvariables) = @_; replace_one_variable_in_shellscript($scriptfile, $volume_name, "FULLPRODUCTNAME" ); + replace_one_variable_in_shellscript($scriptfile, $volume_name_app, "FULLAPPPRODUCTNAME" ); replace_one_variable_in_shellscript($scriptfile, $allvariables->{'PRODUCTNAME'}, "PRODUCTNAME" ); replace_one_variable_in_shellscript($scriptfile, $allvariables->{'PRODUCTVERSION'}, "PRODUCTVERSION" ); @@ -409,10 +410,17 @@ sub create_package $folder = $packagename; } - my $volume_name = $allvariables->{'PRODUCTNAME'} . ' ' . $allvariables->{'PRODUCTVERSION'}; - $volume_name = $volume_name . ' ' . $allvariables->{'PRODUCTEXTENSION'} if $allvariables->{'PRODUCTEXTENSION'}; + # my $volume_name = $allvariables->{'PRODUCTNAME'} . ' ' . $allvariables->{'PRODUCTVERSION'}; # Adding PRODUCTVERSION makes this difficult to maintain! + my $volume_name = $allvariables->{'PRODUCTNAME'}; + my $volume_name_classic = $allvariables->{'PRODUCTNAME'} . ' ' . $allvariables->{'PRODUCTVERSION'}; + my $volume_name_classic_app = $volume_name; # "app" should not contain version number + # $volume_name = $volume_name . ' ' . $allvariables->{'PRODUCTEXTENSION'} if $allvariables->{'PRODUCTEXTENSION'}; # Adding PRODUCTEXTENSION makes this difficult to maintain! + $volume_name_classic = $volume_name_classic . ' ' . $allvariables->{'PRODUCTEXTENSION'} if $allvariables->{'PRODUCTEXTENSION'}; + $volume_name_classic_app = $volume_name_classic_app . ' ' . $allvariables->{'PRODUCTEXTENSION'} if $allvariables->{'PRODUCTEXTENSION'}; if ( $allvariables->{'DMG_VOLUMEEXTENSION'} ) { $volume_name = $volume_name . ' ' . $allvariables->{'DMG_VOLUMEEXTENSION'}; + $volume_name_classic = $volume_name_classic . ' ' . $allvariables->{'DMG_VOLUMEEXTENSION'}; + $volume_name_classic_app = $volume_name_classic_app . ' ' . $allvariables->{'DMG_VOLUMEEXTENSION'}; } my $sla = 'sla.r'; @@ -428,12 +436,23 @@ sub create_package if (( $installer::globals::languagepack ) || ( $installer::globals::helppack ) || ( $installer::globals::patch )) { $localtempdir = "$tempdir/$packagename"; - if ( $installer::globals::languagepack ) { $volume_name = "$volume_name Language Pack"; } if ( $installer::globals::helppack ) { $volume_name = "$volume_name Help Pack"; } - if ( $installer::globals::patch ) { $volume_name = "$volume_name Patch"; } + if ( $installer::globals::languagepack ) + { + $volume_name = "$volume_name Language Pack"; + $volume_name_classic = "$volume_name_classic Language Pack"; + $volume_name_classic_app = "$volume_name_classic_app Language Pack"; + } + if ( $installer::globals::patch ) + { + $volume_name = "$volume_name Patch"; + $volume_name_classic = "$volume_name_classic Patch"; + $volume_name_classic_app = "$volume_name_classic_app Patch"; + } # Create tar ball named tarball.tar.bz2 - my $appfolder = $localtempdir . "/" . $volume_name . "\.app"; + # my $appfolder = $localtempdir . "/" . $volume_name . "\.app"; + my $appfolder = $localtempdir . "/" . $volume_name_classic_app . "\.app"; my $contentsfolder = $appfolder . "/Contents"; my $tarballname = "tarball.tar.bz2"; @@ -477,7 +496,8 @@ sub create_package if ( $installer::globals::helppack ) { $scriptfilename = "osx_install_helppack.applescript"; } if ( $installer::globals::patch ) { $scriptfilename = "osx_install_patch.applescript"; } my $scripthelpersolverfilename = "mac_install.script"; - my $scripthelperrealfilename = $volume_name; + # my $scripthelperrealfilename = $volume_name; + my $scripthelperrealfilename = $volume_name_classic_app; my $translationfilename = $installer::globals::macinstallfilename; # Finding both files in solver @@ -500,7 +520,8 @@ sub create_package my $scriptfilecontent = installer::files::read_file($scriptfilename); my $translationfilecontent = installer::files::read_file($$translationfileref); localize_scriptfile($scriptfilecontent, $translationfilecontent, $languagestringref); - replace_variables_in_scriptfile($scriptfilecontent, $volume_name, $allvariables); + # replace_variables_in_scriptfile($scriptfilecontent, $volume_name, $allvariables); + replace_variables_in_scriptfile($scriptfilecontent, $volume_name_classic, $volume_name_classic_app, $allvariables); installer::files::save_file($scriptfilename, $scriptfilecontent); chmod 0775, $scriptfilename; @@ -525,7 +546,8 @@ sub create_package # Replacing variables in Info.plist $scriptfilecontent = installer::files::read_file($destfile); - replace_one_variable_in_shellscript($scriptfilecontent, $volume_name, "FULLPRODUCTNAME" ); + # replace_one_variable_in_shellscript($scriptfilecontent, $volume_name, "FULLPRODUCTNAME" ); + replace_one_variable_in_shellscript($scriptfilecontent, $volume_name_classic_app, "FULLAPPPRODUCTNAME" ); # OpenOffice.org Language Pack installer::files::save_file($destfile, $scriptfilecontent); chdir $localfrom; diff --git a/solenv/bin/modules/installer/substfilenamefiles.pm b/solenv/bin/modules/installer/substfilenamefiles.pm index 2a2b22eab53c..98906913c159 100644 --- a/solenv/bin/modules/installer/substfilenamefiles.pm +++ b/solenv/bin/modules/installer/substfilenamefiles.pm @@ -34,8 +34,7 @@ use installer::pathanalyzer; use installer::systemactions; ######################################################### -# Analyzing files with flag SCPZIP_REPLACE -# $item can be "File" or "ScpAction" +# Analyzing files with flag SUBST_FILENAME ######################################################### sub resolving_subst_filename_flag diff --git a/solenv/bin/modules/installer/windows/component.pm b/solenv/bin/modules/installer/windows/component.pm index 498a86c2d319..da11997e5f83 100644 --- a/solenv/bin/modules/installer/windows/component.pm +++ b/solenv/bin/modules/installer/windows/component.pm @@ -198,7 +198,7 @@ sub get_registry_component_directory sub get_file_component_attributes { - my ($componentname, $filesref) = @_; + my ($componentname, $filesref, $allvariables) = @_; my $attributes; @@ -245,6 +245,9 @@ sub get_file_component_attributes $attributes = 4; # Files in shellnew dir and in non advertised startmenu entries must have user registry key as KeyPath } + # Adding 256, if this is a 64 bit installation set. + if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $attributes = $attributes + 256; } + return $attributes } @@ -256,12 +259,15 @@ sub get_file_component_attributes sub get_registry_component_attributes { - my ($componentname) = @_; + my ($componentname, $allvariables) = @_; my $attributes; $attributes = 4; + # Adding 256, if this is a 64 bit installation set. + if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $attributes = $attributes + 256; } + if ( exists($installer::globals::dontdeletecomponents{$componentname}) ) { $attributes = $attributes + 16; } return $attributes @@ -386,7 +392,7 @@ sub get_component_keypath sub create_component_table { - my ($filesref, $registryref, $dirref, $allfilecomponentsref, $allregistrycomponents, $basedir, $componentidhashref, $componentidkeypathhashref) = @_; + my ($filesref, $registryref, $dirref, $allfilecomponentsref, $allregistrycomponents, $basedir, $componentidhashref, $componentidkeypathhashref, $allvariables) = @_; my @componenttable = (); @@ -404,7 +410,7 @@ sub create_component_table $onecomponent{'guid'} = get_component_guid($onecomponent{'name'}, $componentidhashref); $onecomponent{'directory'} = get_file_component_directory($onecomponent{'name'}, $filesref, $dirref); if ( $onecomponent{'directory'} eq "IGNORE_COMP" ) { next; } - $onecomponent{'attributes'} = get_file_component_attributes($onecomponent{'name'}, $filesref); + $onecomponent{'attributes'} = get_file_component_attributes($onecomponent{'name'}, $filesref, $allvariables); $onecomponent{'condition'} = get_file_component_condition($onecomponent{'name'}, $filesref); $onecomponent{'keypath'} = get_component_keypath($onecomponent{'name'}, $filesref, $componentidkeypathhashref); @@ -423,7 +429,7 @@ sub create_component_table $onecomponent{'name'} = ${$allregistrycomponents}[$i]; $onecomponent{'guid'} = get_component_guid($onecomponent{'name'}, $componentidhashref); $onecomponent{'directory'} = get_registry_component_directory(); - $onecomponent{'attributes'} = get_registry_component_attributes($onecomponent{'name'}); + $onecomponent{'attributes'} = get_registry_component_attributes($onecomponent{'name'}, $allvariables); $onecomponent{'condition'} = get_component_condition($onecomponent{'name'}); $onecomponent{'keypath'} = get_component_keypath($onecomponent{'name'}, $registryref, $componentidkeypathhashref); diff --git a/solenv/bin/modules/installer/windows/directory.pm b/solenv/bin/modules/installer/windows/directory.pm index 98134c8ef5b6..9ab583b5ed29 100644 --- a/solenv/bin/modules/installer/windows/directory.pm +++ b/solenv/bin/modules/installer/windows/directory.pm @@ -77,19 +77,78 @@ sub overwrite_programfilesfolder } ############################################################## +# Maximum length of directory name is 72. +# Taking care of underlines, which are the separator. +############################################################## + +sub make_short_dir_version +{ + my ($longstring, $length, $displayname) = @_; + + my $shortstring = ""; + my $infoline = ""; + my $savestring = $longstring; + + # Splitting the string at each "underline" and allowing only $length characters per directory name. + # Checking also uniqueness and length. + + my $stringarray = installer::converter::convert_stringlist_into_array_without_newline(\$longstring, "_"); + + foreach my $onestring ( @{$stringarray} ) + { + my $partstring = ""; + + if ( $onestring =~ /\-/ ) + { + my $localstringarray = installer::converter::convert_stringlist_into_array_without_newline(\$onestring, "-"); + foreach my $onelocalstring ( @{$localstringarray} ) + { + if ( length($onelocalstring) > $length ) { $onelocalstring = substr($onelocalstring, 0, $length); } + $partstring = $partstring . "-" . $onelocalstring; + } + $partstring =~ s/^\s*\-//; + } + else + { + if ( length($onestring) > $length ) { $partstring = substr($onestring, 0, $length); } + else { $partstring = $onestring; } + } + + $shortstring = $shortstring . "_" . $partstring; + } + + $shortstring =~ s/^\s*\_//; + + if ( length($shortstring) > 72 ) + { + my $shortlength = length($shortstring); + $infoline = "WARNING: Failed to create unique directory name with less than 72 characters: \"$displayname\" ($shortstring ($shortlength)).\n"; + push(@installer::globals::logfileinfo, $infoline); + } + + return $shortstring; +} + +############################################################## # Adding unique directory names to the directory collection ############################################################## sub create_unique_directorynames { - my ($directoryref) = @_; + my ($directoryref, $allvariables) = @_; $installer::globals::officeinstalldirectoryset = 0; + my %conversionhash = (); + my $infoline = ""; + my $errorcount = 0; + for ( my $i = 0; $i <= $#{$directoryref}; $i++ ) { my $onedir = ${$directoryref}[$i]; - my $uniquename = $onedir->{'HostName'}; + my $hostname = $onedir->{'HostName'}; + + my $uniquename = $hostname; my $styles = ""; if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; } # get_path_from_fullqualifiedname(\$uniqueparentname); @@ -101,6 +160,42 @@ sub create_unique_directorynames $uniquename =~ s/\_//g; # removing existing underlines $uniquename =~ s/\.//g; # removing dots in directoryname $uniquename =~ s/\Q$installer::globals::separator\E/\_/g; # replacing slash and backslash with underline + $uniquename =~ s/OpenOffice/OO/g; + $uniquename =~ s/_registry/_rgy/g; + $uniquename =~ s/_registration/_rgn/g; + $uniquename =~ s/_extension/_ext/g; + $uniquename =~ s/_frame/_frm/g; + $uniquename =~ s/_table/_tbl/g; + $uniquename =~ s/_chart/_crt/g; + + my $startlength = 5; + + if ( ! $allvariables->{'NOSHORTDIRECTORYNAMES'} ) + { + # This process does not work for SDK, because of its long and similar pathes + $uniquename = make_short_dir_version($uniquename, $startlength, $hostname); # taking care of underlines! + } + + if ( exists($installer::globals::alluniquedirectorynames{$uniquename}) ) + { + # This is an error, that must stop the packaging process + $errorcount++; + + $infoline = "$errorcount: Already existing unique directory: $uniquename\n"; + push( @installer::globals::logfileinfo, $infoline); + $infoline = "$errorcount: First full directory: $conversionhash{$uniquename}\n"; + push( @installer::globals::logfileinfo, $infoline); + $infoline = "$errorcount: Current full directory: $hostname\n"; + push( @installer::globals::logfileinfo, $infoline); + } + + $conversionhash{$uniquename} = $hostname; + + $installer::globals::alluniquedirectorynames{$uniquename} = 1; + + # Important: The unique parent is generated from the string $uniquename. Therefore counters + # like adding "_1" is not allowed to achive uniqueness, because this depends from other directories + # and does not deliver always the same result. my $uniqueparentname = $uniquename; @@ -147,6 +242,11 @@ sub create_unique_directorynames $installer::globals::vendordirectoryset = 1; } } + + if ( $errorcount > 0 ) + { + installer::exiter::exit_program("ERROR: Failed to create unique directory names.", "create_unique_directorynames"); + } } ##################################################### @@ -441,8 +541,9 @@ sub create_directory_table my $infoline; overwrite_programfilesfolder($allvariableshashref); - create_unique_directorynames($directoryref); if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforidt_local_1.log", $directoryref); } + create_unique_directorynames($directoryref, $allvariableshashref); + if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforidt_local_1a.log", $directoryref); } create_defaultdir_directorynames($directoryref, $shortdirnamehashref); # only destdir! if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "directoriesforidt_local_2.log", $directoryref); } set_installlocation_directory($directoryref, $allvariableshashref); diff --git a/solenv/bin/modules/installer/windows/file.pm b/solenv/bin/modules/installer/windows/file.pm index 8396df3de157..059c394278d6 100644 --- a/solenv/bin/modules/installer/windows/file.pm +++ b/solenv/bin/modules/installer/windows/file.pm @@ -170,6 +170,40 @@ sub assign_sequencenumbers_to_files } } +######################################################### +# Create a shorter version of a long component name, +# because maximum length in msi database is 72. +# Attention: In multi msi installation sets, the short +# names have to be unique over all packages, because +# this string is used to create the globally unique id +# -> no resetting of +# %installer::globals::allshortcomponents +# after a package was created. +######################################################### + +sub generate_new_short_componentname +{ + my ($componentname) = @_; + + my $shortcomponentname = ""; + my $counter = 1; + + my $startversion = substr($componentname, 0, 60); # taking only the first 60 characters + $startversion = $startversion . "_"; + + $shortcomponentname = $startversion . $counter; + + while ( exists($installer::globals::allshortcomponents{$shortcomponentname}) ) + { + $counter++; + $shortcomponentname = $startversion . $counter; + } + + $installer::globals::allshortcomponents{$shortcomponentname} = 1; + + return $shortcomponentname; +} + ############################################### # Generating the component name from a file ############################################### @@ -178,77 +212,139 @@ sub get_file_component_name { my ($fileref, $filesref) = @_; - # In this function exists the rule to create components from files - # Rule: - # Two files get the same componentid, if: - # both have the same destination directory. - # both have the same "gid" -> both were packed in the same zip file - # All other files are included into different components! - - # my $componentname = $fileref->{'gid'} . "_" . $fileref->{'Dir'}; - - # $fileref->{'Dir'} is not sufficient! All files in a zip file have the same $fileref->{'Dir'}, - # but can be in different subdirectories. - # Solution: destination=share\Scripts\beanshell\Capitalise\capitalise.bsh - # in which the filename (capitalise.bsh) has to be removed and all backslashes (slashes) are - # converted into underline. - - my $destination = $fileref->{'destination'}; - installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination); - $destination =~ s/\s//g; - $destination =~ s/\\/\_/g; - $destination =~ s/\//\_/g; - $destination =~ s/\_\s*$//g; # removing ending underline - - my $componentname = $fileref->{'gid'} . "__" . $destination; - - # Files with different languages, need to be packed into different components. - # Then the installation of the language specific component is determined by a language condition. - - if ( $fileref->{'ismultilingual'} ) - { - my $officelanguage = $fileref->{'specificlanguage'}; - $componentname = $componentname . "_" . $officelanguage; - } - - $componentname = lc($componentname); # componentnames always lowercase - - $componentname =~ s/\-/\_/g; # converting "-" to "_" - $componentname =~ s/\./\_/g; # converting "-" to "_" - - # Attention: Maximum length for the componentname is 72 - - $componentname =~ s/gid_file_/g_f_/g; - $componentname =~ s/_extra_/_e_/g; - $componentname =~ s/_config_/_c_/g; - $componentname =~ s/_org_openoffice_/_o_o_/g; - $componentname =~ s/_program_/_p_/g; - $componentname =~ s/_typedetection_/_td_/g; - $componentname =~ s/_linguistic_/_l_/g; - $componentname =~ s/_module_/_m_/g; - $componentname =~ s/_optional_/_opt_/g; - $componentname =~ s/_packages/_pack/g; - $componentname =~ s/_menubar/_mb/g; - $componentname =~ s/_common_/_cm_/g; - $componentname =~ s/_export_/_exp_/g; - $componentname =~ s/_table_/_tb_/g; - $componentname =~ s/_sofficecfg_/_sc_/g; - $componentname =~ s/_startmodulecommands_/_smc_/g; - $componentname =~ s/_drawimpresscommands_/_dic_/g; - $componentname =~ s/_basiccommands_/_bac_/g; - $componentname =~ s/_basicidecommands_/_baic_/g; - $componentname =~ s/_genericcommands_/_genc_/g; - $componentname =~ s/_bibliographycommands_/_bibc_/g; - $componentname =~ s/_share_/_s_/g; - $componentname =~ s/_modules_/_ms_/g; - $componentname =~ s/_uiconfig_zip_/_ucz_/g; - $componentname =~ s/_soffice_cfg_/_sc_/g; - - # All this is not necessary for files, which have the flag ASSIGNCOMPOMENT + my $componentname = ""; + + # Special handling for files with ASSIGNCOMPOMENT my $styles = ""; if ( $fileref->{'Styles'} ) { $styles = $fileref->{'Styles'}; } - if ( $styles =~ /\bASSIGNCOMPOMENT\b/ ) { $componentname = get_component_from_assigned_file($fileref->{'AssignComponent'}, $filesref); } + if ( $styles =~ /\bASSIGNCOMPOMENT\b/ ) + { + $componentname = get_component_from_assigned_file($fileref->{'AssignComponent'}, $filesref); + } + else + { + # In this function exists the rule to create components from files + # Rule: + # Two files get the same componentid, if: + # both have the same destination directory. + # both have the same "gid" -> both were packed in the same zip file + # All other files are included into different components! + + # my $componentname = $fileref->{'gid'} . "_" . $fileref->{'Dir'}; + + # $fileref->{'Dir'} is not sufficient! All files in a zip file have the same $fileref->{'Dir'}, + # but can be in different subdirectories. + # Solution: destination=share\Scripts\beanshell\Capitalise\capitalise.bsh + # in which the filename (capitalise.bsh) has to be removed and all backslashes (slashes) are + # converted into underline. + + my $destination = $fileref->{'destination'}; + installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination); + $destination =~ s/\s//g; + $destination =~ s/\\/\_/g; + $destination =~ s/\//\_/g; + $destination =~ s/\_\s*$//g; # removing ending underline + + $componentname = $fileref->{'gid'} . "__" . $destination; + + # Files with different languages, need to be packed into different components. + # Then the installation of the language specific component is determined by a language condition. + + if ( $fileref->{'ismultilingual'} ) + { + my $officelanguage = $fileref->{'specificlanguage'}; + $componentname = $componentname . "_" . $officelanguage; + } + + $componentname = lc($componentname); # componentnames always lowercase + + $componentname =~ s/\-/\_/g; # converting "-" to "_" + $componentname =~ s/\./\_/g; # converting "-" to "_" + + # Attention: Maximum length for the componentname is 72 + # %installer::globals::allcomponents_in_this_database : resetted for each database + # %installer::globals::allcomponents : not resetted for each database + # Component strings must be unique for the complete product, because they are used for + # the creation of the globally unique identifier. + + my $fullname = $componentname; # This can be longer than 72 + + if (( exists($installer::globals::allcomponents{$fullname}) ) && ( ! exists($installer::globals::allcomponents_in_this_database{$fullname}) )) + { + # This is not allowed: One component cannot be installed with different packages. + installer::exiter::exit_program("ERROR: Component \"$fullname\" is already included into another package. This is not allowed.", "get_file_component_name"); + } + + if ( exists($installer::globals::allcomponents{$fullname}) ) + { + $componentname = $installer::globals::allcomponents{$fullname}; + } + else + { + if ( length($componentname) > 72 ) + { + # Using md5sum needs much time + # chomp(my $shorter = `echo $componentname | md5sum | sed -e "s/ .*//g"`); + # $componentname = "comp_$shorter"; + $componentname = generate_new_short_componentname($componentname); # This has to be unique for the complete product, not only one package + } + + $installer::globals::allcomponents{$fullname} = $componentname; + $installer::globals::allcomponents_in_this_database{$fullname} = 1; + } + + # $componentname =~ s/gid_file_/g_f_/g; + # $componentname =~ s/_extra_/_e_/g; + # $componentname =~ s/_config_/_c_/g; + # $componentname =~ s/_org_openoffice_/_o_o_/g; + # $componentname =~ s/_program_/_p_/g; + # $componentname =~ s/_typedetection_/_td_/g; + # $componentname =~ s/_linguistic_/_l_/g; + # $componentname =~ s/_module_/_m_/g; + # $componentname =~ s/_optional_/_opt_/g; + # $componentname =~ s/_packages/_pack/g; + # $componentname =~ s/_menubar/_mb/g; + # $componentname =~ s/_common_/_cm_/g; + # $componentname =~ s/_export_/_exp_/g; + # $componentname =~ s/_table_/_tb_/g; + # $componentname =~ s/_sofficecfg_/_sc_/g; + # $componentname =~ s/_soffice_cfg_/_sc_/g; + # $componentname =~ s/_startmodulecommands_/_smc_/g; + # $componentname =~ s/_drawimpresscommands_/_dic_/g; + # $componentname =~ s/_basiccommands_/_bac_/g; + # $componentname =~ s/_basicidecommands_/_baic_/g; + # $componentname =~ s/_genericcommands_/_genc_/g; + # $componentname =~ s/_bibliographycommands_/_bibc_/g; + # $componentname =~ s/_gentiumbookbasicbolditalic_/_gbbbi_/g; + # $componentname =~ s/_share_/_s_/g; + # $componentname =~ s/_extension_/_ext_/g; + # $componentname =~ s/_extensions_/_exs_/g; + # $componentname =~ s/_modules_/_ms_/g; + # $componentname =~ s/_uiconfig_zip_/_ucz_/g; + # $componentname =~ s/_productivity_/_pr_/g; + # $componentname =~ s/_wizard_/_wz_/g; + # $componentname =~ s/_import_/_im_/g; + # $componentname =~ s/_javascript_/_js_/g; + # $componentname =~ s/_template_/_tpl_/g; + # $componentname =~ s/_tplwizletter_/_twl_/g; + # $componentname =~ s/_beanshell_/_bs_/g; + # $componentname =~ s/_presentation_/_bs_/g; + # $componentname =~ s/_columns_/_cls_/g; + # $componentname =~ s/_python_/_py_/g; + + # $componentname =~ s/_tools/_ts/g; + # $componentname =~ s/_transitions/_trs/g; + # $componentname =~ s/_scriptbinding/_scrb/g; + # $componentname =~ s/_spreadsheet/_ssh/g; + # $componentname =~ s/_publisher/_pub/g; + # $componentname =~ s/_presenter/_pre/g; + # $componentname =~ s/_registry/_reg/g; + + # $componentname =~ s/screen/sc/g; + # $componentname =~ s/wordml/wm/g; + # $componentname =~ s/openoffice/oo/g; + } return $componentname; } diff --git a/solenv/bin/modules/installer/windows/idtglobal.pm b/solenv/bin/modules/installer/windows/idtglobal.pm index fddbe749a57c..333df0e8ea08 100644 --- a/solenv/bin/modules/installer/windows/idtglobal.pm +++ b/solenv/bin/modules/installer/windows/idtglobal.pm @@ -90,10 +90,8 @@ sub get_next_free_number } until (!($alreadyexists)); - if (( $counter > 9 ) && ( length($name) > 6 )) - { - $dontsave = 1; - } + if (( $counter > 9 ) && ( length($name) > 6 )) { $dontsave = 1; } + if (( $counter > 99 ) && ( length($name) > 5 )) { $dontsave = 1; } if (!($dontsave)) { @@ -191,6 +189,14 @@ sub make_eight_three_conform $name =~ s/\s*$//; # removing ending whitespaces $name = $name . "\~"; $number = get_next_free_number($name, $shortnamesref); + + if ( $number > 99 ) + { + $name = substr($name, 0, 4); # name, offset, length + $name =~ s/\s*$//; # removing ending whitespaces + $name = $name . "\~"; + $number = get_next_free_number($name, $shortnamesref); + } } $name = $name . "$number"; @@ -223,6 +229,14 @@ sub make_eight_three_conform $name =~ s/\s*$//; # removing ending whitespaces $name = $name . "\~"; $number = get_next_free_number($name, $shortnamesref); + + if ( $number > 99 ) + { + $name = substr($name, 0, 4); # name, offset, length + $name =~ s/\s*$//; # removing ending whitespaces + $name = $name . "\~"; + $number = get_next_free_number($name, $shortnamesref); + } } $name = $name . "$number"; diff --git a/solenv/bin/modules/installer/windows/msiglobal.pm b/solenv/bin/modules/installer/windows/msiglobal.pm index 1731c1997af3..07f6b73c9cbc 100644 --- a/solenv/bin/modules/installer/windows/msiglobal.pm +++ b/solenv/bin/modules/installer/windows/msiglobal.pm @@ -788,11 +788,16 @@ sub get_codepage_for_sis sub get_template_for_sis { - my ( $language ) = @_; + my ( $language, $allvariables ) = @_; my $windowslanguage = installer::windows::language::get_windows_language($language); - my $value = "\"Intel;" . $windowslanguage; # adding the Windows language + my $architecture = "Intel"; + + # Adding 256, if this is a 64 bit installation set. + if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $architecture = "x64"; } + + my $value = "\"" . $architecture . ";" . $windowslanguage; # adding the Windows language $value = $value . "\""; # adding ending '"' @@ -930,7 +935,7 @@ sub write_summary_into_msi_database my $msiversion = get_msiversion_for_sis(); my $codepage = get_codepage_for_sis($language); - my $template = get_template_for_sis($language); + my $template = get_template_for_sis($language, $allvariableshashref); my $guid = get_packagecode_for_sis(); my $title = get_title_for_sis($sislanguage,$languagefile, "OOO_SIS_TITLE"); my $author = get_author_for_sis(); @@ -1629,6 +1634,104 @@ sub set_uuid_into_component_table installer::files::save_file($componenttablename, $componenttable); } +######################################################################### +# Adding final 64 properties into msi database, if required. +# RegLocator : +16 in type column to search in 64 bit registry. +# All conditions: "VersionNT" -> "VersionNT64" (several tables). +# Already done: "+256" in Attributes column of table "Component". +# Still following: Setting "x64" instead of "Intel" in Summary +# Information Stream of msi database in "get_template_for_sis". +######################################################################### + +sub prepare_64bit_database +{ + my ($basedir, $allvariables) = @_; + + my $infoline = ""; + + if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) + { + # 1. Beginning with table "RegLocat.idt". Adding "16" to the type. + + my $reglocatfile = ""; + my $reglocatfilename = $basedir . $installer::globals::separator . "RegLocat.idt"; + + if ( -f $reglocatfilename ) + { + my $saving_required = 0; + $reglocatfile = installer::files::read_file($reglocatfilename); + + for ( my $i = 3; $i <= $#{$reglocatfile}; $i++ ) # ignoring the first three lines + { + my $oneline = ${$reglocatfile}[$i]; + + if ( $oneline =~ /^\s*\#/ ) { next; } # this is a comment line + if ( $oneline =~ /^\s*$/ ) { next; } + + if ( $oneline =~ /^\s*(.*?)\t(.*?)\t(.*?)\t(.*?)\t(\d+)\s*$/ ) + { + # Syntax: Signature_ Root Key Name Type + my $sig = $1; + my $root = $2; + my $key = $3; + my $name = $4; + my $type = $5; + + $type = $type + 16; + + my $newline = $sig . "\t" . $root . "\t" . $key . "\t" . $name . "\t" . $type . "\n"; + ${$reglocatfile}[$i] = $newline; + + $saving_required = 1; + } + } + + if ( $saving_required ) + { + # Saving the files + installer::files::save_file($reglocatfilename ,$reglocatfile); + $infoline = "Making idt file 64 bit conform: $reglocatfilename\n"; + push(@installer::globals::logfileinfo, $infoline); + } + } + + # 2. Replacing all occurences of "VersionNT" by "VersionNT64" + + my @versionnt_files = ("Componen.idt", "InstallE.idt", "InstallU.idt", "LaunchCo.idt"); + + foreach my $onefile ( @versionnt_files ) + { + my $fullfilename = $basedir . $installer::globals::separator . $onefile; + + if ( -f $fullfilename ) + { + my $saving_required = 0; + $filecontent = installer::files::read_file($fullfilename); + + for ( my $i = 3; $i <= $#{$filecontent}; $i++ ) # ignoring the first three lines + { + my $oneline = ${$filecontent}[$i]; + + if ( $oneline =~ /\bVersionNT\b/ ) + { + ${$filecontent}[$i] =~ s/\bVersionNT\b/VersionNT64/g; + $saving_required = 1; + } + } + + if ( $saving_required ) + { + # Saving the files + installer::files::save_file($fullfilename ,$filecontent); + $infoline = "Making idt file 64 bit conform: $fullfilename\n"; + push(@installer::globals::logfileinfo, $infoline); + } + } + } + } + +} + ################################################################# # Include all cab files into the msi database. # This works only on Windows @@ -1656,7 +1759,6 @@ sub include_cabs_into_msi $msifilename = installer::converter::make_path_conform($msifilename); # msidb.exe really wants backslashes. (And double escaping because system() expands the string.) - $idtdirbase =~ s/\//\\\\/g; $msifilename =~ s/\//\\\\/g; $extraslash = "\\"; diff --git a/solenv/bin/modules/installer/windows/property.pm b/solenv/bin/modules/installer/windows/property.pm index 8c311e759f16..44d9a3c06598 100644 --- a/solenv/bin/modules/installer/windows/property.pm +++ b/solenv/bin/modules/installer/windows/property.pm @@ -381,8 +381,8 @@ sub set_important_properties if (( $allvariables->{'PRODUCTEXTENSION'} ) && ( $allvariables->{'PRODUCTEXTENSION'} eq "Beta" )) { - my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n"; - push(@{$propertyfile}, $registryline); + # my $registryline = "WRITE_REGISTRY" . "\t" . "0" . "\n"; + # push(@{$propertyfile}, $registryline); my $betainfoline = "BETAPRODUCT" . "\t" . "1" . "\n"; push(@{$propertyfile}, $betainfoline); } diff --git a/solenv/bin/modules/par2script/check.pm b/solenv/bin/modules/par2script/check.pm index 7a975f530445..78808cee9191 100644 --- a/solenv/bin/modules/par2script/check.pm +++ b/solenv/bin/modules/par2script/check.pm @@ -139,55 +139,6 @@ sub check_module_existence } ######################################################## -# If the StarRegistry is not defined in the script, -# it has to be removed from the file definition. -######################################################## - -sub check_registry_at_files -{ - my %starregistrygid = (); - - my $item; - foreach $item ( keys %{$par2script::globals::definitions{'File'}} ) - { - if (( exists($par2script::globals::definitions{'File'}->{$item}->{'Styles'}) ) && - ( $par2script::globals::definitions{'File'}->{$item}->{'Styles'} =~ /\bSTARREGISTRY\b/ )) - { - $starregistrygid{$item} = 1; - } - } - - foreach $item ( keys %{$par2script::globals::definitions{'File'}} ) - { - if ( exists($par2script::globals::definitions{'File'}->{$item}->{'RegistryID'}) ) - { - my $registryid = $par2script::globals::definitions{'File'}->{$item}->{'RegistryID'}; - if ( ! exists($starregistrygid{$registryid}) ) - { - die "\nERROR: No definition found for $registryid at file $item\n\n"; - } - - # if ( ! ( $par2script::globals::definitions{'File'}->{$item}->{'Styles'} =~ /\bUNO_COMPONENT\b/ )) - # { - # die "\nERROR: Flag UNO_COMPONENT required for file $item\n\n"; - # } - # -> also possible, that Regmergefile is defined (does not require flag UNO_COMPONENT) - } - - # and also vice versa - - if (( exists($par2script::globals::definitions{'File'}->{$item}->{'Styles'}) ) && - ( $par2script::globals::definitions{'File'}->{$item}->{'Styles'} =~ /\bUNO_COMPONENT\b/ )) - { - if ( ! exists($par2script::globals::definitions{'File'}->{$item}->{'RegistryID'}) ) - { - die "\nERROR: Flag UNO_COMPONENT defined, but no file as \"RegistryID\" at file $item !\n\n"; - } - } - } -} - -######################################################## # Every script has to contain exactly one root module. # This module has no ParentID or an empty ParentID. ######################################################## |