component.pm (dca4887f) | component.pm (dba1a2e4) |
---|---|
1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance --- 35 unchanged lines hidden (view full) --- 44 my ($componentname) = @_; 45 46 # At this time only a template 47 my $returnvalue = "\{COMPONENTGUID\}"; 48 49 # Returning a ComponentID, that is assigned in scp project 50 if ( exists($installer::globals::componentid{$componentname}) ) 51 { | 1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance --- 35 unchanged lines hidden (view full) --- 44 my ($componentname) = @_; 45 46 # At this time only a template 47 my $returnvalue = "\{COMPONENTGUID\}"; 48 49 # Returning a ComponentID, that is assigned in scp project 50 if ( exists($installer::globals::componentid{$componentname}) ) 51 { |
52 $installer::logger::Lang->printf("reusing guid %s for component %s\n", 53 $installer::globals::componentid{$componentname}, 54 $componentname); |
|
52 $returnvalue = "\{" . $installer::globals::componentid{$componentname} . "\}"; 53 } 54 55 return $returnvalue; 56} 57 58############################################################## 59# Returning the directory for a file component. 60############################################################## 61 | 55 $returnvalue = "\{" . $installer::globals::componentid{$componentname} . "\}"; 56 } 57 58 return $returnvalue; 59} 60 61############################################################## 62# Returning the directory for a file component. 63############################################################## 64 |
62sub get_file_component_directory | 65sub get_file_component_directory ($$$) |
63{ 64 my ($componentname, $filesref, $dirref) = @_; 65 | 66{ 67 my ($componentname, $filesref, $dirref) = @_; 68 |
66 my ($onefile, $component, $onedir, $hostname, $uniquedir); | 69 my ($component, $uniquedir); |
67 my $found = 0; 68 | 70 my $found = 0; 71 |
69 for ( my $i = 0; $i <= $#{$filesref}; $i++ ) | 72 foreach my $onefile (@$filesref) |
70 { | 73 { |
71 $onefile = ${$filesref}[$i]; 72 $component = $onefile->{'componentname'}; 73 74 if ( $component eq $componentname ) | 74 if ($onefile->{'componentname'} eq $componentname) |
75 { | 75 { |
76 $found = 1; 77 last; 78 } | 76 return get_file_component_directory_for_file($onefile, $dirref); 77 } |
79 } 80 | 78 } 79 |
81 if (!($found)) 82 { 83 # This component can be ignored, if it exists in a version with extension "_pff" (this was renamed in file::get_sequence_for_file() ) 84 my $ignore_this_component = 0; 85 my $origcomponentname = $componentname; 86 my $componentname = $componentname . "_pff"; | 80 81 # This component can be ignored, if it exists in a version with 82 # extension "_pff" (this was renamed in file::get_sequence_for_file() ) 83 my $ignore_this_component = 0; 84 my $origcomponentname = $componentname; 85 my $componentname_pff = $componentname . "_pff"; |
87 | 86 |
88 for ( my $j = 0; $j <= $#{$filesref}; $j++ ) 89 { 90 $onefile = ${$filesref}[$j]; 91 $component = $onefile->{'componentname'}; | 87 foreach my $onefile (@$filesref) 88 { 89 if ($onefile->{'componentname'} eq $componentname_pff) 90 { 91 return "IGNORE_COMP"; 92 } 93 } |
92 | 94 |
93 if ( $component eq $componentname ) 94 { 95 $ignore_this_component = 1; 96 last; 97 } 98 } 99 100 if ( $ignore_this_component ) { return "IGNORE_COMP"; } 101 else { installer::exiter::exit_program("ERROR: Did not find component \"$origcomponentname\" in file collection", "get_file_component_directory"); } 102 } | 95 installer::exiter::exit_program( 96 "ERROR: Did not find component \"$origcomponentname\" in file collection", 97 "get_file_component_directory"); 98} |
103 | 99 |
104 my $localstyles = ""; 105 106 if ( $onefile->{'Styles'} ) { $localstyles = $onefile->{'Styles'}; } | |
107 | 100 |
101 102 103sub get_file_component_directory_for_file ($$) 104{ 105 my ($onefile, $dirref) = @_; 106 107 my $localstyles = $onefile->{'Styles'} // ""; 108 |
|
108 if ( $localstyles =~ /\bFONT\b/ ) # special handling for font files 109 { 110 return $installer::globals::fontsfolder; 111 } 112 113 my $destdir = ""; 114 115 if ( $onefile->{'Dir'} ) { $destdir = $onefile->{'Dir'}; } --- 5 unchanged lines hidden (view full) --- 121 122 my $destination = $onefile->{'destination'}; 123 124 installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination); 125 126 $destination =~ s/\Q$installer::globals::separator\E\s*$//; 127 128 # This path has to be defined in the directory collection at "HostName" | 109 if ( $localstyles =~ /\bFONT\b/ ) # special handling for font files 110 { 111 return $installer::globals::fontsfolder; 112 } 113 114 my $destdir = ""; 115 116 if ( $onefile->{'Dir'} ) { $destdir = $onefile->{'Dir'}; } --- 5 unchanged lines hidden (view full) --- 122 123 my $destination = $onefile->{'destination'}; 124 125 installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination); 126 127 $destination =~ s/\Q$installer::globals::separator\E\s*$//; 128 129 # This path has to be defined in the directory collection at "HostName" |
129 | 130 131 my $uniquedir = undef; |
130 if ($destination eq "") # files in the installation root 131 { 132 $uniquedir = "INSTALLLOCATION"; 133 } 134 else 135 { 136 $found = 0; 137 | 132 if ($destination eq "") # files in the installation root 133 { 134 $uniquedir = "INSTALLLOCATION"; 135 } 136 else 137 { 138 $found = 0; 139 |
138 for ( my $i = 0; $i <= $#{$dirref}; $i++ ) | 140 foreach my $directory (@$dirref) |
139 { | 141 { |
140 $onedir = ${$dirref}[$i]; 141 $hostname = $onedir->{'HostName'}; 142 143 if ( $hostname eq $destination ) | 142 if ($directory->{'HostName'} eq $destination ) |
144 { 145 $found = 1; | 143 { 144 $found = 1; |
145 $uniquedir = $directory->{'uniquename'}; |
|
146 last; 147 } 148 } 149 | 146 last; 147 } 148 } 149 |
150 if (!($found)) | 150 if ( ! $found) |
151 { | 151 { |
152 installer::exiter::exit_program("ERROR: Did not find destination $destination in directory collection", "get_file_component_directory"); | 152 installer::exiter::exit_program( 153 "ERROR: Did not find destination $destination in directory collection", 154 "get_file_component_directory"); |
153 } 154 | 155 } 156 |
155 $uniquedir = $onedir->{'uniquename'}; | |
156 157 if ( $uniquedir eq $installer::globals::officeinstalldirectory ) 158 { 159 $uniquedir = "INSTALLLOCATION"; 160 } 161 } 162 163 $onefile->{'uniquedirname'} = $uniquedir; # saving it in the file collection --- 57 unchanged lines hidden (view full) --- 221 $attributes = 8; # font files will be deinstalled if the ref count is 0 222 } 223 224 if ( $localstyles =~ /\bASSEMBLY\b/ ) 225 { 226 $attributes = 0; # Assembly files cannot run from source 227 } 228 | 157 158 if ( $uniquedir eq $installer::globals::officeinstalldirectory ) 159 { 160 $uniquedir = "INSTALLLOCATION"; 161 } 162 } 163 164 $onefile->{'uniquedirname'} = $uniquedir; # saving it in the file collection --- 57 unchanged lines hidden (view full) --- 222 $attributes = 8; # font files will be deinstalled if the ref count is 0 223 } 224 225 if ( $localstyles =~ /\bASSEMBLY\b/ ) 226 { 227 $attributes = 0; # Assembly files cannot run from source 228 } 229 |
229 if (( $onefile->{'Dir'} =~ /\bPREDEFINED_OSSHELLNEWDIR\b/ ) || ( $onefile->{'needs_user_registry_key'} )) | 230 if ((defined $onefile->{'Dir'} && $onefile->{'Dir'} =~ /\bPREDEFINED_OSSHELLNEWDIR\b/) 231 || $onefile->{'needs_user_registry_key'}) |
230 { 231 $attributes = 4; # Files in shellnew dir and in non advertised startmenu entries must have user registry key as KeyPath 232 } 233 234 # Adding 256, if this is a 64 bit installation set. 235 if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $attributes = $attributes + 256; } 236 237 return $attributes --- 81 unchanged lines hidden (view full) --- 319# Attention: This has to be the unique (file)name, not the 320# real filename! 321#################################################################### 322 323sub get_component_keypath ($$) 324{ 325 my ($componentname, $itemsref) = @_; 326 | 232 { 233 $attributes = 4; # Files in shellnew dir and in non advertised startmenu entries must have user registry key as KeyPath 234 } 235 236 # Adding 256, if this is a 64 bit installation set. 237 if (( $allvariables->{'64BITPRODUCT'} ) && ( $allvariables->{'64BITPRODUCT'} == 1 )) { $attributes = $attributes + 256; } 238 239 return $attributes --- 81 unchanged lines hidden (view full) --- 321# Attention: This has to be the unique (file)name, not the 322# real filename! 323#################################################################### 324 325sub get_component_keypath ($$) 326{ 327 my ($componentname, $itemsref) = @_; 328 |
327 my $oneitem; | |
328 my $found = 0; 329 my $infoline = ""; 330 | 329 my $found = 0; 330 my $infoline = ""; 331 |
331 for ( my $i = 0; $i <= $#{$itemsref}; $i++ ) | 332 foreach my $oneitem (@$itemsref) |
332 { | 333 { |
333 $oneitem = ${$itemsref}[$i]; 334 my $component = $oneitem->{'componentname'}; 335 | 334 my $component = $oneitem->{'componentname'}; 335 336 if ( ! defined $component) 337 { 338 installer::scriptitems::print_script_item($oneitem); 339 installer::logger::PrintError("item in get_component_keypath has no 'componentname'\n"); 340 return ""; 341 } |
336 if ( $component eq $componentname ) 337 { | 342 if ( $component eq $componentname ) 343 { |
344 my $keypath = $oneitem->{'uniquename'}; # "uniquename", not "Name" 345 346 # Special handling for components in 347 # PREDEFINED_OSSHELLNEWDIR. These components need as 348 # KeyPath a RegistryItem in HKCU 349 if ($oneitem->{'userregkeypath'}) 350 { 351 $keypath = $oneitem->{'userregkeypath'}; 352 } 353 354 # saving it in the file and registry collection 355 $oneitem->{'keypath'} = $keypath; 356 357 return $keypath 358 } 359 360 if ($oneitem->{'componentname'} eq $componentname) 361 { |
|
338 $found = 1; 339 last; 340 } 341 } | 362 $found = 1; 363 last; 364 } 365 } |
342 343 if (!($found)) 344 { 345 installer::exiter::exit_program("ERROR: Did not find component in file/registry collection, function get_component_keypath", "get_component_keypath"); 346 } | |
347 | 366 |
348 my $keypath = $oneitem->{'uniquename'}; # "uniquename", not "Name" 349 350 # Special handling for components in PREDEFINED_OSSHELLNEWDIR. These components 351 # need as KeyPath a RegistryItem in HKCU 352 if ( $oneitem->{'userregkeypath'} ) { $keypath = $oneitem->{'userregkeypath'}; } 353 354 # saving it in the file and registry collection 355 $oneitem->{'keypath'} = $keypath; 356 357 return $keypath | 367 installer::exiter::exit_program( 368 "ERROR: Did not find component in file/registry collection, function get_component_keypath", 369 "get_component_keypath"); |
358} 359 360################################################################### 361# Creating the file Componen.idt dynamically 362# Content: 363# Component ComponentId Directory_ Attributes Condition KeyPath 364################################################################### 365 --- 150 unchanged lines hidden --- | 370} 371 372################################################################### 373# Creating the file Componen.idt dynamically 374# Content: 375# Component ComponentId Directory_ Attributes Condition KeyPath 376################################################################### 377 --- 150 unchanged lines hidden --- |