incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1167539 - in /incubator/ooo/trunk/main/solenv/bin: ./ modules/installer/ modules/installer/windows/
Date Sat, 10 Sep 2011 15:23:27 GMT
Author: erack
Date: Sat Sep 10 15:23:26 2011
New Revision: 1167539

URL: http://svn.apache.org/viewvc?rev=1167539&view=rev
Log:
native373: #164472# improvements for msi database

# User Ingo Schmidt <is@openoffice.org>

Modified:
    incubator/ooo/trunk/main/solenv/bin/make_installer.pl
    incubator/ooo/trunk/main/solenv/bin/modules/installer/globals.pm
    incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/directory.pm
    incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/file.pm
    incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/msiglobal.pm
    incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/registry.pm

Modified: incubator/ooo/trunk/main/solenv/bin/make_installer.pl
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/make_installer.pl?rev=1167539&r1=1167538&r2=1167539&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/make_installer.pl (original)
+++ incubator/ooo/trunk/main/solenv/bin/make_installer.pl Sat Sep 10 15:23:26 2011
@@ -2028,7 +2028,7 @@ for ( my $n = 0; $n <= $#installer::glob
 						
 			installer::windows::idtglobal::prepare_language_idt_directory($languageidtdir, $newidtdir,
$onelanguage, $filesinproductlanguageresolvedarrayref, \@iconfilecollector, $binarytablefiles,
$allvariableshashref);
 
-			if ( ! $installer::globals::languagepack )
+			if (( ! $installer::globals::languagepack ) && ( ! $allvariableshashref->{'NOLANGUAGESELECTIONPRODUCT'}
))
 			{
 				# For multilingual installation sets, the dialog for the language selection can now be
prepared, with 
 				# a checkbox for each available language. This has to happen before the following translation.

Modified: incubator/ooo/trunk/main/solenv/bin/modules/installer/globals.pm
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/modules/installer/globals.pm?rev=1167539&r1=1167538&r2=1167539&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/installer/globals.pm (original)
+++ incubator/ooo/trunk/main/solenv/bin/modules/installer/globals.pm Sat Sep 10 15:23:26 2011
@@ -385,7 +385,6 @@ BEGIN
 	%allcomponents = ();
 	%allcomponents_in_this_database = ();
 	%allshortcomponents = ();
-	%alluniquedirectorynames = ();
 	%allregistrycomponents_ = ();
 	%allregistrycomponents_in_this_database_ = ();
 	%allshortregistrycomponents = ();

Modified: incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/directory.pm
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/directory.pm?rev=1167539&r1=1167538&r2=1167539&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/directory.pm (original)
+++ incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/directory.pm Sat Sep 10
15:23:26 2011
@@ -32,6 +32,7 @@ use installer::files;
 use installer::globals;
 use installer::pathanalyzer;
 use installer::windows::idtglobal;
+use installer::windows::msiglobal;
 
 ##############################################################
 # Collecting all directory trees in global hash
@@ -83,11 +84,12 @@ sub overwrite_programfilesfolder
 
 sub make_short_dir_version
 {
-	my ($longstring, $length, $displayname) = @_;
+	my ($longstring) = @_;
 	
 	my $shortstring = "";
-	my $infoline = "";
-	my $savestring = $longstring;
+	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.
@@ -119,12 +121,17 @@ sub make_short_dir_version
 
 	$shortstring =~ s/^\s*\_//;
 
-	if ( length($shortstring) > 72 )
-	{
-		my $shortlength = length($shortstring);
-		$infoline = "WARNING: Failed to create unique directory name with less than 72 characters:
\"$displayname\" ($shortstring ($shortlength)).\n"; 
-		push(@installer::globals::logfileinfo, $infoline);
-	}
+	# Setting unique ID to each directory
+	# No counter allowed, process must be absolute reproducable due to patch creation process.
+	
+	# chomp(my $id = `echo $longstring_save | md5sum | sed -e "s/ .*//g"`);  # Very, very slow
+	# my $subid = substr($id, 0, 9); # taking only the first 9 digits
+
+	my $subid = installer::windows::msiglobal::calculate_id($longstring_save, 9); # taking only
the first 9 digits
+
+	if ( length($shortstring) > $cutlength ) { $shortstring = substr($shortstring, 0, $cutlength);
}
+
+	$shortstring = $shortstring . "_" . $subid;
 
 	return $shortstring;
 }
@@ -138,29 +145,30 @@ sub create_unique_directorynames
 	my ($directoryref, $allvariables) = @_;
 
 	$installer::globals::officeinstalldirectoryset = 0;
-	
-	my %conversionhash = ();
+
+	my %completedirhashstep1 = ();
+	my %shortdirhash = ();
+	my %shortdirhashreverse = ();
 	my $infoline = "";
 	my $errorcount = 0;
 
 	for ( my $i = 0; $i <= $#{$directoryref}; $i++ )
 	{
 		my $onedir = ${$directoryref}[$i];
-		my $hostname = $onedir->{'HostName'};
+		my $uniquename = $onedir->{'HostName'};
 
-		my $uniquename = $hostname;
 		my $styles = "";
 		if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; }
-		# get_path_from_fullqualifiedname(\$uniqueparentname);
-		# making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs 
 
 		$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/\Q$installer::globals::separator\E/\_/g;	# replacing slash and backslash
with underline
 		$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;
@@ -168,60 +176,94 @@ sub create_unique_directorynames
 		$uniquename =~ s/_table/_tbl/g;
 		$uniquename =~ s/_chart/_crt/g;
 
-		my $startlength = 5;
-		
-		if ( ! $allvariables->{'NOSHORTDIRECTORYNAMES'} )
-		{
-			# This process does not work for SDK, because of its long and similar pathes
-			$uniquename = make_short_dir_version($uniquename, $startlength, $hostname); # taking care
of underlines!
-		}
+		# The names after this small changes must still be unique!
+		if ( exists($completedirhashstep1{$uniquename}) ) { installer::exiter::exit_program("ERROR:
Error in packaging process. Unallowed modification of directory name, not unique (step 1):
\"$uniquename\".", "create_unique_directorynames"); }
+		$completedirhashstep1{$uniquename} = 1;
 
-		if ( exists($installer::globals::alluniquedirectorynames{$uniquename}) )
-		{
-			# This is an error, that must stop the packaging process
-			$errorcount++;
+		# Starting to make unique name for the parent and its directory
+		my $originaluniquename = $uniquename;
 
-			$infoline = "$errorcount: Already existing unique directory: $uniquename\n";
-			push( @installer::globals::logfileinfo, $infoline);
-			$infoline = "$errorcount: First full directory: $conversionhash{$uniquename}\n";
-			push( @installer::globals::logfileinfo, $infoline);
-			$infoline = "$errorcount: Current full directory: $hostname\n";
-			push( @installer::globals::logfileinfo, $infoline);		
-		}
-	
-		$conversionhash{$uniquename} = $hostname;
+		$uniquename = make_short_dir_version($uniquename);
+
+		# Checking if the same directory already exists, but has another short version.
+		if (( exists($shortdirhash{$originaluniquename}) ) && ( $shortdirhash{$originaluniquename}
ne $uniquename )) { installer::exiter::exit_program("ERROR: Error in packaging process. Unallowed
modification of directory name, not unique (step 2A): \"$uniquename\".", "create_unique_directorynames");
}
 
-		$installer::globals::alluniquedirectorynames{$uniquename} = 1;
+		# Also checking vice versa
+		# Checking if the same short directory already exists, but has another long version.
+		if (( exists($shortdirhashreverse{$uniquename}) ) && ( $shortdirhashreverse{$uniquename}
ne $originaluniquename )) { installer::exiter::exit_program("ERROR: Error in packaging process.
Unallowed modification of directory name, not unique (step 2B): \"$uniquename\".", "create_unique_directorynames");
}
 
-		# Important: The unique parent is generated from the string $uniquename. Therefore counters
-		# like adding "_1" is not allowed to achive uniqueness, because this depends from other
directories
-		# and does not deliver always the same result.
+		# Creating assignment from long to short directory names
+		$shortdirhash{$originaluniquename} = $uniquename;
+		$shortdirhashreverse{$uniquename} = $originaluniquename;
 
-		my $uniqueparentname = $uniquename;
+		# Important: The unique parent is generated from the string $originaluniquename (with the
use of underlines).
+
+		my $uniqueparentname = $originaluniquename;
+		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;
}
-		if ( $styles =~ /\bCOMMONFILESFOLDER\b/ ) { $uniqueparentname = $installer::globals::commonfilesfolder;
}
-		if ( $styles =~ /\bCOMMONAPPDATAFOLDER\b/ ) { $uniqueparentname = $installer::globals::commonappdatafolder;
}
-		if ( $styles =~ /\bLOCALAPPDATAFOLDER\b/ ) { $uniqueparentname = $installer::globals::localappdatafolder;
}
+		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);
 		}
 
+		# Again checking if the same directory already exists, but has another short version.
+		if (( exists($shortdirhash{$originaluniqueparentname}) ) && ( $shortdirhash{$originaluniqueparentname}
ne $uniqueparentname )) { installer::exiter::exit_program("ERROR: Error in packaging process.
Unallowed modification of directory name, not unique (step 3A): \"$uniqueparentname\".", "create_unique_directorynames");
}
+
+		# Also checking vice versa
+		# Checking if the same short directory already exists, but has another long version.
+		if (( exists($shortdirhashreverse{$uniqueparentname}) ) && ( $shortdirhashreverse{$uniqueparentname}
ne $originaluniqueparentname )) { installer::exiter::exit_program("ERROR: Error in packaging
process. Unallowed modification of directory name, not unique (step 3B): \"$uniqueparentname\".",
"create_unique_directorynames"); }
+
+		$shortdirhash{$originaluniqueparentname} = $uniqueparentname;
+		$shortdirhashreverse{$uniqueparentname} = $originaluniqueparentname;
+		
+		# Hyphen not allowed in database
 		$uniquename =~ s/\-/\_/g;			# making "-" to "_"
 		$uniqueparentname =~ s/\-/\_/g;		# making "-" to "_"
 		
+		# And finally setting the values for the directories
 		$onedir->{'uniquename'} = $uniquename;
 		$onedir->{'uniqueparentname'} = $uniqueparentname;
 
@@ -241,12 +283,7 @@ sub create_unique_directorynames
 			$installer::globals::vendordirectory = $uniquename;
 			$installer::globals::vendordirectoryset = 1;
 		}
-	}
-	
-	if ( $errorcount > 0 )
-	{
-		installer::exiter::exit_program("ERROR: Failed to create unique directory names.", "create_unique_directorynames");

-	}			
+	}	
 }
 
 #####################################################
@@ -529,6 +566,8 @@ 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::include_timestamp_into_logfile("Performance Info: Directory Table start");
 
 	my @directorytable = ();
 	my $infoline;
@@ -552,6 +591,8 @@ sub create_directory_table
 	$infoline = "Created idt file: $directorytablename\n"; 
 	push(@installer::globals::logfileinfo, $infoline);
 
+	installer::logger::include_timestamp_into_logfile("Performance Info: Directory Table end");
+
 }
 
 1;

Modified: incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/file.pm
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/file.pm?rev=1167539&r1=1167538&r2=1167539&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/file.pm (original)
+++ incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/file.pm Sat Sep 10 15:23:26
2011
@@ -37,6 +37,7 @@ use installer::pathanalyzer;
 use installer::worker;
 use installer::windows::font;
 use installer::windows::idtglobal;
+use installer::windows::msiglobal;
 use installer::windows::language;
 
 ##########################################################################
@@ -179,25 +180,18 @@ sub assign_sequencenumbers_to_files
 # -> no resetting of
 # %installer::globals::allshortcomponents
 # after a package was created.
+# Using no counter because of reproducibility.
 #########################################################
 
 sub generate_new_short_componentname
 {
 	my ($componentname) = @_;
 	
-	my $shortcomponentname = "";
-	my $counter = 1;
-	
 	my $startversion = substr($componentname, 0, 60); # taking only the first 60 characters
-	$startversion = $startversion . "_";
+	my $subid = installer::windows::msiglobal::calculate_id($componentname, 9); # taking only
the first 9 digits
+	my $shortcomponentname = $startversion . "_" . $subid;
 	
-	$shortcomponentname = $startversion . $counter;
-
-	while ( exists($installer::globals::allshortcomponents{$shortcomponentname}) )
-	{
-		$counter++;
-		$shortcomponentname = $startversion . $counter;
-	}
+	if ( exists($installer::globals::allshortcomponents{$shortcomponentname}) ) { installer::exiter::exit_program("Failed
to create unique component name: \"$shortcomponentname\"", "generate_new_short_componentname");
}
 	
 	$installer::globals::allshortcomponents{$shortcomponentname} = 1;
 	
@@ -282,11 +276,8 @@ sub get_file_component_name
 		}
 		else
 		{
-			if ( length($componentname) > 60 )
+			if ( length($componentname) > 70 )
 			{
-				# Using md5sum needs much time
-				# chomp(my $shorter = `echo $componentname | md5sum | sed -e "s/ .*//g"`);
-				# $componentname = "comp_$shorter";
 				$componentname = generate_new_short_componentname($componentname); # This has to be unique
for the complete product, not only one package
 			}
 

Modified: incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/msiglobal.pm
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/msiglobal.pm?rev=1167539&r1=1167538&r2=1167539&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/msiglobal.pm (original)
+++ incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/msiglobal.pm Sat Sep 10
15:23:26 2011
@@ -1527,6 +1527,24 @@ sub calculate_guid
 }
 
 #################################################################
+# Calculating a ID with a string using md5 (very fast).
+#################################################################
+
+sub calculate_id
+{
+	my ( $string, $length ) = @_;
+	
+	my $id = "";
+	
+    my $md5 = Digest::MD5->new;
+    $md5->add($string);
+    my $digest = lc($md5->hexdigest);
+	$id = substr($digest, 0, $length);
+	
+	return $id;
+}
+
+#################################################################
 # Filling the component hash with the values of the 
 # component file.
 #################################################################

Modified: incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/registry.pm
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/registry.pm?rev=1167539&r1=1167538&r2=1167539&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/registry.pm (original)
+++ incubator/ooo/trunk/main/solenv/bin/modules/installer/windows/registry.pm Sat Sep 10 15:23:26
2011
@@ -30,6 +30,7 @@ package installer::windows::registry;
 use installer::files;
 use installer::globals;
 use installer::worker;
+use installer::windows::msiglobal;
 use installer::windows::idtglobal;
 
 #####################################################
@@ -116,7 +117,7 @@ sub get_registry_component_name
 	}
 	else
 	{
-		if ( length($componentname) > 60 )
+		if ( length($componentname) > 70 )
 		{
 			$componentname = generate_new_short_registrycomponentname($componentname); # This has
to be unique for the complete product, not only one package
 		}
@@ -144,20 +145,12 @@ sub get_registry_component_name
 sub generate_new_short_registrycomponentname
 {
 	my ($componentname) = @_;
-	
-	my $shortcomponentname = "";
-	my $counter = 1;
-	
+
 	my $startversion = substr($componentname, 0, 60); # taking only the first 60 characters
-	$startversion = $startversion . "_";
+	my $subid = installer::windows::msiglobal::calculate_id($componentname, 9); # taking only
the first 9 digits
+	my $shortcomponentname = $startversion . "_" . $subid;
 	
-	$shortcomponentname = $startversion . $counter;
-
-	while ( exists($installer::globals::allshortregistrycomponents{$shortcomponentname}) )
-	{
-		$counter++;
-		$shortcomponentname = $startversion . $counter;
-	}
+	if ( exists($installer::globals::allshortregistrycomponents{$shortcomponentname}) ) { installer::exiter::exit_program("Failed
to create unique component name: \"$shortcomponentname\"", "generate_new_short_registrycomponentname");
}
 	
 	$installer::globals::allshortregistrycomponents{$shortcomponentname} = 1;
 	



Mime
View raw message