This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push:
new 21c90f89b2 Further cleanup
21c90f89b2 is described below
commit 21c90f89b28778569ea899bd75a90ecbf73be52e
Author: mseidel <[email protected]>
AuthorDate: Fri Feb 7 20:46:32 2025 +0100
Further cleanup
(cherry picked from commit ec6d9e159f5d40bf5d1f27b0b525436f7e942929)
---
main/solenv/bin/modules/installer/windows/admin.pm | 216 +++---
.../bin/modules/installer/windows/assembly.pm | 135 ++--
.../solenv/bin/modules/installer/windows/binary.pm | 22 +-
.../bin/modules/installer/windows/createfolder.pm | 36 +-
.../bin/modules/installer/windows/directory.pm | 842 ++++++++++-----------
5 files changed, 606 insertions(+), 645 deletions(-)
diff --git a/main/solenv/bin/modules/installer/windows/admin.pm
b/main/solenv/bin/modules/installer/windows/admin.pm
index 55176f004c..3518e7501a 100644
--- a/main/solenv/bin/modules/installer/windows/admin.pm
+++ b/main/solenv/bin/modules/installer/windows/admin.pm
@@ -1,5 +1,5 @@
#**************************************************************
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,20 +7,18 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
#**************************************************************
-
-
package installer::windows::admin;
use File::Copy;
@@ -39,15 +37,15 @@ use installer::windows::idtglobal;
sub unpack_cabinet_file
{
my ($cabfilename, $unpackdir) = @_;
-
+
my $infoline = "Unpacking cabinet file: $cabfilename\n";
$installer::logger::Lang->print($infoline);
my $expandfile = "expand.exe"; # Has to be in the path
# expand.exe has to be located in the system directory.
- # Cygwin has another tool expand.exe, that converts tabs to spaces.
This cannot be used of course.
- # But this wrong expand.exe is typically in the PATH before this
expand.exe, to unpack
+ # Cygwin has another tool expand.exe, that converts tabs to spaces.
This cannot be used of course.
+ # But this wrong expand.exe is typically in the PATH before this
expand.exe, to unpack
# cabinet files.
# if ( $^O =~ /cygwin/i )
@@ -71,7 +69,7 @@ sub unpack_cabinet_file
my $systemcall = "";
if ( $^O =~ /cygwin/i ) {
my $localunpackdir = qx{cygpath -w "$unpackdir"};
- chomp ($localunpackdir);
+ chomp ($localunpackdir);
$localunpackdir =~ s/\\/\\\\/g;
$cabfilename =~ s/\\/\\\\/g;
$cabfilename =~ s/\s*$//g;
@@ -114,7 +112,7 @@ sub include_tables_into_pcpfile
# Make all table 8+3 conform
my $alltables =
installer::converter::convert_stringlist_into_array(\$tables, " ");
-
+
for ( my $i = 0; $i <= $#{$alltables}; $i++ )
{
my $tablename = ${$alltables}[$i];
@@ -135,7 +133,7 @@ sub include_tables_into_pcpfile
# Import of tables
$systemcall = $msidb . " -d " . $fullmsidatabasepath . " -f " .
$workdir . " -i " . $tables;
-
+
$returnvalue = system($systemcall);
$infoline = "Systemcall: $systemcall\n";
@@ -166,23 +164,23 @@ sub extract_tables_from_pcpfile
my $infoline = "";
my $systemcall = "";
my $returnvalue = "";
-
+
my $localfullmsidatabasepath = $fullmsidatabasepath;
# Export of all tables by using "*"
if ( $^O =~ /cygwin/i ) {
- # Copying the msi database locally guarantees the format of the
directory.
- # Otherwise it is defined in the file of
UPDATE_DATABASE_LISTNAME
+ # Copying the msi database locally guarantees the format of the
directory.
+ # Otherwise it is defined in the file of
UPDATE_DATABASE_LISTNAME
my $msifilename = $localfullmsidatabasepath;
installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$msifilename);
my $destdatabasename = $workdir .
$installer::globals::separator . $msifilename;
installer::systemactions::copy_one_file($localfullmsidatabasepath,
$destdatabasename);
$localfullmsidatabasepath = $destdatabasename;
-
- chomp( $localfullmsidatabasepath = qx{cygpath -w
"$localfullmsidatabasepath"} );
- chomp( $workdir = qx{cygpath -w "$workdir"} );
+
+ chomp( $localfullmsidatabasepath = qx{cygpath -w
"$localfullmsidatabasepath"} );
+ chomp( $workdir = qx{cygpath -w "$workdir"} );
# msidb.exe really wants backslashes. (And double escaping
because system() expands the string.)
$localfullmsidatabasepath =~ s/\\/\\\\/g;
@@ -192,7 +190,7 @@ sub extract_tables_from_pcpfile
$localfullmsidatabasepath =~ s/\//\\\\/g;
$workdir =~ s/\//\\\\/g;
}
-
+
$systemcall = $msidb . " -d " . $localfullmsidatabasepath . " -f " .
$workdir . " -e $tablelist";
$returnvalue = system($systemcall);
@@ -219,7 +217,7 @@ sub extract_tables_from_pcpfile
sub analyze_directory_file
{
my ($filecontent) = @_;
-
+
my %table = ();
for ( my $i = 0; $i <= $#{$filecontent}; $i++ )
@@ -231,18 +229,18 @@ sub analyze_directory_file
my $dir = $1;
my $parent = $2;
my $name = $3;
-
+
if ( $name =~ /^\s*(.*?)\s*\:\s*(.*?)\s*$/ ) { $name =
$2; }
if ( $name =~ /^\s*(.*?)\s*\|\s*(.*?)\s*$/ ) { $name =
$2; }
-
+
my %helphash = ();
$helphash{'Directory_Parent'} = $parent;
$helphash{'DefaultDir'} = $name;
$table{$dir} = \%helphash;
}
}
-
- return \%table;
+
+ return \%table;
}
#################################################################################
@@ -252,9 +250,9 @@ sub analyze_directory_file
sub analyze_component_file
{
my ($filecontent) = @_;
-
+
my %table = ();
-
+
for ( my $i = 0; $i <= $#{$filecontent}; $i++ )
{
if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; }
@@ -263,12 +261,12 @@ sub analyze_component_file
{
my $component = $1;
my $dir = $3;
-
+
$table{$component} = $dir;
}
}
- return \%table;
+ return \%table;
}
#################################################################################
@@ -280,7 +278,7 @@ sub analyze_keypath_component_file
my ($filecontent) = @_;
my %keypathtable = ();
-
+
for ( my $i = 0; $i <= $#{$filecontent}; $i++ )
{
if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; }
@@ -305,9 +303,9 @@ sub analyze_keypath_component_file
sub analyze_registry_file
{
my ($filecontent) = @_;
-
+
my %table = ();
-
+
for ( my $i = 0; $i <= $#{$filecontent}; $i++ )
{
if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; }
@@ -320,7 +318,7 @@ sub analyze_registry_file
my $name = $4;
my $value = $5;
my $component = $6;
-
+
my %helphash = ();
# $helphash{'Registry'} = $registry;
$helphash{'Root'} = $root;
@@ -333,7 +331,7 @@ sub analyze_registry_file
}
}
- return \%table;
+ return \%table;
}
#################################################################################
@@ -343,11 +341,11 @@ sub analyze_registry_file
sub analyze_file_file
{
my ($filecontent) = @_;
-
+
my %table = ();
my %fileorder = ();
my $maxsequence = 0;
-
+
for ( my $i = 0; $i <= $#{$filecontent}; $i++ )
{
if (( $i == 0 ) || ( $i == 1 ) || ( $i == 2 )) { next; }
@@ -360,16 +358,16 @@ sub analyze_file_file
my $sequence = $8;
if ( $filename =~ /^\s*(.*?)\s*\|\s*(.*?)\s*$/ ) {
$filename = $2; }
-
+
my %helphash = ();
$helphash{'Component'} = $comp;
$helphash{'FileName'} = $filename;
$helphash{'Sequence'} = $sequence;
$table{$file} = \%helphash;
-
+
$fileorder{$sequence} = $file;
-
+
if ( $sequence > $maxsequence ) { $maxsequence =
$sequence; }
}
}
@@ -383,7 +381,7 @@ sub analyze_file_file
sub create_directory_tree
{
- my ($parent, $pathcollector, $fulldir, $dirhash) = @_;
+ my ($parent, $pathcollector, $fulldir, $dirhash) = @_;
foreach my $dir ( keys %{$dirhash} )
{
@@ -408,11 +406,11 @@ sub create_directory_tree
sub create_directory_structure
{
my ($dirhash, $targetdir) = @_;
-
+
my %fullpathhash = ();
-
+
my @startparents = ("TARGETDIR", "INSTALLLOCATION");
-
+
foreach $dir (@startparents) { create_directory_tree($dir,
\%fullpathhash, $targetdir, $dirhash); }
# Also adding the paths of the startparents
@@ -420,7 +418,7 @@ sub create_directory_structure
{
if ( ! exists($fullpathhash{$dir}) ) { $fullpathhash{$dir} =
$targetdir; }
}
-
+
return \%fullpathhash;
}
@@ -450,24 +448,24 @@ sub copy_files_into_directory_structure
$destfile = $destdir . $installer::globals::separator .
$destfile;
my $sourcefile = $unpackdir .
$installer::globals::separator . $file;
-
+
if ( ! -f $sourcefile )
{
# It is possible, that this was an unpacked file
# Looking in the dirhash, to find the
subdirectory in the installation set (the id is $dirname)
# subdir is not recursively analyzed, only one
directory.
-
- my $oldsourcefile = $sourcefile;
+
+ my $oldsourcefile = $sourcefile;
my $subdir = "";
if (
exists($dirhash->{$dirname}->{'DefaultDir'}) ) { $subdir =
$dirhash->{$dirname}->{'DefaultDir'} . $installer::globals::separator; }
my $realfilename =
$filehash->{$file}->{'FileName'};
my $localinstalldir = $installdir;
-
+
$localinstalldir =~ s/\\\s*$//;
$localinstalldir =~ s/\/\s*$//;
-
+
$sourcefile = $localinstalldir .
$installer::globals::separator . $subdir . $realfilename;
-
+
if ( ! -f $sourcefile )
{
installer::exiter::exit_program("ERROR:
File not found: \"$oldsourcefile\" (or \"$sourcefile\").",
"copy_files_into_directory_structure");
@@ -493,19 +491,19 @@ sub copy_files_into_directory_structure
# installer::exiter::exit_program("ERROR: No file
assigned to sequence $i", "copy_files_into_directory_structure");
# }
}
-
+
return $unopkgfile;
}
###############################################################
-# Setting the time string for the
-# Summary Information stream in the
+# Setting the time string for the
+# Summary Information stream in the
# msi database of the admin installations.
###############################################################
sub get_sis_time_string
-{
+{
# Syntax: <yyyy/mm/dd hh:mm:ss>
my $second = (localtime())[0];
my $minute = (localtime())[1];
@@ -521,16 +519,16 @@ sub get_sis_time_string
if ( $hour < 10 ) { $hour = "0" . $hour; }
if ( $day < 10 ) { $day = "0" . $day; }
if ( $month < 10 ) { $month = "0" . $month; }
-
+
my $timestring = $year . "/" . $month . "/" . $day . " " . $hour . ":"
. $minute . ":" . $second;
-
+
return $timestring;
}
###############################################################
# Windows registry entries containing properties are not set
-# correctly during msp patch process. The properties are
-# empty or do get their default values. This destroys the
+# correctly during msp patch process. The properties are
+# empty or do get their default values. This destroys the
# values of many entries in Windows registry.
# This can be fixed by removing all entries in Registry table,
# containing a property before starting msimsp.exe.
@@ -542,16 +540,16 @@ sub remove_properties_from_registry_table
$installer::logger::Lang->print("\n");
$installer::logger::Lang->add_timestamp("Performance Info: Start
remove_properties_from_registry_table");
-
+
my @registrytable = ();
-
+
# Registry hash
# Collecting all RegistryItems with values containing a property: [...]
# To which component do they belong
# Is this after removal an empty component? Create a replacement, so
that
# no Component has to be removed.
# Is this RegistryItem a KeyPath of a component. Then it cannot be
removed.
-
+
my %problemitems = ();
my %problemcomponents = ();
my %securecomponents = ();
@@ -561,7 +559,7 @@ sub remove_properties_from_registry_table
my $newitemcounter = 0;
my $olditemcounter = 0;
-
+
foreach my $regitem ( keys %{$registryhash} )
{
my $value = "";
@@ -570,11 +568,11 @@ sub remove_properties_from_registry_table
if ( $value =~ /^.*(\[.*?\]).*$/ )
{
my $property = $1;
-
+
# Collecting registry item
$problemitems{$regitem} = 1; # "1" -> can be removed
if ( exists($componentkeypathhash->{$regitem}) ) {
$problemitems{$regitem} = 2; } # "2" -> cannot be removed, KeyPath
-
+
# Collecting component (and number of problematic
registry items
# my $component =
$registryhash->{$regitem}->{'Component'};
# if ( exists($problemcomponents{$regitem}) ) {
$problemcomponents{$regitem} = $problemcomponents{$regitem} + 1; }
@@ -588,7 +586,7 @@ sub remove_properties_from_registry_table
if ( $component eq "" ) {
installer::exiter::exit_program("ERROR: Did not find component for registry
item \"$regitem\".", "remove_properties_from_registry_table"); }
$securecomponents{$component} = 1;
}
-
+
# Searching for change value
my $localkey = "";
if ( exists($registryhash->{$regitem}->{'Key'}) ) { $localkey =
$registryhash->{$regitem}->{'Key'}; }
@@ -596,14 +594,14 @@ sub remove_properties_from_registry_table
{
$changevalue = $1;
$changeroot = $registryhash->{$regitem}->{'Root'};
- }
-
- $olditemcounter++;
+ }
+
+ $olditemcounter++;
}
-
+
my $removecounter = 0;
my $renamecounter = 0;
-
+
foreach my $regitem ( keys %{$registryhash} )
{
my $value = "";
@@ -630,7 +628,7 @@ sub remove_properties_from_registry_table
{
# Changing values of registry items, that are
KeyPath or that contain to
# components with only unsecure registry items.
-
+
if (( $problemitems{$regitem} == 2 ) || ( !
exists($securecomponents{$component}) ))
{
# change value of registry item
@@ -638,11 +636,11 @@ sub remove_properties_from_registry_table
my $oldkey = "";
if (
exists($registryhash->{$regitem}->{'Key'}) ) { $oldkey =
$registryhash->{$regitem}->{'Key'}; };
- my $oldname = "";
+ my $oldname = "";
if (
exists($registryhash->{$regitem}->{'Name'}) ) { $oldname =
$registryhash->{$regitem}->{'Name'}; }
my $oldvalue = "";
if (
exists($registryhash->{$regitem}->{'Value'}) ) { $oldvalue =
$registryhash->{$regitem}->{'Value'}; }
-
+
$registryhash->{$regitem}->{'Key'} =
$changevalue . "RegistryItem";
$registryhash->{$regitem}->{'Root'} =
$changeroot;
$registryhash->{$regitem}->{'Name'} =
$regitem;
@@ -662,11 +660,11 @@ sub remove_properties_from_registry_table
$installer::logger::Lang->print($infoline);
$infoline = "Number of changed registry items: $renamecounter\n";
$installer::logger::Lang->print($infoline);
-
+
# Creating the new content of Registry table
# First three lines from $registryfilecontent
# All further files from changed $registryhash
-
+
for ( my $i = 0; $i <= 2; $i++ ) { push(@registrytable,
${$registryfilecontent}[$i]); }
foreach my $regitem ( keys %{$registryhash} )
@@ -682,7 +680,7 @@ sub remove_properties_from_registry_table
if ( exists($registryhash->{$regitem}->{'Value'}) ) { $value =
$registryhash->{$regitem}->{'Value'}; }
my $comp = "";
if ( exists($registryhash->{$regitem}->{'Component'}) ) { $comp
= $registryhash->{$regitem}->{'Component'}; }
-
+
my $oneline = $regitem . "\t" . $root . "\t" . $localkey . "\t"
. $name . "\t" . $value . "\t" . $comp . "\n";
push(@registrytable, $oneline);
@@ -694,13 +692,13 @@ sub remove_properties_from_registry_table
$installer::logger::Lang->print("\n");
$installer::logger::Lang->add_timestamp("Performance Info: End
remove_properties_from_registry_table");
-
+
return (\@registrytable);
}
###############################################################
-# Writing content of administrative installations into
-# Summary Information Stream of msi database.
+# Writing content of administrative installations into
+# Summary Information Stream of msi database.
# This is required for example for following
# patch processes using Windows Installer service.
###############################################################
@@ -708,7 +706,7 @@ sub remove_properties_from_registry_table
sub write_sis_info
{
my ($msidatabase) = @_ ;
-
+
if ( ! -f $msidatabase ) { installer::exiter::exit_program("ERROR:
Cannot find file $msidatabase", "write_sis_info"); }
my $msiinfo = "msiinfo.exe"; # Has to be in the path
@@ -717,25 +715,25 @@ sub write_sis_info
my $returnvalue = "";
# Required setting for administrative installations:
- # -w 4 (source files are unpacked), wordcount
+ # -w 4 (source files are unpacked), wordcount
# -s <date of admin installation>, LastPrinted, Syntax: <yyyy/mm/dd
hh:mm:ss>
# -l <person_making_admin_installation>, LastSavedBy
-
- my $wordcount = 4; # Unpacked files
+
+ my $wordcount = 4; # Unpacked files
my $lastprinted = get_sis_time_string();
my $lastsavedby = "Installer";
my $localmsidatabase = $msidatabase;
-
+
if( $^O =~ /cygwin/i )
{
$localmsidatabase = qx{cygpath -w "$localmsidatabase"};
$localmsidatabase =~ s/\\/\\\\/g;
$localmsidatabase =~ s/\s*$//g;
}
-
+
$systemcall = $msiinfo . " " . "\"" . $localmsidatabase . "\"" . " -w "
. $wordcount . " -s " . "\"" . $lastprinted . "\"" . " -l $lastsavedby";
- $installer::logger::Lang->printf($systemcall);
+ $installer::logger::Lang->printf($systemcall);
$returnvalue = system($systemcall);
if ($returnvalue)
@@ -743,7 +741,7 @@ sub write_sis_info
$infoline = "ERROR: Could not execute $systemcall !\n";
$installer::logger::Lang->print($infoline);
installer::exiter::exit_program($infoline, "write_sis_info");
- }
+ }
}
####################################################
@@ -753,14 +751,14 @@ sub write_sis_info
sub get_extensions_dir
{
my ( $unopkgfile ) = @_;
-
+
my $localbranddir = $unopkgfile;
installer::pathanalyzer::get_path_from_fullqualifiedname(\$localbranddir); #
"program" dir in brand layer
installer::pathanalyzer::get_path_from_fullqualifiedname(\$localbranddir); #
root dir in brand layer
$localbranddir =~ s/\Q$installer::globals::separator\E\s*$//;
my $extensiondir = $localbranddir . $installer::globals::separator .
"share" . $installer::globals::separator . "extensions";
-
- return $extensiondir;
+
+ return $extensiondir;
}
##############################################################
@@ -777,7 +775,7 @@ sub remove_empty_dirs_in_folder
}
my @content = ();
-
+
$dir =~ s/\Q$installer::globals::separator\E\s*$//;
if ( -d $dir )
@@ -787,7 +785,7 @@ sub remove_empty_dirs_in_folder
closedir(DIR);
my $oneitem;
-
+
foreach $oneitem (@content)
{
if ((!($oneitem eq ".")) && (!($oneitem eq "..")))
@@ -800,11 +798,11 @@ sub remove_empty_dirs_in_folder
}
}
}
-
- # try to remove empty directory
+
+ # try to remove empty directory
my $returnvalue = rmdir $dir;
- # if ( $returnvalue ) { print "Successfully removed empty dir
$dir\n"; }
+ # if ( $returnvalue ) { print "Successfully removed empty dir
$dir\n"; }
}
}
@@ -818,23 +816,23 @@ sub make_admin_install
# Create helper directory
- $installer::logger::Info->printf("... installing %s in directory %s ...\n",
- $databasepath,
- $targetdir);
+ $installer::logger::Info->printf("... installing %s in directory %s
...\n",
+ $databasepath,
+ $targetdir);
my $helperdir = $targetdir . $installer::globals::separator .
"installhelper";
installer::systemactions::create_directory($helperdir);
-
+
# Get File.idt, Component.idt and Directory.idt from database
-
+
my $tablelist = "File Directory Component Registry";
extract_tables_from_pcpfile($databasepath, $helperdir, $tablelist);
-
+
# Unpack all cab files into $helperdir, cab files must be located next
to msi database
my $installdir = $databasepath;
if ( $^O =~ /cygwin/i ) { $installdir =~ s/\\/\//g; } # backslash to
slash
-
+
installer::pathanalyzer::get_path_from_fullqualifiedname(\$installdir);
if ( $^O =~ /cygwin/i ) { $installdir =~ s/\//\\/g; } # slash to
backslash
@@ -843,7 +841,7 @@ sub make_admin_install
installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$databasefilename);
my $cabfiles =
installer::systemactions::find_file_with_file_extension("cab", $installdir);
-
+
if ( $#{$cabfiles} < 0 ) { installer::exiter::exit_program("ERROR: Did
not find any cab file in directory $installdir", "make_admin_install"); }
# Set unpackdir
@@ -863,16 +861,16 @@ sub make_admin_install
}
unpack_cabinet_file($cabfile, $unpackdir);
}
-
+
# Reading tables
my $filename = $helperdir . $installer::globals::separator .
"Directory.idt";
my $filecontent = installer::files::read_file($filename);
my $dirhash = analyze_directory_file($filecontent);
-
+
$filename = $helperdir . $installer::globals::separator .
"Component.idt";
my $componentfilecontent = installer::files::read_file($filename);
my $componenthash = analyze_component_file($componentfilecontent);
-
+
$filename = $helperdir . $installer::globals::separator . "File.idt";
$filecontent = installer::files::read_file($filename);
my ( $filehash, $fileorder, $maxsequence ) =
analyze_file_file($filecontent);
@@ -882,17 +880,17 @@ sub make_admin_install
# Copying files
my $unopkgfile = copy_files_into_directory_structure($fileorder,
$filehash, $componenthash, $fullpathhash, $maxsequence, $unpackdir,
$installdir, $dirhash);
-
+
my $msidatabase = $targetdir . $installer::globals::separator .
$databasefilename;
installer::systemactions::copy_one_file($databasepath, $msidatabase);
-
+
if ( $unopkgfile ne "" )
{
# Removing empty dirs in extension folder
my $extensionfolder = get_extensions_dir($unopkgfile);
if ( -d $extensionfolder ) {
remove_empty_dirs_in_folder($extensionfolder, 1); }
}
-
+
# Editing registry table because of wrong Property value
# my $registryfilename = $helperdir .
$installer::globals::separator . "Registry.idt";
# my $componentfilename = $helperdir .
$installer::globals::separator . "Component.idt";
@@ -906,7 +904,7 @@ sub make_admin_install
# installer::files::save_file($registryfilename,
$registryfilecontent);
# $tablelist = "Registry";
# include_tables_into_pcpfile($msidatabase, $helperdir,
$tablelist);
-
+
# Saving info in Summary Information Stream of msi database (required
for following patches)
write_sis_info($msidatabase);
diff --git a/main/solenv/bin/modules/installer/windows/assembly.pm
b/main/solenv/bin/modules/installer/windows/assembly.pm
index 7d3b9556a0..bee3f9c619 100644
--- a/main/solenv/bin/modules/installer/windows/assembly.pm
+++ b/main/solenv/bin/modules/installer/windows/assembly.pm
@@ -1,5 +1,5 @@
#**************************************************************
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,20 +7,18 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
#**************************************************************
-
-
package installer::windows::assembly;
use installer::files;
@@ -38,15 +36,15 @@ use strict;
sub get_msiassembly_feature
{
my ( $onefile ) = @_;
-
+
my $module = "";
-
+
if ( $onefile->{'modules'} ) { $module = $onefile->{'modules'}; }
-
+
# If modules contains a list of modules, only taking the first one.
-
+
if ( $module =~ /^\s*(.*?)\,/ ) { $module = $1; }
-
+
# Attention: Maximum feature length is 38!
installer::windows::idtglobal::shorten_feature_gid(\$module);
@@ -60,11 +58,11 @@ sub get_msiassembly_feature
sub get_msiassembly_component
{
my ( $onefile ) = @_;
-
+
my $component = "";
-
+
$component = $onefile->{'componentname'};
-
+
return $component;
}
@@ -75,16 +73,15 @@ sub get_msiassembly_component
sub get_msiassembly_filemanifest
{
my ( $onefile ) = @_;
-
+
my $filemanifest = "";
$filemanifest = $onefile->{'uniquename'};
# $filemanifest = $onefile->{'Name'};
-
+
return $filemanifest;
}
-
##############################################################
# Returning the file application
##############################################################
@@ -93,8 +90,8 @@ sub get_msiassembly_fileapplication
{
my ( $onefile ) = @_;
- my $fileapplication = "";
-
+ my $fileapplication = "";
+
return $fileapplication;
}
@@ -107,9 +104,9 @@ sub get_msiassembly_attributes
my ( $onefile ) = @_;
my $fileattributes = "";
-
+
if ( $onefile->{'Attributes'} ne "" ) { $fileattributes =
$onefile->{'Attributes'}; }
-
+
return $fileattributes;
}
@@ -123,23 +120,23 @@ sub get_msiassembly_file
my $foundfile = 0;
my $onefile;
-
+
for ( my $i = 0; $i <= $#{$filesref}; $i++ )
{
$onefile = ${$filesref}[$i];
my $name = $onefile->{'Name'};
-
+
if ( $name eq $filename )
{
$foundfile = 1;
- last;
- }
+ last;
+ }
}
# It does not need to exist. For example products that do not contain
the libraries.
# if (! $foundfile ) { installer::exiter::exit_program("ERROR: No
unique file name found for $filename !", "get_selfreg_file"); }
- if (! $foundfile ) { $onefile = ""; }
+ if (! $foundfile ) { $onefile = ""; }
return $onefile;
}
@@ -154,30 +151,30 @@ sub get_msiassembly_file_by_gid
my $foundfile = 0;
my $onefile;
-
+
for ( my $i = 0; $i <= $#{$filesref}; $i++ )
{
$onefile = ${$filesref}[$i];
my $filegid = $onefile->{'gid'};
-
+
if ( $filegid eq $gid )
{
$foundfile = 1;
- last;
- }
+ last;
+ }
}
# It does not need to exist. For example products that do not contain
the libraries.
# if (! $foundfile ) { installer::exiter::exit_program("ERROR: No
unique file name found for $filename !", "get_selfreg_file"); }
- if (! $foundfile ) { $onefile = ""; }
+ if (! $foundfile ) { $onefile = ""; }
return $onefile;
}
####################################################################################
# Creating the file MsiAssembly.idt dynamically
-# Content:
+# Content:
# Component_ Feature_ File_Manifest File_Application
Attributes
# s72 s38 S72 S72 I2
# MsiAssembly Component_
@@ -190,7 +187,7 @@ sub create_msiassembly_table
$installer::globals::msiassemblyfiles =
installer::worker::collect_all_items_with_special_flag($filesref, "ASSEMBLY");
my @msiassemblytable = ();
-
+
installer::windows::idtglobal::write_idt_header(\@msiassemblytable,
"msiassembly");
# Registering all libraries listed in
$installer::globals::msiassemblyfiles
@@ -198,27 +195,27 @@ sub create_msiassembly_table
for ( my $i = 0; $i <= $#{$installer::globals::msiassemblyfiles}; $i++ )
{
my $onefile = ${$installer::globals::msiassemblyfiles}[$i];
-
+
my %msiassembly = ();
-
+
$msiassembly{'Component_'} =
get_msiassembly_component($onefile);
$msiassembly{'Feature_'} = get_msiassembly_feature($onefile);
$msiassembly{'File_Manifest'} =
get_msiassembly_filemanifest($onefile);
$msiassembly{'File_Application'} =
get_msiassembly_fileapplication($onefile);
$msiassembly{'Attributes'} =
get_msiassembly_attributes($onefile);
- my $oneline = $msiassembly{'Component_'} . "\t" .
$msiassembly{'Feature_'} . "\t" .
+ my $oneline = $msiassembly{'Component_'} . "\t" .
$msiassembly{'Feature_'} . "\t" .
$msiassembly{'File_Manifest'} .
"\t" . $msiassembly{'File_Application'} . "\t" .
- $msiassembly{'Attributes'} .
"\n";
+ $msiassembly{'Attributes'} .
"\n";
push(@msiassemblytable, $oneline);
}
-
+
# Saving the file
-
+
my $msiassemblytablename = $basedir . $installer::globals::separator .
"MsiAssem.idt";
installer::files::save_file($msiassemblytablename ,\@msiassemblytable);
- my $infoline = "Created idt file: $msiassemblytablename\n";
+ my $infoline = "Created idt file: $msiassemblytablename\n";
$installer::logger::Lang->print($infoline);
}
@@ -229,20 +226,20 @@ sub create_msiassembly_table
sub get_msiassemblyname_name ($)
{
my ($number) = @_;
-
+
my $name = "";
-
+
if ( $number == 1 ) { $name = "name"; }
elsif ( $number == 2 ) { $name = "publicKeyToken"; }
elsif ( $number == 3 ) { $name = "version"; }
elsif ( $number == 4 ) { $name = "culture"; }
-
+
return $name;
}
####################################################################################
# Creating the file MsiAssemblyName.idt dynamically
-# Content:
+# Content:
# Component_ Name Value
# s72 s255 s255
# MsiAssemblyName Component_ Name
@@ -253,11 +250,11 @@ sub create_msiassemblyname_table
my ($filesref, $basedir) = @_;
my @msiassemblynametable = ();
-
+
installer::windows::idtglobal::write_idt_header(\@msiassemblynametable,
"msiassemblyname");
for ( my $i = 0; $i <= $#{$installer::globals::msiassemblyfiles}; $i++ )
- {
+ {
my $onefile = ${$installer::globals::msiassemblyfiles}[$i];
my $component = get_msiassembly_component($onefile);
@@ -268,45 +265,45 @@ sub create_msiassemblyname_table
if ( $onefile->{'Assemblyname'} )
{
$oneline = $component . "\t" . "name" . "\t" .
$onefile->{'Assemblyname'} . "\n";
- push(@msiassemblynametable, $oneline);
+ push(@msiassemblynametable, $oneline);
}
if ( $onefile->{'PublicKeyToken'} )
{
$oneline = $component . "\t" . "publicKeyToken" . "\t"
. $onefile->{'PublicKeyToken'} . "\n";
- push(@msiassemblynametable, $oneline);
+ push(@msiassemblynametable, $oneline);
}
if ( $onefile->{'Version'} )
{
$oneline = $component . "\t" . "version" . "\t" .
$onefile->{'Version'} . "\n";
- push(@msiassemblynametable, $oneline);
+ push(@msiassemblynametable, $oneline);
}
if ( $onefile->{'Culture'} )
{
$oneline = $component . "\t" . "culture" . "\t" .
$onefile->{'Culture'} . "\n";
- push(@msiassemblynametable, $oneline);
+ push(@msiassemblynametable, $oneline);
}
if ( $onefile->{'ProcessorArchitecture'} )
{
$oneline = $component . "\t" . "processorArchitecture"
. "\t" . $onefile->{'ProcessorArchitecture'} . "\n";
- push(@msiassemblynametable, $oneline);
+ push(@msiassemblynametable, $oneline);
}
}
# Saving the file
-
+
my $msiassemblynametablename = $basedir .
$installer::globals::separator . "MsiAsseN.idt";
installer::files::save_file($msiassemblynametablename
,\@msiassemblynametable);
- my $infoline = "Created idt file: $msiassemblynametablename\n";
+ my $infoline = "Created idt file: $msiassemblynametablename\n";
$installer::logger::Lang->print($infoline);
-
+
}
####################################################################################
-# setting an installation condition for the assembly libraries saved in
+# Åšetting an installation condition for the assembly libraries saved in
# @installer::globals::msiassemblynamecontent
####################################################################################
@@ -321,7 +318,7 @@ sub add_assembly_condition_into_component_table
foreach my $onefile (@$installer::globals::msiassemblyfiles)
{
my $filecomponent = get_msiassembly_component($onefile);
-
+
for ( my $j = 0; $j <= $#{$componenttable}; $j++ )
{
my $oneline = ${$componenttable}[$j];
@@ -334,28 +331,28 @@ sub add_assembly_condition_into_component_table
my $attributes = $4;
my $condition = $5;
my $keypath = $6;
-
+
if ( $component eq $filecomponent )
{
# setting the condition
-
+
# $condition = "MsiNetAssemblySupport";
$condition = "DOTNET_SUFFICIENT=1";
$oneline = join("\t",
- $component,
- $componentid,
- $directory,
- $attributes,
- $condition,
- $keypath) . "\n";
+ $component,
+ $componentid,
+ $directory,
+ $attributes,
+ $condition,
+ $keypath) . "\n";
${$componenttable}[$j] = $oneline;
$changed = 1;
-
-
$installer::logger::Lang->printf("Changing %s :\n", $componenttablename);
+
+
$installer::logger::Lang->printf("Changing %s :\n", $componenttablename);
$installer::logger::Lang->print($oneline);
-
- last;
- }
+
+ last;
+ }
}
}
}
diff --git a/main/solenv/bin/modules/installer/windows/binary.pm
b/main/solenv/bin/modules/installer/windows/binary.pm
index 94424453a7..b8fcc6986d 100644
--- a/main/solenv/bin/modules/installer/windows/binary.pm
+++ b/main/solenv/bin/modules/installer/windows/binary.pm
@@ -1,5 +1,5 @@
#**************************************************************
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,16 +7,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
#**************************************************************
package installer::windows::binary;
@@ -29,7 +29,7 @@ use strict;
###########################################################################################################
# Updating the table Binary dynamically with all files from $binarytablefiles
-# Content:
+# Content:
# Name Data
# s72 v0
# Binary Name
@@ -42,7 +42,7 @@ sub update_binary_table
my $binaryidttablename = $languageidtdir .
$installer::globals::separator . "Binary.idt";
my $binaryidttable = installer::files::read_file($binaryidttablename);
- # Only the iconfiles, that are used in the shortcut table for the
+ # Only the iconfiles, that are used in the shortcut table for the
# FolderItems (entries in Windows startmenu) are added into the icon
table.
foreach my $binaryfile (@$binarytablefiles)
@@ -50,16 +50,16 @@ sub update_binary_table
my $binaryfilename = $binaryfile->{'Name'};
my $binaryfiledata = $binaryfilename;
- # removing "." in filename: "abc.dll" to "abcdll" in name column
- $binaryfilename =~ s/\.//g;
-
+ # removing "." in filename: "abc.dll" to "abcdll" in name column
+ $binaryfilename =~ s/\.//g;
+
push @$binaryidttable, $binaryfilename . "\t" . $binaryfiledata
. "\n";
}
# Saving the file
-
+
installer::files::save_file($binaryidttablename ,$binaryidttable);
- $installer::logger::Lang->printf("Updated idt file: %s\n",
$binaryidttablename);
+ $installer::logger::Lang->printf("Updated idt file: %s\n",
$binaryidttablename);
}
1;
diff --git a/main/solenv/bin/modules/installer/windows/createfolder.pm
b/main/solenv/bin/modules/installer/windows/createfolder.pm
index 3dcd943fca..010015adeb 100644
--- a/main/solenv/bin/modules/installer/windows/createfolder.pm
+++ b/main/solenv/bin/modules/installer/windows/createfolder.pm
@@ -1,5 +1,5 @@
#**************************************************************
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,20 +7,18 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
#**************************************************************
-
-
package installer::windows::createfolder;
use installer::existence;
@@ -38,7 +36,7 @@ sub get_createfolder_directory
my ($onedir) = @_;
my $uniquename = $onedir->{'uniquename'};
-
+
return $uniquename;
}
@@ -57,16 +55,16 @@ sub get_languagepack_file
for ( my $i = 0; $i <= $#{$filesref}; $i++ )
{
$onefile = ${$filesref}[$i];
-
+
if ( $onefile->{'specificlanguage'} eq
$onedir->{'specificlanguage'} )
{
$foundfile = 1;
last;
}
}
-
+
if ( ! $foundfile ) { installer::exiter::exit_program("ERROR: No file
with correct language found (language pack build)!", "get_languagepack_file"); }
-
+
return $onefile;
}
@@ -81,7 +79,7 @@ sub get_createfolder_component
# Directories do not belong to a module.
# Therefore they can only belong to the root module and
# will be added to a component at the root module.
- # All directories will be added to the component
+ # All directories will be added to the component
# containing the file $allvariableshashref->{'GLOBALFILEGID'}
if ( ! $allvariableshashref->{'GLOBALFILEGID'} ) {
installer::exiter::exit_program("ERROR: GLOBALFILEGID must be defined in list
file!", "get_createfolder_component"); }
@@ -99,7 +97,7 @@ sub get_createfolder_component
####################################################################################
# Creating the file CreateFo.idt dynamically for creation of empty directories
-# Content:
+# Content:
# Directory_ Component_
####################################################################################
@@ -110,7 +108,7 @@ sub create_createfolder_table
my @createfoldertable = ();
my $infoline;
-
+
installer::windows::idtglobal::write_idt_header(\@createfoldertable,
"createfolder");
for ( my $i = 0; $i <= $#{$dirref}; $i++ )
@@ -118,18 +116,18 @@ sub create_createfolder_table
my $onedir = ${$dirref}[$i];
# language packs get only language dependent directories
- if (( $installer::globals::languagepack ) && (
$onedir->{'specificlanguage'} eq "" )) { next };
+ if (( $installer::globals::languagepack ) && (
$onedir->{'specificlanguage'} eq "" )) { next };
my $styles = "";
-
+
if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; }
if ( $styles =~ /\bCREATE\b/ )
{
my %directory = ();
- $directory{'Directory_'} =
get_createfolder_directory($onedir);
- $directory{'Component_'} =
get_createfolder_component($onedir, $filesref, $allvariableshashref);
+ $directory{'Directory_'} =
get_createfolder_directory($onedir);
+ $directory{'Component_'} =
get_createfolder_component($onedir, $filesref, $allvariableshashref);
my $oneline = $directory{'Directory_'} . "\t" .
$directory{'Component_'} . "\n";
@@ -138,10 +136,10 @@ sub create_createfolder_table
}
# Saving the file
-
+
my $createfoldertablename = $basedir . $installer::globals::separator .
"CreateFo.idt";
installer::files::save_file($createfoldertablename
,\@createfoldertable);
- $installer::logger::Lang->printf("Created idt file: %s\n",
$createfoldertablename);
+ $installer::logger::Lang->printf("Created idt file: %s\n",
$createfoldertablename);
}
1;
diff --git a/main/solenv/bin/modules/installer/windows/directory.pm
b/main/solenv/bin/modules/installer/windows/directory.pm
index fbb1a6a956..cce6292d28 100644
--- a/main/solenv/bin/modules/installer/windows/directory.pm
+++ b/main/solenv/bin/modules/installer/windows/directory.pm
@@ -1,5 +1,5 @@
#**************************************************************
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,20 +7,18 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
#**************************************************************
-
-
package installer::windows::directory;
use installer::exiter;
@@ -69,50 +67,47 @@ sub collectdirectorytrees
sub overwrite_programfilesfolder
{
my ( $allvariables ) = @_;
-
+
if ( $allvariables->{'PROGRAMFILESFOLDERNAME'} )
{
$installer::globals::programfilesfolder =
$allvariables->{'PROGRAMFILESFOLDERNAME'};
}
}
-
-
-
=head2 make_short_dir_version($longstring)
- Transform the given string into one that is at most 70 characters long.
- That is done in two steps:
- - Cut all parts separated by '_' or '-' down to a length of 5.
- - Cut down the result to a length of 60 and fill it up to length 70
- with the MD5 checksum.
+ Transform the given string into one that is at most 70 characters long.
+ That is done in two steps:
+ - Cut all parts separated by '_' or '-' down to a length of 5.
+ - Cut down the result to a length of 60 and fill it up to length 70
+ with the MD5 checksum.
+
+ This transform always returns the same result for the same string.
+ There is no counter and reference to a global set of names to make the
string unique.
- This transform always returns the same result for the same string.
- There is no counter and reference to a global set of names to make the
string unique.
-
=cut
sub make_short_dir_version ($)
{
my ($longstring) = @_;
-
+
my $shortstring = "";
my $cutlength = 60;
my $length = 5; # So the directory can still be recognized
my $longstring_save = $longstring;
-
+
# Splitting the string at each "underline" and allowing only $length
characters per directory name.
# Checking also uniqueness and length.
-
+
my @outer_parts = split(/_/, $longstring);
foreach my $onestring (@outer_parts)
{
my $partstring = "";
-
+
if ( $onestring =~ /\-/ )
{
my @inner_parts = split(/-/, $onestring);
- @inner_parts = map {substr($_,0,$length)} @inner_parts;
- $partstring = join("-", @inner_parts);
+ @inner_parts = map {substr($_,0,$length)} @inner_parts;
+ $partstring = join("-", @inner_parts);
$partstring =~ s/^\s*\-//;
}
else
@@ -127,226 +122,213 @@ sub make_short_dir_version ($)
# Setting unique ID to each directory
# No counter allowed, process must be absolute reproducible due to
patch creation process.
-
+
my $subid =
installer::windows::msiglobal::calculate_id($longstring_save, 9); # taking only
the first 9 digits
$shortstring = substr($shortstring, 0, $cutlength) . "_" . $subid;
return $shortstring;
}
-
-
-
=head2 get_unique_name ($hostname, $unique_map, $shortdirhash,
$shortdirhashreverse)
- Return a long and a short unique name for the given $hostname.
- Despite the function name and unlike the generation of unique
- names for files, the returned names are not really unique. Quite
- the opposite. The returned names are quaranteed to return the
- same result for the same input.
+ Return a long and a short unique name for the given $hostname.
+ Despite the function name and unlike the generation of unique
+ names for files, the returned names are not really unique. Quite
+ the opposite. The returned names are guaranteed to return the
+ same result for the same input.
+
+ The returned short name has at most length 70.
- The returned short name has at most length 70.
-
=cut
sub get_unique_name ($$)
{
- my ($hostname, $hostnamehash) = @_;
-
- # Make sure that we where not called for this hostname before. Otherwise
the other test would be triggered.
- if (defined $hostnamehash->{$hostname})
- {
- installer::exiter::exit_program(
- "ERROR: get_unique_name was already called for hostname
".$hostname,
- "get_unique_name");
- }
- $hostnamehash->{$hostname} = 1;
-
- my $uniquename = $hostname;
-
- $uniquename =~ s/^\s*//g; # removing beginning
white spaces
- $uniquename =~ s/\s*$//g; # removing ending white
spaces
- $uniquename =~ s/\s//g; # removing
white spaces
- $uniquename =~ s/\_//g; # removing
existing underlines
- $uniquename =~ s/\.//g; # removing dots
in directoryname
- $uniquename =~ s/OpenOffice/OO/g;
-
- $uniquename =~ s/\Q$installer::globals::separator\E/\_/g; # replacing
slash and backslash with underline
-
- $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 $short_uniquename = make_short_dir_version($uniquename);
-
- return ($uniquename, $short_uniquename);
-}
+ my ($hostname, $hostnamehash) = @_;
+
+ # Make sure that we where not called for this hostname before.
Otherwise the other test would be triggered.
+ if (defined $hostnamehash->{$hostname})
+ {
+ installer::exiter::exit_program(
+ "ERROR: get_unique_name was already called for hostname
".$hostname,
+ "get_unique_name");
+ }
+ $hostnamehash->{$hostname} = 1;
+
+ my $uniquename = $hostname;
+
+ $uniquename =~ s/^\s*//g; # removing
beginning white spaces
+ $uniquename =~ s/\s*$//g; # removing
ending white spaces
+ $uniquename =~ s/\s//g; # removing
white spaces
+ $uniquename =~ s/\_//g; # removing
existing underlines
+ $uniquename =~ s/\.//g; # removing dots
in directoryname
+ $uniquename =~ s/OpenOffice/OO/g;
+ $uniquename =~ s/\Q$installer::globals::separator\E/\_/g; #
replacing slash and backslash with underline
+ $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 $short_uniquename = make_short_dir_version($uniquename);
+
+ return ($uniquename, $short_uniquename);
+}
=head2 check_unique_directorynames($directories)
- The one really important check is made in get_unique_name(). It
- checks that get_unique_name() is not called twice for the same
- directory host name. The tests in this function contain the
- legacy tests that basically only check if there where a collision
- of the partial MD5 sum that is used to make the short unique names
- unique.
-
- The maps $unique_map, $shortdirhash, $shortdirhashreverse are used
- only to check that _different_ input names are mapped to different
- results. They are not used to influence the result. That assumes
- that this function is called only once for every directory
- hostname.
+ The one really important check is made in get_unique_name(). It
+ checks that get_unique_name() is not called twice for the same
+ directory host name. The tests in this function contain the
+ legacy tests that basically only check if there where a collision
+ of the partial MD5 sum that is used to make the short unique names
+ unique.
+
+ The maps $unique_map, $shortdirhash, $shortdirhashreverse are used
+ only to check that _different_ input names are mapped to different
+ results. They are not used to influence the result. That assumes
+ that this function is called only once for every directory
+ hostname.
=cut
sub check_unique_directorynames ($)
{
- my ($directories) = @_;
+ my ($directories) = @_;
- my %completedirhashstep1 = ();
+ my %completedirhashstep1 = ();
my %shortdirhash = ();
my %shortdirhashreverse = ();
- # Check unique name of directories.
- foreach my $directory (@$directories)
- {
- my ($long_uniquename, $short_uniquename) =
($directory->{'long_uniquename'}, $directory->{'uniquename'});
-
- # The names after this small changes must still be unique!
- if (exists($completedirhashstep1{$long_uniquename}))
- {
- installer::exiter::exit_program(
- sprintf("ERROR: Unallowed modification of directory name, not
unique (step 1): \"%s\".",
- $short_uniquename),
- "check_unique_directorynames");
- }
- $completedirhashstep1{$long_uniquename} = 1;
-
-
- # Checking if the same directory already exists, but has another short
version.
- if (exists($shortdirhash{$long_uniquename})
- && ( $shortdirhash{$long_uniquename} ne $short_uniquename ))
- {
- installer::exiter::exit_program(
- sprintf(
- "ERROR: Unallowed modification of directory name, not
unique (step 2A): \"%s\".",
- $short_uniquename),
- "check_unique_directorynames");
- }
- $shortdirhash{$long_uniquename} = $short_uniquename;
-
- # Also checking vice versa
- # Checking if the same short directory already exists, but has another
long version.
- if (exists($shortdirhashreverse{$short_uniquename})
- && ( $shortdirhashreverse{$short_uniquename} ne $long_uniquename ))
- {
- installer::exiter::exit_program(
- sprintf(
- "ERROR: Unallowed modification of directory name, not
unique (step 2B): \"%s\".",
- $short_uniquename),
- "check_unique_directorynames");
- }
- $shortdirhashreverse{$short_uniquename} = $long_uniquename;
- }
-
- # Check unique name of parents
- foreach my $directory (@$directories)
- {
- my ($long_uniquename, $short_uniquename)
- = ($directory->{'long_uniqueparentname'},
$directory->{'uniqueparentname'});
-
- # Again checking if the same directory already exists, but has another
short version.
- if (exists($shortdirhash{$long_uniquename})
- && ( $shortdirhash{$long_uniquename} ne $short_uniquename ))
- {
- installer::exiter::exit_program(
- sprintf(
- "ERROR: Unallowed modification of directory name, not
unique (step 3A): \"%s\".",
- $short_uniquename),
- "check_unique_directorynames");
- }
- $shortdirhash{$long_uniquename} = $short_uniquename;
-
- # Also checking vice versa
- # Checking if the same short directory already exists, but has another
long version.
- if (exists($shortdirhashreverse{$short_uniquename})
- && ( $shortdirhashreverse{$short_uniquename} ne $long_uniquename ))
- {
- installer::exiter::exit_program(
- sprintf(
- "ERROR: Unallowed modification of directory name, not
unique (step 3B): \"%s\".",
- $short_uniquename),
- "check_unique_directorynames");
- }
- $shortdirhashreverse{$short_uniquename} = $long_uniquename;
- }
-}
+ # Check unique name of directories.
+ foreach my $directory (@$directories)
+ {
+ my ($long_uniquename, $short_uniquename) =
($directory->{'long_uniquename'}, $directory->{'uniquename'});
+
+ # The names after this small changes must still be unique!
+ if (exists($completedirhashstep1{$long_uniquename}))
+ {
+ installer::exiter::exit_program(
+ sprintf("ERROR: Unallowed modification of
directory name, not unique (step 1): \"%s\".",
+ $short_uniquename),
+ "check_unique_directorynames");
+ }
+ $completedirhashstep1{$long_uniquename} = 1;
+
+ # Checking if the same directory already exists, but has
another short version.
+ if (exists($shortdirhash{$long_uniquename})
+ && ( $shortdirhash{$long_uniquename} ne
$short_uniquename ))
+ {
+ installer::exiter::exit_program(
+ sprintf(
+ "ERROR: Unallowed modification of
directory name, not unique (step 2A): \"%s\".",
+ $short_uniquename),
+ "check_unique_directorynames");
+ }
+ $shortdirhash{$long_uniquename} = $short_uniquename;
+
+ # Also checking vice versa
+ # Checking if the same short directory already exists, but has
another long version.
+ if (exists($shortdirhashreverse{$short_uniquename})
+ && ( $shortdirhashreverse{$short_uniquename} ne
$long_uniquename ))
+ {
+ installer::exiter::exit_program(
+ sprintf(
+ "ERROR: Unallowed modification of
directory name, not unique (step 2B): \"%s\".",
+ $short_uniquename),
+ "check_unique_directorynames");
+ }
+ $shortdirhashreverse{$short_uniquename} = $long_uniquename;
+ }
+ # Check unique name of parents
+ foreach my $directory (@$directories)
+ {
+ my ($long_uniquename, $short_uniquename)
+ = ($directory->{'long_uniqueparentname'},
$directory->{'uniqueparentname'});
+ # Again checking if the same directory already exists, but has
another short version.
+ if (exists($shortdirhash{$long_uniquename})
+ && ( $shortdirhash{$long_uniquename} ne
$short_uniquename ))
+ {
+ installer::exiter::exit_program(
+ sprintf(
+ "ERROR: Unallowed modification of
directory name, not unique (step 3A): \"%s\".",
+ $short_uniquename),
+ "check_unique_directorynames");
+ }
+ $shortdirhash{$long_uniquename} = $short_uniquename;
+ # Also checking vice versa
+ # Checking if the same short directory already exists, but has
another long version.
+ if (exists($shortdirhashreverse{$short_uniquename})
+ && ( $shortdirhashreverse{$short_uniquename} ne
$long_uniquename ))
+ {
+ installer::exiter::exit_program(
+ sprintf(
+ "ERROR: Unallowed modification of
directory name, not unique (step 3B): \"%s\".",
+ $short_uniquename),
+ "check_unique_directorynames");
+ }
+ $shortdirhashreverse{$short_uniquename} = $long_uniquename;
+ }
+}
sub get_unique_parent_name ($$)
{
- my ($uniqueparentname, $styles) = @_;
-
- my $keepparent = 1;
-
- if ( $uniqueparentname =~ /^\s*(.*)\_(.*?)\s*$/ ) # the underline is now
the separator
- {
- $uniqueparentname = $1;
- $keepparent = 0;
- }
- else
- {
- $uniqueparentname = $installer::globals::programfilesfolder;
- $keepparent = 1;
- }
-
- if ( $styles =~ /\bPROGRAMFILESFOLDER\b/ )
- {
- $uniqueparentname = $installer::globals::programfilesfolder;
- $keepparent = 1;
- }
- if ( $styles =~ /\bCOMMONFILESFOLDER\b/ )
- {
- $uniqueparentname = $installer::globals::commonfilesfolder;
- $keepparent = 1;
- }
- if ( $styles =~ /\bCOMMONAPPDATAFOLDER\b/ )
- {
- $uniqueparentname = $installer::globals::commonappdatafolder;
- $keepparent = 1;
- }
- if ( $styles =~ /\bLOCALAPPDATAFOLDER\b/ )
- {
- $uniqueparentname = $installer::globals::localappdatafolder;
- $keepparent = 1;
- }
-
- if ( $styles =~ /\bSHAREPOINTPATH\b/ )
- {
- $uniqueparentname = "SHAREPOINTPATH";
- $installer::globals::usesharepointpath = 1;
- $keepparent = 1;
- }
-
- # also setting short directory name for the parent
-
- my $originaluniqueparentname = $uniqueparentname;
-
- if ( ! $keepparent )
- {
- $uniqueparentname = make_short_dir_version($uniqueparentname);
- }
-
- return ($originaluniqueparentname, $uniqueparentname);
-}
+ my ($uniqueparentname, $styles) = @_;
+
+ my $keepparent = 1;
+
+ if ( $uniqueparentname =~ /^\s*(.*)\_(.*?)\s*$/ ) # the underline is
now the separator
+ {
+ $uniqueparentname = $1;
+ $keepparent = 0;
+ }
+ else
+ {
+ $uniqueparentname = $installer::globals::programfilesfolder;
+ $keepparent = 1;
+ }
+
+ if ( $styles =~ /\bPROGRAMFILESFOLDER\b/ )
+ {
+ $uniqueparentname = $installer::globals::programfilesfolder;
+ $keepparent = 1;
+ }
+ if ( $styles =~ /\bCOMMONFILESFOLDER\b/ )
+ {
+ $uniqueparentname = $installer::globals::commonfilesfolder;
+ $keepparent = 1;
+ }
+ if ( $styles =~ /\bCOMMONAPPDATAFOLDER\b/ )
+ {
+ $uniqueparentname = $installer::globals::commonappdatafolder;
+ $keepparent = 1;
+ }
+ if ( $styles =~ /\bLOCALAPPDATAFOLDER\b/ )
+ {
+ $uniqueparentname = $installer::globals::localappdatafolder;
+ $keepparent = 1;
+ }
+ if ( $styles =~ /\bSHAREPOINTPATH\b/ )
+ {
+ $uniqueparentname = "SHAREPOINTPATH";
+ $installer::globals::usesharepointpath = 1;
+ $keepparent = 1;
+ }
+ # also setting short directory name for the parent
+ my $originaluniqueparentname = $uniqueparentname;
+
+ if ( ! $keepparent )
+ {
+ $uniqueparentname = make_short_dir_version($uniqueparentname);
+ }
+
+ return ($originaluniqueparentname, $uniqueparentname);
+}
##############################################################
# Adding unique directory names to the directory collection
@@ -358,61 +340,57 @@ sub create_unique_directorynames ($)
$installer::globals::officeinstalldirectoryset = 0;
- my %hostnamehash = ();
+ my %hostnamehash = ();
my $infoline = "";
my $errorcount = 0;
foreach my $directory (@$directories)
{
- next if defined $directory->{'uniquename'};
+ next if defined $directory->{'uniquename'};
- my $styles = $directory->{'Styles'};
- $styles = "" unless defined $styles;
+ my $styles = $directory->{'Styles'};
+ $styles = "" unless defined $styles;
my ($originaluniquename, $uniquename) = get_unique_name(
- $directory->{'HostName'},
- \%hostnamehash);
+ $directory->{'HostName'},
+ \%hostnamehash);
my ($originaluniqueparentname, $uniqueparentname) =
get_unique_parent_name(
- $originaluniquename,
- $styles);
+ $originaluniquename,
+ $styles);
-
# Hyphen not allowed in database
$uniquename =~ s/\-/\_/g; # making "-" to
"_"
$uniqueparentname =~ s/\-/\_/g; # making "-" to "_"
-
+
# And finally setting the values for the directories
$directory->{'uniquename'} = $uniquename;
$directory->{'uniqueparentname'} = $uniqueparentname;
$directory->{'long_uniquename'} = $originaluniquename;
$directory->{'long_uniqueparentname'} =
$originaluniqueparentname;
- }
+ }
+
+ # Find the installation directory.
+ foreach my $directory (@$directories)
+ {
+ next unless defined $directory->{'Styles'};
- # Find the installation directory.
- foreach my $directory (@$directories)
- {
- next unless defined $directory->{'Styles'};
-
# setting the installlocation directory
next unless $directory->{'Styles'} =~ /\bISINSTALLLOCATION\b/;
- if ( $installer::globals::installlocationdirectoryset )
- {
- installer::exiter::exit_program(
- sprintf(
- "ERROR: Directory with flag ISINSTALLLOCATION alread set:
\"%s\".",
- $installer::globals::installlocationdirectory),
- "create_unique_directorynames");
- }
-
- $installer::globals::installlocationdirectory =
$directory->{'uniquename'};
- $installer::globals::installlocationdirectoryset = 1;
- }
-}
-
-
+ if ( $installer::globals::installlocationdirectoryset )
+ {
+ installer::exiter::exit_program(
+ sprintf(
+ "ERROR: Directory with flag
ISINSTALLLOCATION alread set: \"%s\".",
+
$installer::globals::installlocationdirectory),
+ "create_unique_directorynames");
+ }
+ $installer::globals::installlocationdirectory =
$directory->{'uniquename'};
+ $installer::globals::installlocationdirectoryset = 1;
+ }
+}
#####################################################
# Adding ":." to selected default directory names
@@ -421,19 +399,19 @@ sub create_unique_directorynames ($)
sub update_defaultdir ($$)
{
my ( $onedir, $allvariableshashref ) = @_;
-
+
if ($installer::globals::addchildprojects
- || $installer::globals::patch
- || $installer::globals::languagepack
- || $allvariableshashref->{'CHANGETARGETDIR'})
+ || $installer::globals::patch
+ || $installer::globals::languagepack
+ || $allvariableshashref->{'CHANGETARGETDIR'})
{
my $sourcediraddon = "\:\.";
return $onedir->{'defaultdir'} . $sourcediraddon;
- }
+ }
else
- {
- return $onedir->{'defaultdir'};
- }
+ {
+ return $onedir->{'defaultdir'};
+ }
}
#####################################################
@@ -444,14 +422,14 @@ sub update_defaultdir ($$)
sub set_installlocation_directory
{
my ( $directoryref, $allvariableshashref ) = @_;
-
+
if ( ! $installer::globals::installlocationdirectoryset )
- {
- installer::exiter::exit_program(
- "ERROR: Directory with flag ISINSTALLLOCATION not set!",
- "set_installlocation_directory");
- }
-
+ {
+ installer::exiter::exit_program(
+ "ERROR: Directory with flag ISINSTALLLOCATION not set!",
+ "set_installlocation_directory");
+ }
+
for ( my $i = 0; $i <= $#{$directoryref}; $i++ )
{
my $onedir = ${$directoryref}[$i];
@@ -461,15 +439,15 @@ sub set_installlocation_directory
$onedir->{'uniquename'} = "INSTALLLOCATION";
$onedir->{'defaultdir'} = update_defaultdir($onedir,
$allvariableshashref);
}
-
+
if ( $onedir->{'uniquename'} eq
$installer::globals::vendordirectory )
{
- $onedir->{'defaultdir'} = update_defaultdir($onedir,
$allvariableshashref);
+ $onedir->{'defaultdir'} = update_defaultdir($onedir,
$allvariableshashref);
}
-
+
if ( $onedir->{'uniqueparentname'} eq
$installer::globals::installlocationdirectory )
{
- $onedir->{'uniqueparentname'} = "INSTALLLOCATION";
+ $onedir->{'uniqueparentname'} = "INSTALLLOCATION";
}
}
}
@@ -494,23 +472,23 @@ sub setup_global_font_directory_name ($)
my ($directories) = @_;
foreach my $directory (@$directories)
- {
- next unless defined $directory->{'Dir'};
- next unless defined $directory->{'defaultdir'};
-
- next if $directory->{'Dir'} ne "PREDEFINED_OSSYSTEMFONTDIR";
- next if $directory->{'defaultdir'} ne
$installer::globals::fontsdirhostname;
-
- $installer::globals::fontsdirname =
$installer::globals::fontsdirhostname;
- $installer::globals::fontsdirparent = $directory->{'uniqueparentname'};
-
- $installer::logger::Info->printf("%s, fdhn %s, dd %s, ipn %s, HN %s\n",
- "PREDEFINED_OSSYSTEMFONTDIR",
- $installer::globals::fontsdirhostname,
- $directory->{'defaultdir'},
- $directory->{'uniqueparentname'},
- $directory->{'HostName'});
- installer::scriptitems::print_script_item($directory);
+ {
+ next unless defined $directory->{'Dir'};
+ next unless defined $directory->{'defaultdir'};
+
+ next if $directory->{'Dir'} ne "PREDEFINED_OSSYSTEMFONTDIR";
+ next if $directory->{'defaultdir'} ne
$installer::globals::fontsdirhostname;
+
+ $installer::globals::fontsdirname =
$installer::globals::fontsdirhostname;
+ $installer::globals::fontsdirparent =
$directory->{'uniqueparentname'};
+
+ $installer::logger::Info->printf("%s, fdhn %s, dd %s, ipn %s,
HN %s\n",
+ "PREDEFINED_OSSYSTEMFONTDIR",
+ $installer::globals::fontsdirhostname,
+ $directory->{'defaultdir'},
+ $directory->{'uniqueparentname'},
+ $directory->{'HostName'});
+ installer::scriptitems::print_script_item($directory);
}
}
@@ -526,11 +504,11 @@ sub create_defaultdir_directorynames ($)
if ( $installer::globals::prepare_winpatch ) { @shortnames =
values(%installer::globals::saved83dirmapping); }
for ( my $i = 0; $i <= $#{$directoryref}; $i++ )
- {
+ {
my $onedir = ${$directoryref}[$i];
my $hostname = $onedir->{'HostName'};
- $hostname =~ s/\Q$installer::globals::separator\E\s*$//;
+ $hostname =~ s/\Q$installer::globals::separator\E\s*$//;
get_last_directory_name(\$hostname);
#
installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$hostname);
# making program/classes to classes
my $uniquename = $onedir->{'uniquename'};
@@ -566,23 +544,23 @@ sub create_defaultdir_directorynames ($)
sub create_directorytable_from_collection ($$)
{
my ($directorytableref, $directoryref) = @_;
-
+
foreach my $onedir (@$directoryref)
{
- # Remove entries for special directories.
+ # Remove entries for special directories.
if (defined $onedir->{'HostName'}
- && $onedir->{'HostName'} eq ""
- && defined $onedir->{'Dir'}
- && $onedir->{'Dir'} eq "PREDEFINED_PROGDIR")
- {
- next;
- }
-
+ && $onedir->{'HostName'} eq ""
+ && defined $onedir->{'Dir'}
+ && $onedir->{'Dir'} eq "PREDEFINED_PROGDIR")
+ {
+ next;
+ }
+
my $oneline = sprintf(
- "%s\t%s\t%s\n",
- $onedir->{'uniquename'},
- $onedir->{'uniqueparentname'},
- $onedir->{'defaultdir'});
+ "%s\t%s\t%s\n",
+ $onedir->{'uniquename'},
+ $onedir->{'uniqueparentname'},
+ $onedir->{'defaultdir'});
push @{$directorytableref}, $oneline;
}
@@ -595,7 +573,7 @@ sub create_directorytable_from_collection ($$)
sub process_root_directories ($$)
{
my ($allvariableshashref, $functor) = @_;
-
+
my $oneline = "";
if (( ! $installer::globals::patch ) && ( !
$installer::globals::languagepack ) && ( !
$allvariableshashref->{'DONTUSESTARTMENUFOLDER'} ))
@@ -606,42 +584,42 @@ sub process_root_directories ($$)
if (( $installer::globals::prepare_winpatch ) && (
$allvariableshashref->{'BASEPRODUCTVERSION'} ))
{
- $baseproductversion =
$allvariableshashref->{'BASEPRODUCTVERSION'}; # for example "2.0" for OOo
+ $baseproductversion =
$allvariableshashref->{'BASEPRODUCTVERSION'}; # for example "2.0" for OOo
}
-
+
my $realproductkey = $productname . " " . $productversion;
my $productkey = $productname . " " . $baseproductversion;
-
- if (( $allvariableshashref->{'POSTVERSIONEXTENSION'} ) && ( !
$allvariableshashref->{'DONTUSEEXTENSIONINDEFAULTDIR'} ))
+
+ if (( $allvariableshashref->{'POSTVERSIONEXTENSION'} ) && ( !
$allvariableshashref->{'DONTUSEEXTENSIONINDEFAULTDIR'} ))
{
- $productkey = $productkey . " " .
$allvariableshashref->{'POSTVERSIONEXTENSION'};
- $realproductkey = $realproductkey . " " .
$allvariableshashref->{'POSTVERSIONEXTENSION'};
+ $productkey = $productkey . " " .
$allvariableshashref->{'POSTVERSIONEXTENSION'};
+ $realproductkey = $realproductkey . " " .
$allvariableshashref->{'POSTVERSIONEXTENSION'};
}
- if ( $allvariableshashref->{'NOSPACEINDIRECTORYNAME'} )
+ if ( $allvariableshashref->{'NOSPACEINDIRECTORYNAME'} )
{
- $productkey =~ s/\ /\_/g;
- $realproductkey =~ s/\ /\_/g;
+ $productkey =~ s/\ /\_/g;
+ $realproductkey =~ s/\ /\_/g;
}
-
+
my $shortproductkey =
installer::windows::idtglobal::make_eight_three_conform($productkey, "dir",
undef);
- $shortproductkey =~ s/\s/\_/g;
# changing empty space to underline
+ $shortproductkey =~ s/\s/\_/g; # changing empty space to
underline
- &$functor(
- $installer::globals::officemenufolder,
- $installer::globals::programmenufolder,
- $shortproductkey . "|". $realproductkey);
+ &$functor(
+ $installer::globals::officemenufolder,
+ $installer::globals::programmenufolder,
+ $shortproductkey . "|". $realproductkey);
}
&$functor("TARGETDIR", "", "SourceDir");
&$functor($installer::globals::programfilesfolder, "TARGETDIR", ".");
- &$functor($installer::globals::programmenufolder, "TARGETDIR", ".");
- &$functor($installer::globals::startupfolder, "TARGETDIR", ".");
+ &$functor($installer::globals::programmenufolder, "TARGETDIR", ".");
+ &$functor($installer::globals::startupfolder, "TARGETDIR", ".");
&$functor($installer::globals::desktopfolder, "TARGETDIR", ".");
&$functor($installer::globals::startmenufolder, "TARGETDIR", ".");
&$functor($installer::globals::commonfilesfolder, "TARGETDIR", ".");
&$functor($installer::globals::commonappdatafolder, "TARGETDIR", ".");
&$functor($installer::globals::localappdatafolder, "TARGETDIR", ".");
-
+
if ( $installer::globals::usesharepointpath )
{
&$functor("SHAREPOINTPATH", "TARGETDIR", ".");
@@ -653,151 +631,142 @@ sub process_root_directories ($$)
my $directorytableentry = $localtemplatefoldername;
my $shorttemplatefoldername =
installer::windows::idtglobal::make_eight_three_conform($localtemplatefoldername,
"dir");
if ( $shorttemplatefoldername ne $localtemplatefoldername )
- {
- $directorytableentry = $shorttemplatefoldername . "|" .
$localtemplatefoldername;
- }
+ {
+ $directorytableentry = $shorttemplatefoldername . "|" .
$localtemplatefoldername;
+ }
&$functor($installer::globals::templatefolder, "TARGETDIR",
$directorytableentry);
if ( $installer::globals::fontsdirname )
{
&$functor(
- $installer::globals::fontsfolder,
- $installer::globals::fontsdirparent,
- $installer::globals::fontsfoldername . ":" .
$installer::globals::fontsdirname);
+ $installer::globals::fontsfolder,
+ $installer::globals::fontsdirparent,
+ $installer::globals::fontsfoldername . ":" .
$installer::globals::fontsdirname);
}
else
{
&$functor(
- $installer::globals::fontsfolder,
- "TARGETDIR",
- $installer::globals::fontsfoldername);
+ $installer::globals::fontsfolder,
+ "TARGETDIR",
+ $installer::globals::fontsfoldername);
}
}
+sub find_missing_directories ($$)
+{
+ my ($directories, $allvariableshashref) = @_;
+
+ # Set up the list of target directories.
+ my %target_directories = map {$_->{'uniquename'} => 1} @$directories;
+ # Add special directories.
+ process_root_directories(
+ $allvariableshashref,
+ sub($$$){
+ my ($uniquename, $parentname, $defaultdir) = @_;
+ $target_directories{$uniquename} = 1;
+ }
+ );
+ # Set up the list of source directories.
+ my $source_directory_map =
$installer::globals::source_msi->GetDirectoryMap();
+ my $source_file_map = $installer::globals::source_msi->GetFileMap();
+ my %source_directories = map {$_->{'unique_name'} => $_} values
%$source_directory_map;
+ # Find the missing source directories.
+ my @missing_directories = ();
+ foreach my $source_uniquename (keys %source_directories)
+ {
+ if ( ! $target_directories{$source_uniquename})
+ {
+ push @missing_directories,
$source_directories{$source_uniquename};
+ }
+ }
-sub find_missing_directories ($$)
-{
- my ($directories, $allvariableshashref) = @_;
-
- # Set up the list of target directories.
- my %target_directories = map {$_->{'uniquename'} => 1} @$directories;
- # Add special directories.
- process_root_directories(
- $allvariableshashref,
- sub($$$){
- my ($uniquename, $parentname, $defaultdir) = @_;
- $target_directories{$uniquename} = 1;
- }
- );
-
- # Set up the list of source directories.
- my $source_directory_map =
$installer::globals::source_msi->GetDirectoryMap();
- my $source_file_map = $installer::globals::source_msi->GetFileMap();
- my %source_directories = map {$_->{'unique_name'} => $_} values
%$source_directory_map;
-
- # Find the missing source directories.
- my @missing_directories = ();
- foreach my $source_uniquename (keys %source_directories)
- {
- if ( ! $target_directories{$source_uniquename})
- {
- push @missing_directories, $source_directories{$source_uniquename};
- }
- }
-
- # Report the missing directories.
- $installer::logger::Info->printf("found %d missing directories\n", scalar
@missing_directories);
- my $index = 0;
- foreach my $directory_item (@missing_directories)
- {
- # Print information about the directory.
- $installer::logger::Info->printf("missing directory %d: %s\n",
- ++$index,
- $directory_item->{'full_target_long_name'});
- while (my($key,$value) = each %$directory_item)
- {
- $installer::logger::Info->printf(" %s -> %s\n", $key, $value);
- }
-
- # Print the referencing files.
- my @filenames = ();
- while (my ($key,$value) = each %$source_file_map)
- {
- if ($value->{'directory'}->{'unique_name'} eq
$directory_item->{'unique_name'})
- {
- push @filenames, $key;
- }
- }
- $installer::logger::Info->printf(" referencing files are %s\n",
join(", ", @filenames));
- }
-
- foreach my $directory (@$directories)
- {
- $installer::logger::Lang->printf("target directory %s -> HN %s\n",
- $directory->{'uniquename'},
- $directory->{'HostName'});
- installer::scriptitems::print_script_item($directory);
- }
-
- # Setup a map of directory uniquenames to verify that the new
- # entries don't use unique names that are already in use.
- my %unique_names = map {$_->{'uniquename'} => $_} @$directories;
-
- # Create script items for the missing directories.
- my @new_source_directories = ();
- foreach my $source_directory_item (@missing_directories)
- {
- my $new_directory_item = {
- 'uniquename' => $source_directory_item->{'unique_name'},
- 'uniqueparentname' => $source_directory_item->{'parent_name'},
- 'defaultdir' => $source_directory_item->{'default_dir'},
- 'HostName' => $source_directory_item->{'full_target_long_name'},
- 'componentname' => $source_directory_item->{'component_name'},
- };
-
- if (defined $unique_names{$new_directory_item->{'uniquename'}})
- {
- installer::logger::PrintError("newly created directory entry
collides with existing directory");
- last;
- }
-
- push @new_source_directories, $new_directory_item;
- }
-
- return @new_source_directories;
-}
+ # Report the missing directories.
+ $installer::logger::Info->printf("found %d missing directories\n",
scalar @missing_directories);
+ my $index = 0;
+ foreach my $directory_item (@missing_directories)
+ {
+ # Print information about the directory.
+ $installer::logger::Info->printf("missing directory %d: %s\n",
+ ++$index,
+ $directory_item->{'full_target_long_name'});
+ while (my($key,$value) = each %$directory_item)
+ {
+ $installer::logger::Info->printf(" %s -> %s\n",
$key, $value);
+ }
+
+ # Print the referencing files.
+ my @filenames = ();
+ while (my ($key,$value) = each %$source_file_map)
+ {
+ if ($value->{'directory'}->{'unique_name'} eq
$directory_item->{'unique_name'})
+ {
+ push @filenames, $key;
+ }
+ }
+ $installer::logger::Info->printf(" referencing files are %s\n",
join(", ", @filenames));
+ }
+
+ foreach my $directory (@$directories)
+ {
+ $installer::logger::Lang->printf("target directory %s -> HN
%s\n",
+ $directory->{'uniquename'},
+ $directory->{'HostName'});
+ installer::scriptitems::print_script_item($directory);
+ }
+
+ # Setup a map of directory uniquenames to verify that the new
+ # entries don't use unique names that are already in use.
+ my %unique_names = map {$_->{'uniquename'} => $_} @$directories;
+ # Create script items for the missing directories.
+ my @new_source_directories = ();
+ foreach my $source_directory_item (@missing_directories)
+ {
+ my $new_directory_item = {
+ 'uniquename' => $source_directory_item->{'unique_name'},
+ 'uniqueparentname' =>
$source_directory_item->{'parent_name'},
+ 'defaultdir' => $source_directory_item->{'default_dir'},
+ 'HostName' =>
$source_directory_item->{'full_target_long_name'},
+ 'componentname' =>
$source_directory_item->{'component_name'},
+ };
+
+ if (defined $unique_names{$new_directory_item->{'uniquename'}})
+ {
+ installer::logger::PrintError("newly created directory
entry collides with existing directory");
+ last;
+ }
+ push @new_source_directories, $new_directory_item;
+ }
+ return @new_source_directories;
+}
sub prepare_directory_table_creation ($$)
{
my ($directories, $allvariableshashref) = @_;
- foreach my $directory (@$directories)
- {
- delete $directory->{'uniquename'};
- }
+ foreach my $directory (@$directories)
+ {
+ delete $directory->{'uniquename'};
+ }
overwrite_programfilesfolder($allvariableshashref);
create_unique_directorynames($directories);
- check_unique_directorynames($directories);
- create_defaultdir_directorynames($directories); # only destdir!
- setup_global_font_directory_name($directories);
+ check_unique_directorynames($directories);
+ create_defaultdir_directorynames($directories); # only destdir!
+ setup_global_font_directory_name($directories);
set_installlocation_directory($directories, $allvariableshashref);
- if ($installer::globals::is_release)
- {
- my @new_directories = find_missing_directories($directories,
$allvariableshashref);
- push @$directories, @new_directories;
- }
+ if ($installer::globals::is_release)
+ {
+ my @new_directories = find_missing_directories($directories,
$allvariableshashref);
+ push @$directories, @new_directories;
+ }
}
-
-
-
###############################################
# Creating the file Director.idt dynamically
###############################################
@@ -813,31 +782,30 @@ sub create_directory_table ($$$)
# DefaultDir is .:APPLIC~1|Application Data with
# Before ":" : [sourcedir]:[destdir] (not programmed yet)
# After ":" : 8+3 and not 8+3 the destination directory name
-
+
$installer::logger::Lang->add_timestamp("Performance Info: Directory
Table start");
my @directorytable = ();
installer::windows::idtglobal::write_idt_header(\@directorytable,
"directory");
- # Add entries for the root directories (and a few special directories like
that for fonts).
- process_root_directories(
- $allvariableshashref,
- sub($$$){
- push(@directorytable, join("\t", @_)."\n");
- }
- );
+ # Add entries for the root directories (and a few special directories
like that for fonts).
+ process_root_directories(
+ $allvariableshashref,
+ sub($$$){
+ push(@directorytable, join("\t", @_)."\n");
+ }
+ );
- # Add entries for the non-root directories.
+ # Add entries for the non-root directories.
create_directorytable_from_collection(\@directorytable, $directoryref);
# Saving the file
my $directorytablename = $basedir . $installer::globals::separator .
"Director.idt";
installer::files::save_file($directorytablename ,\@directorytable);
- $installer::logger::Lang->printf("Created idt file: %s\n",
$directorytablename);
+ $installer::logger::Lang->printf("Created idt file: %s\n",
$directorytablename);
$installer::logger::Lang->add_timestamp("Performance Info: Directory
Table end");
}
-
1;