INTEGRATION: CWS native100 (1.18.4); FILE MERGED
2007/08/24 15:16:28 is 1.18.4.2: #i80938# shifting package information 2007/08/23 15:10:35 is 1.18.4.1: #i80937,i80938# introducing module order, package restructuring
This commit is contained in:
parent
233858082e
commit
6ad3c0b97c
1 changed files with 139 additions and 2 deletions
|
@ -4,9 +4,9 @@
|
||||||
#
|
#
|
||||||
# $RCSfile: feature.pm,v $
|
# $RCSfile: feature.pm,v $
|
||||||
#
|
#
|
||||||
# $Revision: 1.18 $
|
# $Revision: 1.19 $
|
||||||
#
|
#
|
||||||
# last change: $Author: ihi $ $Date: 2007-08-20 15:27:52 $
|
# last change: $Author: kz $ $Date: 2007-09-06 09:54:50 $
|
||||||
#
|
#
|
||||||
# The Contents of this file are made available subject to
|
# The Contents of this file are made available subject to
|
||||||
# the terms of GNU Lesser General Public License Version 2.1.
|
# the terms of GNU Lesser General Public License Version 2.1.
|
||||||
|
@ -39,6 +39,7 @@ use installer::existence;
|
||||||
use installer::exiter;
|
use installer::exiter;
|
||||||
use installer::files;
|
use installer::files;
|
||||||
use installer::globals;
|
use installer::globals;
|
||||||
|
use installer::sorter;
|
||||||
use installer::worker;
|
use installer::worker;
|
||||||
use installer::windows::idtglobal;
|
use installer::windows::idtglobal;
|
||||||
use installer::windows::language;
|
use installer::windows::language;
|
||||||
|
@ -251,6 +252,7 @@ sub add_language_pack_feature
|
||||||
|
|
||||||
# $languagemodules contains all modules with flag LANGUAGEMODULE
|
# $languagemodules contains all modules with flag LANGUAGEMODULE
|
||||||
# Now it is time to find the correct feature using the gid.
|
# Now it is time to find the correct feature using the gid.
|
||||||
|
|
||||||
my $onefeature = installer::worker::find_item_by_gid($languagemodules, $gid);
|
my $onefeature = installer::worker::find_item_by_gid($languagemodules, $gid);
|
||||||
if ( $onefeature eq "" ) { installer::exiter::exit_program("ERROR: Language feature not found: $gid !", "add_language_pack_feature"); }
|
if ( $onefeature eq "" ) { installer::exiter::exit_program("ERROR: Language feature not found: $gid !", "add_language_pack_feature"); }
|
||||||
|
|
||||||
|
@ -365,6 +367,141 @@ sub replace_variables
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#################################################################################
|
||||||
|
# Collecting the feature recursively.
|
||||||
|
#################################################################################
|
||||||
|
|
||||||
|
sub collect_modules_recursive
|
||||||
|
{
|
||||||
|
my ($modulesref, $parentid, $feature, $directaccess, $directgid, $directparent, $directsortkey, $sorted) = @_;
|
||||||
|
|
||||||
|
my @allchildren = ();
|
||||||
|
my $childrenexist = 0;
|
||||||
|
|
||||||
|
# Collecting children from Module $parentid
|
||||||
|
|
||||||
|
my $modulegid;
|
||||||
|
foreach $modulegid ( keys %{$directparent})
|
||||||
|
{
|
||||||
|
if ( $directparent->{$modulegid} eq $parentid )
|
||||||
|
{
|
||||||
|
my %childhash = ( "gid" => "$modulegid", "Sortkey" => "$directsortkey->{$modulegid}");
|
||||||
|
push(@allchildren, \%childhash);
|
||||||
|
$childrenexist = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Sorting children
|
||||||
|
|
||||||
|
if ( $childrenexist )
|
||||||
|
{
|
||||||
|
# Sort children
|
||||||
|
installer::sorter::sort_array_of_hashes_numerically(\@allchildren, "Sortkey");
|
||||||
|
|
||||||
|
# Adding children to new array
|
||||||
|
my $childhashref;
|
||||||
|
foreach $childhashref ( @allchildren )
|
||||||
|
{
|
||||||
|
my $gid = $childhashref->{'gid'};
|
||||||
|
|
||||||
|
# Saving all lines, that have this 'gid'
|
||||||
|
|
||||||
|
my $unique;
|
||||||
|
foreach $unique ( keys %{$directgid} )
|
||||||
|
{
|
||||||
|
if ( $directgid->{$unique} eq $gid )
|
||||||
|
{
|
||||||
|
push(@{$feature}, ${$modulesref}[$directaccess->{$unique}]);
|
||||||
|
if ( $sorted->{$unique} == 1 ) { installer::exiter::exit_program("ERROR: Sorting feature failed! \"$unique\" already sorted.", "sort_feature"); }
|
||||||
|
$sorted->{$unique} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
collect_modules_recursive($modulesref, $gid, $feature, $directaccess, $directgid, $directparent, $directsortkey, $sorted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#################################################################################
|
||||||
|
# Sorting the feature in specified order. Evaluated is the key "Sortkey", that
|
||||||
|
# is set in scp2 projects.
|
||||||
|
# The display order of modules in Windows Installer is dependent from the order
|
||||||
|
# in the idt file. Therefore the order of the modules array has to be adapted
|
||||||
|
# to the Sortkey order, before the idt file is created.
|
||||||
|
#################################################################################
|
||||||
|
|
||||||
|
sub sort_feature
|
||||||
|
{
|
||||||
|
my ($modulesref) = @_;
|
||||||
|
|
||||||
|
my @feature = ();
|
||||||
|
|
||||||
|
my %directaccess = ();
|
||||||
|
my %directparent = ();
|
||||||
|
my %directgid = ();
|
||||||
|
my %directsortkey = ();
|
||||||
|
my %sorted = ();
|
||||||
|
|
||||||
|
for ( my $i = 0; $i <= $#{$modulesref}; $i++ )
|
||||||
|
{
|
||||||
|
my $onefeature = ${$modulesref}[$i];
|
||||||
|
|
||||||
|
my $uniquekey = $onefeature->{'uniquekey'};
|
||||||
|
my $modulegid = $onefeature->{'gid'};
|
||||||
|
|
||||||
|
$directaccess{$uniquekey} = $i;
|
||||||
|
|
||||||
|
$directgid{$uniquekey} = $onefeature->{'gid'};
|
||||||
|
|
||||||
|
# ParentID and Sortkey are not saved for the 'uniquekey', but only for the 'gid'
|
||||||
|
|
||||||
|
if ( $onefeature->{'ParentID'} ) { $directparent{$modulegid} = $onefeature->{'ParentID'}; }
|
||||||
|
else { $directparent{$modulegid} = ""; }
|
||||||
|
|
||||||
|
if ( $onefeature->{'Sortkey'} ) { $directsortkey{$modulegid} = $onefeature->{'Sortkey'}; }
|
||||||
|
else { $directsortkey{$modulegid} = "9999"; }
|
||||||
|
|
||||||
|
# Bookkeeping:
|
||||||
|
$sorted{$uniquekey} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Searching all feature recursively, beginning with ParentID = ""
|
||||||
|
my $parentid = "";
|
||||||
|
collect_modules_recursive($modulesref, $parentid, \@feature, \%directaccess, \%directgid, \%directparent, \%directsortkey, \%sorted);
|
||||||
|
|
||||||
|
# Bookkeeping
|
||||||
|
my $modulekey;
|
||||||
|
foreach $modulekey ( keys %sorted )
|
||||||
|
{
|
||||||
|
if ( $sorted{$modulekey} == 0 )
|
||||||
|
{
|
||||||
|
my $infoline = "Warning: Module \"$modulekey\" could not be sorted. Added to the end of the module array.\n";
|
||||||
|
push(@installer::globals::logfileinfo, $infoline);
|
||||||
|
push(@feature, ${$modulesref}[$directaccess{$modulekey}]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return \@feature;
|
||||||
|
}
|
||||||
|
|
||||||
|
#################################################################################
|
||||||
|
# Adding a unique key to the modules array. The gid is not unique for
|
||||||
|
# multilingual modules. Only the combination from gid and specific language
|
||||||
|
# is unique. Uniqueness is required for sorting mechanism.
|
||||||
|
#################################################################################
|
||||||
|
|
||||||
|
sub add_uniquekey
|
||||||
|
{
|
||||||
|
my ( $modulesref ) = @_;
|
||||||
|
|
||||||
|
for ( my $i = 0; $i <= $#{$modulesref}; $i++ )
|
||||||
|
{
|
||||||
|
my $uniquekey = ${$modulesref}[$i]->{'gid'};
|
||||||
|
if ( ${$modulesref}[$i]->{'specificlanguage'} ) { $uniquekey = $uniquekey . "_" . ${$modulesref}[$i]->{'specificlanguage'}; }
|
||||||
|
${$modulesref}[$i]->{'uniquekey'} = $uniquekey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
# Creating the file Feature.idt dynamically
|
# Creating the file Feature.idt dynamically
|
||||||
# Content:
|
# Content:
|
||||||
|
|
Loading…
Reference in a new issue