registry.pm (9f91b7e3) registry.pm (677600b0)
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

--- 33 unchanged lines hidden (view full) ---

42 # In this function exists the rule to create components from registryitems
43 # Rule:
44 # The componentname can be directly taken from the ModuleID.
45 # All registryitems belonging to one module can get the same component.
46
47 my $componentname = "";
48 my $isrootmodule = 0;
49
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

--- 33 unchanged lines hidden (view full) ---

42 # In this function exists the rule to create components from registryitems
43 # Rule:
44 # The componentname can be directly taken from the ModuleID.
45 # All registryitems belonging to one module can get the same component.
46
47 my $componentname = "";
48 my $isrootmodule = 0;
49
50 if ( $registryref->{'ModuleID'} ) { $componentname = $registryref->{'ModuleID'}; }
50 if ($registryref->{'ModuleID'})
51 {
52 $componentname = $registryref->{'ModuleID'};
53 }
51
52 $componentname =~ s/\\/\_/g;
53 $componentname =~ s/\//\_/g;
54 $componentname =~ s/\-/\_/g;
55 $componentname =~ s/\_\s*$//g;
56
57 $componentname = lc($componentname); # componentnames always lowercase
58
54
55 $componentname =~ s/\\/\_/g;
56 $componentname =~ s/\//\_/g;
57 $componentname =~ s/\-/\_/g;
58 $componentname =~ s/\_\s*$//g;
59
60 $componentname = lc($componentname); # componentnames always lowercase
61
59 if ( $componentname eq "gid_module_root" ) { $isrootmodule = 1; }
62 if ( $componentname eq "gid_module_root" )
63 {
64 $isrootmodule = 1;
65 }
60
61 # Attention: Maximum length for the componentname is 72
62
63 # identifying this component as registryitem component
64 $componentname = "registry_" . $componentname;
65
66 $componentname =~ s/gid_module_/g_m_/g;
67 $componentname =~ s/_optional_/_o_/g;
68 $componentname =~ s/_javafilter_/_jf_/g;
69
70 # This componentname must be more specific
71 my $addon = "_";
66
67 # Attention: Maximum length for the componentname is 72
68
69 # identifying this component as registryitem component
70 $componentname = "registry_" . $componentname;
71
72 $componentname =~ s/gid_module_/g_m_/g;
73 $componentname =~ s/_optional_/_o_/g;
74 $componentname =~ s/_javafilter_/_jf_/g;
75
76 # This componentname must be more specific
77 my $addon = "_";
72 if ( $allvariables->{'PRODUCTNAME'} ) { $addon = $addon . $allvariables->{'PRODUCTNAME'}; }
73 if ( $allvariables->{'PRODUCTVERSION'} ) { $addon = $addon . $allvariables->{'PRODUCTVERSION'}; }
78 if ($allvariables->{'PRODUCTNAME'})
79 {
80 $addon .= $allvariables->{'PRODUCTNAME'};
81 }
82
83 # Append the version number.
84 # Previously that was the full version number as provided by 'PRODUCTVERSION'.
85 # But MSI patches introduce the restriction that component names must not change.
86 # Use just the major version number.
87 my $version = $allvariables->{"BRANDPACKAGEVERSION"} // "";
88 $addon .= $version;
74 $addon = lc($addon);
75 $addon =~ s/ //g;
76 $addon =~ s/-//g;
77 $addon =~ s/\.//g;
78
89 $addon = lc($addon);
90 $addon =~ s/ //g;
91 $addon =~ s/-//g;
92 $addon =~ s/\.//g;
93
79 my $styles = "";
80 if ( $registryref->{'Styles'} ) { $styles = $registryref->{'Styles'}; }
81
82 $componentname = $componentname . $addon;
83
94 $componentname = $componentname . $addon;
95
84 if (( $styles =~ /\bLANGUAGEPACK\b/ ) && ( $installer::globals::languagepack )) { $componentname = $componentname . "_lang"; }
85 if ( $styles =~ /\bALWAYS_REQUIRED\b/ ) { $componentname = $componentname . "_forced"; }
96 my $styles = $registryref->{'Styles'};
97 if (defined $styles)
98 {
99 if (($styles =~ /\bLANGUAGEPACK\b/) && $installer::globals::languagepack)
100 {
101 $componentname .= "_lang";
102 }
103 if ($styles =~ /\bALWAYS_REQUIRED\b/)
104 {
105 $componentname .= "_forced";
106 }
107 }
86
87 # Attention: Maximum length for the componentname is 72
88 # %installer::globals::allregistrycomponents_in_this_database_ : resetted for each database
89 # %installer::globals::allregistrycomponents_ : not resetted for each database
90 # Component strings must be unique for the complete product, because they are used for
91 # the creation of the globally unique identifier.
92
93 my $fullname = $componentname; # This can be longer than 72
94
108
109 # Attention: Maximum length for the componentname is 72
110 # %installer::globals::allregistrycomponents_in_this_database_ : resetted for each database
111 # %installer::globals::allregistrycomponents_ : not resetted for each database
112 # Component strings must be unique for the complete product, because they are used for
113 # the creation of the globally unique identifier.
114
115 my $fullname = $componentname; # This can be longer than 72
116
95 if (( exists($installer::globals::allregistrycomponents_{$fullname}) ) && ( ! exists($installer::globals::allregistrycomponents_in_this_database_{$fullname}) ))
117 if (exists($installer::globals::allregistrycomponents_{$fullname})
118 && ! exists($installer::globals::allregistrycomponents_in_this_database_{$fullname}))
96 {
97 # This is not allowed: One component cannot be installed with different packages.
119 {
120 # This is not allowed: One component cannot be installed with different packages.
98 installer::exiter::exit_program("ERROR: Windows registry component \"$fullname\" is already included into another package. This is not allowed.", "get_registry_component_name");
121 installer::exiter::exit_program(
122 "ERROR: Windows registry component \"$fullname\" is already included into another package. This is not allowed.",
123 "get_registry_component_name");
99 }
100
101 if ( exists($installer::globals::allregistrycomponents_{$fullname}) )
102 {
103 $componentname = $installer::globals::allregistrycomponents_{$fullname};
104 }
105 else
106 {
107 if ( length($componentname) > 70 )
108 {
109 $componentname = generate_new_short_registrycomponentname($componentname); # This has to be unique for the complete product, not only one package
110 }
111
112 $installer::globals::allregistrycomponents_{$fullname} = $componentname;
113 $installer::globals::allregistrycomponents_in_this_database_{$fullname} = 1;
114 }
115
124 }
125
126 if ( exists($installer::globals::allregistrycomponents_{$fullname}) )
127 {
128 $componentname = $installer::globals::allregistrycomponents_{$fullname};
129 }
130 else
131 {
132 if ( length($componentname) > 70 )
133 {
134 $componentname = generate_new_short_registrycomponentname($componentname); # This has to be unique for the complete product, not only one package
135 }
136
137 $installer::globals::allregistrycomponents_{$fullname} = $componentname;
138 $installer::globals::allregistrycomponents_in_this_database_{$fullname} = 1;
139 }
140
116 if ( $isrootmodule ) { $installer::globals::registryrootcomponent = $componentname; }
141 if ( $isrootmodule )
142 {
143 $installer::globals::registryrootcomponent = $componentname;
144 }
117
118 return $componentname;
119}
120
121#########################################################
122# Create a shorter version of a long component name,
123# because maximum length in msi database is 72.
124# Attention: In multi msi installation sets, the short

--- 410 unchanged lines hidden ---
145
146 return $componentname;
147}
148
149#########################################################
150# Create a shorter version of a long component name,
151# because maximum length in msi database is 72.
152# Attention: In multi msi installation sets, the short

--- 410 unchanged lines hidden ---