Kaydet (Commit) ce86d339 authored tarafından Andre Fischer's avatar Andre Fischer

123729: More cleanup in make_installer.pl

üst c66c37e8
...@@ -1929,7 +1929,9 @@ for (;1;last) ...@@ -1929,7 +1929,9 @@ for (;1;last)
if ( $installer::globals::patch_user_dir ) if ( $installer::globals::patch_user_dir )
{ {
installer::scriptitems::replace_userdir_variable($profileitemsinproductlanguageresolvedarrayref); installer::scriptitems::replace_userdir_variable(
$profileitemsinproductlanguageresolvedarrayref,
$allvariableshashref);
} }
installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($profilesinproductlanguageresolvedarrayref, $dirsinproductarrayref); installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($profilesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
......
...@@ -305,18 +305,17 @@ sub make_path_conform ...@@ -305,18 +305,17 @@ sub make_path_conform
sub copy_collector sub copy_collector
{ {
my ( $oldcollector ) = @_; my ($oldcollector) = @_;
my @newcollector = (); my @newcollector = ();
for ( my $i = 0; $i <= $#{$oldcollector}; $i++ ) foreach my $oldhash (@$oldcollector)
{ {
my %newhash = (); my %newhash = ();
my $key;
foreach $key (keys %{${$oldcollector}[$i]}) while (my ($key, $value) = each %$oldhash)
{ {
$newhash{$key} = ${$oldcollector}[$i]->{$key}; $newhash{$key} = $value;
} }
push(@newcollector, \%newhash); push(@newcollector, \%newhash);
......
...@@ -46,6 +46,14 @@ sub get_path_from_fullqualifiedname ...@@ -46,6 +46,14 @@ sub get_path_from_fullqualifiedname
} }
} }
=head2
Despite its name, this function seems just to return the basename of the given filename.
=cut
sub make_absolute_filename_to_relative_filename sub make_absolute_filename_to_relative_filename
{ {
my ($longfilenameref) = @_; my ($longfilenameref) = @_;
......
...@@ -100,31 +100,10 @@ sub replace_productname_in_file ...@@ -100,31 +100,10 @@ sub replace_productname_in_file
change_length_of_string(\$unicode_productname, $replacestring); change_length_of_string(\$unicode_productname, $replacestring);
my $found1 = $onefile =~ s/$replacestring/$unicode_productname/sg; my $found = $onefile =~ s/$replacestring/$unicode_productname/sg;
my $found2 = 0;
if ( $styles =~ /\bPATCH_SO_NAME_Z\b/ )
{
# searching for "z"
$onestring = "z" . chr(0);
$replacestring = "";
for ( my $i = 1; $i <= 80; $i++ ) { $replacestring .= $onestring; }
my $productname2 = $variableshashref->{'PRODUCTNAME'} . " " . $variableshashref->{'PRODUCTVERSION'};
if ( exists($onefilehash->{'FileDescriptionZ'}) ) { $productname2 = $onefilehash->{'FileDescriptionZ'}; }
my $unicode_productname2 = convert_to_unicode($productname2);
change_length_of_string_with_letter(\$unicode_productname2, $replacestring, $onestring);
$found2 = $onefile =~ s/$replacestring/$unicode_productname2/sg;
}
installer::files::save_binary_file($onefile, $destpath); installer::files::save_binary_file($onefile, $destpath);
my $found = $found1 + $found2;
return $found; return $found;
} }
......
...@@ -29,29 +29,35 @@ use installer::logger; ...@@ -29,29 +29,35 @@ use installer::logger;
use installer::pathanalyzer; use installer::pathanalyzer;
use installer::systemactions; use installer::systemactions;
use strict;
######################################################################################## ########################################################################################
# Replacing all zip list variables in setup script and files with flag scpzip_replace # Replacing all zip list variables in setup script and files with flag scpzip_replace
######################################################################################## ########################################################################################
sub replace_all_ziplistvariables_in_file sub replace_all_ziplistvariables_in_file ($$)
{ {
my ( $fileref, $variableshashref ) = @_; my ($lines, $variables) = @_;
for ( my $i = 0; $i <= $#{$fileref}; $i++ ) my $count = scalar @$lines;
for (my $lineno=0; $lineno<$count; ++$lineno)
{ {
my $line = ${$fileref}[$i]; my $line = $lines->[$lineno];
if ($line =~ /\$\{/) # early rejection of lines that don't need replacements
if ( $line =~ /^.*\$\{\w+\}.*$/ ) # only occurence of ${abc}
{ {
my $key; while (my ($key,$value) = each %$variables)
foreach $key (keys %{$variableshashref})
{ {
my $value = $variableshashref->{$key}; my $pattern = '${' . $key . '}';
$key = '${' . $key . '}'; my $replacement_count = ($line =~ s/\Q$pattern\E/$value/g);
$line =~ s/\Q$key\E/$value/g; if ($key eq "PRODUCTADDON" && $replacement_count>0)
${$fileref}[$i] = $line; {
$installer::logger::Lang->printf(
"replaced PRODUCTADDON %d times in line %d\n",
$replacement_count,
$lineno);
}
} }
$lines->[$lineno] = $line;
} }
} }
} }
...@@ -63,7 +69,7 @@ sub replace_all_ziplistvariables_in_file ...@@ -63,7 +69,7 @@ sub replace_all_ziplistvariables_in_file
sub replace_all_ziplistvariables_in_rtffile ($$) sub replace_all_ziplistvariables_in_rtffile ($$)
{ {
my ($lines, $variablesref) = @_; my ($lines, $variables) = @_;
my $line_count = scalar @$lines; my $line_count = scalar @$lines;
for (my $i=0; $i<=$line_count; ++$i) for (my $i=0; $i<=$line_count; ++$i)
......
...@@ -31,6 +31,8 @@ use installer::remover; ...@@ -31,6 +31,8 @@ use installer::remover;
use installer::scriptitems; use installer::scriptitems;
use installer::ziplist; use installer::ziplist;
use strict;
####################################################### #######################################################
# Set setup script name, if not defined as parameter # Set setup script name, if not defined as parameter
####################################################### #######################################################
...@@ -74,9 +76,9 @@ sub set_setupscript_name ...@@ -74,9 +76,9 @@ sub set_setupscript_name
# Reading script variables from installation object of script file # Reading script variables from installation object of script file
##################################################################### #####################################################################
sub get_all_scriptvariables_from_installation_object sub get_all_scriptvariables_from_installation_object ($$)
{ {
my ($scriptref) = @_; my ($scriptref, $script_filename) = @_;
my @installobjectvariables; my @installobjectvariables;
...@@ -521,13 +523,9 @@ sub replace_preset_properties ...@@ -521,13 +523,9 @@ sub replace_preset_properties
my @presetproperties = (); my @presetproperties = ();
push(@presetproperties, "SOLARISBRANDPACKAGENAME"); push(@presetproperties, "SOLARISBRANDPACKAGENAME");
push(@presetproperties, "SYSTEMINTUNIXPACKAGENAME"); push(@presetproperties, "SYSTEMINTUNIXPACKAGENAME");
# push(@presetproperties, "UNIXPACKAGENAME");
# push(@presetproperties, "WITHOUTDOTUNIXPACKAGENAME");
# push(@presetproperties, "UNIXPRODUCTNAME");
# push(@presetproperties, "WITHOUTDOTUNIXPRODUCTNAME");
foreach $property ( @presetproperties ) foreach my $property (@presetproperties)
{ {
my $presetproperty = "PRESET" . $property; my $presetproperty = "PRESET" . $property;
if (( exists($allvariables->{$presetproperty}) ) && ( $allvariables->{$presetproperty} ne "" )) if (( exists($allvariables->{$presetproperty}) ) && ( $allvariables->{$presetproperty} ne "" ))
......
...@@ -28,6 +28,8 @@ use installer::globals; ...@@ -28,6 +28,8 @@ use installer::globals;
use installer::worker; use installer::worker;
use installer::windows::idtglobal; use installer::windows::idtglobal;
use strict;
############################################################## ##############################################################
# Returning the first module of a file from the # Returning the first module of a file from the
# comma separated list of modules. # comma separated list of modules.
...@@ -224,9 +226,9 @@ sub create_msiassembly_table ...@@ -224,9 +226,9 @@ sub create_msiassembly_table
# Returning the name for the table MsiAssemblyName # Returning the name for the table MsiAssemblyName
#################################################################################### ####################################################################################
sub get_msiassemblyname_name sub get_msiassemblyname_name ($)
{ {
( $number ) = @_; my ($number) = @_;
my $name = ""; my $name = "";
...@@ -315,12 +317,9 @@ sub add_assembly_condition_into_component_table ...@@ -315,12 +317,9 @@ sub add_assembly_condition_into_component_table
my $componenttablename = $basedir . $installer::globals::separator . "Componen.idt"; my $componenttablename = $basedir . $installer::globals::separator . "Componen.idt";
my $componenttable = installer::files::read_file($componenttablename); my $componenttable = installer::files::read_file($componenttablename);
my $changed = 0; my $changed = 0;
my $infoline = "";
for ( my $i = 0; $i <= $#{$installer::globals::msiassemblyfiles}; $i++ ) foreach my $onefile (@$installer::globals::msiassemblyfiles)
{ {
my $onefile = ${$installer::globals::msiassemblyfiles}[$i];
my $filecomponent = get_msiassembly_component($onefile); my $filecomponent = get_msiassembly_component($onefile);
for ( my $j = 0; $j <= $#{$componenttable}; $j++ ) for ( my $j = 0; $j <= $#{$componenttable}; $j++ )
...@@ -342,13 +341,17 @@ sub add_assembly_condition_into_component_table ...@@ -342,13 +341,17 @@ sub add_assembly_condition_into_component_table
# $condition = "MsiNetAssemblySupport"; # $condition = "MsiNetAssemblySupport";
$condition = "DOTNET_SUFFICIENT=1"; $condition = "DOTNET_SUFFICIENT=1";
$oneline = $component . "\t" . $componentid . "\t" . $directory . "\t" . $attributes . "\t" . $condition . "\t" . $keypath . "\n"; $oneline = join("\t",
$component,
$componentid,
$directory,
$attributes,
$condition,
$keypath) . "\n";
${$componenttable}[$j] = $oneline; ${$componenttable}[$j] = $oneline;
$changed = 1; $changed = 1;
$infoline = "Changing $componenttablename :\n"; $installer::logger::Lang->print("Changing %s :\n", $componenttablename);
$installer::logger::Lang->print($infoline); $installer::logger::Lang->print($oneline);
$infoline = $oneline;
$installer::logger::Lang->print($infoline);
last; last;
} }
} }
...@@ -359,8 +362,7 @@ sub add_assembly_condition_into_component_table ...@@ -359,8 +362,7 @@ sub add_assembly_condition_into_component_table
{ {
# Saving the file # Saving the file
installer::files::save_file($componenttablename ,$componenttable); installer::files::save_file($componenttablename ,$componenttable);
$infoline = "Saved idt file: $componenttablename\n"; $installer::logger::Lang->print("Saved idt file: %s\n", $componenttablename);
$installer::logger::Lang->print($infoline);
} }
} }
......
...@@ -49,6 +49,9 @@ sub get_component_guid ($) ...@@ -49,6 +49,9 @@ sub get_component_guid ($)
# Returning a ComponentID, that is assigned in scp project # Returning a ComponentID, that is assigned in scp project
if ( exists($installer::globals::componentid{$componentname}) ) if ( exists($installer::globals::componentid{$componentname}) )
{ {
$installer::logger::Lang->printf("reusing guid %s for component %s\n",
$installer::globals::componentid{$componentname},
$componentname);
$returnvalue = "\{" . $installer::globals::componentid{$componentname} . "\}"; $returnvalue = "\{" . $installer::globals::componentid{$componentname} . "\}";
} }
...@@ -59,51 +62,49 @@ sub get_component_guid ($) ...@@ -59,51 +62,49 @@ sub get_component_guid ($)
# Returning the directory for a file component. # Returning the directory for a file component.
############################################################## ##############################################################
sub get_file_component_directory sub get_file_component_directory ($$$)
{ {
my ($componentname, $filesref, $dirref) = @_; my ($componentname, $filesref, $dirref) = @_;
my ($onefile, $component, $onedir, $hostname, $uniquedir); my ($component, $uniquedir);
my $found = 0; my $found = 0;
for ( my $i = 0; $i <= $#{$filesref}; $i++ ) foreach my $onefile (@$filesref)
{ {
$onefile = ${$filesref}[$i]; if ($onefile->{'componentname'} eq $componentname)
$component = $onefile->{'componentname'};
if ( $component eq $componentname )
{ {
$found = 1; return get_file_component_directory_for_file($onefile, $dirref);
last;
} }
} }
if (!($found))
{
# This component can be ignored, if it exists in a version with extension "_pff" (this was renamed in file::get_sequence_for_file() )
my $ignore_this_component = 0;
my $origcomponentname = $componentname;
my $componentname = $componentname . "_pff";
for ( my $j = 0; $j <= $#{$filesref}; $j++ ) # This component can be ignored, if it exists in a version with
{ # extension "_pff" (this was renamed in file::get_sequence_for_file() )
$onefile = ${$filesref}[$j]; my $ignore_this_component = 0;
$component = $onefile->{'componentname'}; my $origcomponentname = $componentname;
my $componentname_pff = $componentname . "_pff";
if ( $component eq $componentname ) foreach my $onefile (@$filesref)
{ {
$ignore_this_component = 1; if ($onefile->{'componentname'} eq $componentname_pff)
last; {
} return "IGNORE_COMP";
} }
if ( $ignore_this_component ) { return "IGNORE_COMP"; }
else { installer::exiter::exit_program("ERROR: Did not find component \"$origcomponentname\" in file collection", "get_file_component_directory"); }
} }
my $localstyles = ""; installer::exiter::exit_program(
"ERROR: Did not find component \"$origcomponentname\" in file collection",
"get_file_component_directory");
}
if ( $onefile->{'Styles'} ) { $localstyles = $onefile->{'Styles'}; }
sub get_file_component_directory_for_file ($$)
{
my ($onefile, $dirref) = @_;
my $localstyles = $onefile->{'Styles'} // "";
if ( $localstyles =~ /\bFONT\b/ ) # special handling for font files if ( $localstyles =~ /\bFONT\b/ ) # special handling for font files
{ {
...@@ -127,6 +128,7 @@ sub get_file_component_directory ...@@ -127,6 +128,7 @@ sub get_file_component_directory
# This path has to be defined in the directory collection at "HostName" # This path has to be defined in the directory collection at "HostName"
my $uniquedir = undef;
if ($destination eq "") # files in the installation root if ($destination eq "") # files in the installation root
{ {
$uniquedir = "INSTALLLOCATION"; $uniquedir = "INSTALLLOCATION";
...@@ -135,24 +137,23 @@ sub get_file_component_directory ...@@ -135,24 +137,23 @@ sub get_file_component_directory
{ {
$found = 0; $found = 0;
for ( my $i = 0; $i <= $#{$dirref}; $i++ ) foreach my $directory (@$dirref)
{ {
$onedir = ${$dirref}[$i]; if ($directory->{'HostName'} eq $destination )
$hostname = $onedir->{'HostName'};
if ( $hostname eq $destination )
{ {
$found = 1; $found = 1;
$uniquedir = $directory->{'uniquename'};
last; last;
} }
} }
if (!($found)) if ( ! $found)
{ {
installer::exiter::exit_program("ERROR: Did not find destination $destination in directory collection", "get_file_component_directory"); installer::exiter::exit_program(
"ERROR: Did not find destination $destination in directory collection",
"get_file_component_directory");
} }
$uniquedir = $onedir->{'uniquename'};
if ( $uniquedir eq $installer::globals::officeinstalldirectory ) if ( $uniquedir eq $installer::globals::officeinstalldirectory )
{ {
...@@ -226,7 +227,8 @@ sub get_file_component_attributes ...@@ -226,7 +227,8 @@ sub get_file_component_attributes
$attributes = 0; # Assembly files cannot run from source $attributes = 0; # Assembly files cannot run from source
} }
if (( $onefile->{'Dir'} =~ /\bPREDEFINED_OSSHELLNEWDIR\b/ ) || ( $onefile->{'needs_user_registry_key'} )) if ((defined $onefile->{'Dir'} && $onefile->{'Dir'} =~ /\bPREDEFINED_OSSHELLNEWDIR\b/)
|| $onefile->{'needs_user_registry_key'})
{ {
$attributes = 4; # Files in shellnew dir and in non advertised startmenu entries must have user registry key as KeyPath $attributes = 4; # Files in shellnew dir and in non advertised startmenu entries must have user registry key as KeyPath
} }
...@@ -324,37 +326,47 @@ sub get_component_keypath ($$) ...@@ -324,37 +326,47 @@ sub get_component_keypath ($$)
{ {
my ($componentname, $itemsref) = @_; my ($componentname, $itemsref) = @_;
my $oneitem;
my $found = 0; my $found = 0;
my $infoline = ""; my $infoline = "";
for ( my $i = 0; $i <= $#{$itemsref}; $i++ ) foreach my $oneitem (@$itemsref)
{ {
$oneitem = ${$itemsref}[$i];
my $component = $oneitem->{'componentname'}; my $component = $oneitem->{'componentname'};
if ( $component eq $componentname ) if ( ! defined $component)
{ {
$found = 1; installer::scriptitems::print_script_item($oneitem);
last; installer::logger::PrintError("item in get_component_keypath has no 'componentname'\n");
return "";
} }
} if ( $component eq $componentname )
{
my $keypath = $oneitem->{'uniquename'}; # "uniquename", not "Name"
if (!($found)) # Special handling for components in
{ # PREDEFINED_OSSHELLNEWDIR. These components need as
installer::exiter::exit_program("ERROR: Did not find component in file/registry collection, function get_component_keypath", "get_component_keypath"); # KeyPath a RegistryItem in HKCU
} if ($oneitem->{'userregkeypath'})
{
$keypath = $oneitem->{'userregkeypath'};
}
my $keypath = $oneitem->{'uniquename'}; # "uniquename", not "Name" # saving it in the file and registry collection
$oneitem->{'keypath'} = $keypath;
# Special handling for components in PREDEFINED_OSSHELLNEWDIR. These components return $keypath
# need as KeyPath a RegistryItem in HKCU }
if ( $oneitem->{'userregkeypath'} ) { $keypath = $oneitem->{'userregkeypath'}; }
# saving it in the file and registry collection if ($oneitem->{'componentname'} eq $componentname)
$oneitem->{'keypath'} = $keypath; {
$found = 1;
last;
}
}
return $keypath installer::exiter::exit_program(
"ERROR: Did not find component in file/registry collection, function get_component_keypath",
"get_component_keypath");
} }
################################################################### ###################################################################
......
...@@ -733,9 +733,11 @@ sub remove_all_items_with_special_flag ...@@ -733,9 +733,11 @@ sub remove_all_items_with_special_flag
if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'} }; if ( $oneitem->{'Styles'} ) { $styles = $oneitem->{'Styles'} };
if ( $styles =~ /\b$flag\b/ ) if ( $styles =~ /\b$flag\b/ )
{ {
my $infoline = "Attention: Removing from collector: $oneitem->{'Name'} !\n"; $installer::logger::Lang->printf("Attention: Removing from collector: %s\n", $oneitem->{'Name'});
$installer::logger::Lang->print($infoline); if ($flag eq "BINARYTABLE_ONLY")
if ( $flag eq "BINARYTABLE_ONLY" ) { push(@installer::globals::binarytableonlyfiles, $oneitem); } {
push(@installer::globals::binarytableonlyfiles, $oneitem);
}
next; next;
} }
push( @allitems, $oneitem ); push( @allitems, $oneitem );
...@@ -2377,7 +2379,6 @@ sub collect_all_files_from_includepathes ...@@ -2377,7 +2379,6 @@ sub collect_all_files_from_includepathes
my @sourcefiles = (); my @sourcefiles = ();
my $pathstring = ""; my $pathstring = "";
# installer::systemactions::read_complete_directory($includepath, $pathstring, \@sourcefiles);
installer::systemactions::read_full_directory($includepath, $pathstring, \@sourcefiles); installer::systemactions::read_full_directory($includepath, $pathstring, \@sourcefiles);
if ( ! ( $#sourcefiles > -1 )) if ( ! ( $#sourcefiles > -1 ))
...@@ -2711,8 +2712,8 @@ sub generate_cygwin_pathes ...@@ -2711,8 +2712,8 @@ sub generate_cygwin_pathes
for ( my $i = 0; $i <= $#{$filesref}; $i++ ) for ( my $i = 0; $i <= $#{$filesref}; $i++ )
{ {
my $line = ${$filesref}[$i]->{'sourcepath'} . "\n"; my $filename = ${$filesref}[$i]->{'sourcepath'};
push(@pathcollector, $line); push(@pathcollector, $filename . "\n");
$counter++; $counter++;
if (( $i == $#{$filesref} ) || ((( $counter % $max ) == 0 ) && ( $i > 0 ))) if (( $i == $#{$filesref} ) || ((( $counter % $max ) == 0 ) && ( $i > 0 )))
...@@ -2728,6 +2729,9 @@ sub generate_cygwin_pathes ...@@ -2728,6 +2729,9 @@ sub generate_cygwin_pathes
installer::files::save_file($tmpfilename, \@pathcollector); installer::files::save_file($tmpfilename, \@pathcollector);
my $success = 0; my $success = 0;
$installer::logger::Lang->printf(
"Converting %d filenames to cygwin notation\n",
$counter);
my @cyg_sourcepathlist = qx{cygpath -w -f "$tmpfilename"}; my @cyg_sourcepathlist = qx{cygpath -w -f "$tmpfilename"};
chomp @cyg_sourcepathlist; chomp @cyg_sourcepathlist;
...@@ -2737,14 +2741,19 @@ sub generate_cygwin_pathes ...@@ -2737,14 +2741,19 @@ sub generate_cygwin_pathes
if ($success) if ($success)
{ {
$infoline = "Success: Successfully converted to cygwin pathes!\n"; $installer::logger::Lang->printf(
$installer::logger::Lang->print($infoline); "Successfully converted %d paths to cygwin notation\n",
$counter);
$installer::logger::Lang->printf(
"there where %d unique paths\n",
scalar keys %paths);
} }
else else
{ {
$infoline = "ERROR: Failed to convert to cygwin pathes!\n"; $installer::logger::Lang->print("ERROR: Failed to convert to cygwin pathes!\n");
$installer::logger::Lang->print($infoline); installer::exiter::exit_program(
installer::exiter::exit_program("ERROR: Failed to convert to cygwin pathes!", "generate_cygwin_pathes"); "ERROR: Failed to convert to cygwin pathes!",
"generate_cygwin_pathes");
} }
for ( my $j = 0; $j <= $#cyg_sourcepathlist; $j++ ) for ( my $j = 0; $j <= $#cyg_sourcepathlist; $j++ )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment