openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1547029 - in /openoffice/trunk/main/solenv/bin: make_installer.pl modules/installer/control.pm modules/installer/converter.pm modules/installer/languages.pm modules/installer/systemactions.pm
Date Mon, 02 Dec 2013 14:16:33 GMT
Author: af
Date: Mon Dec  2 14:16:32 2013
New Revision: 1547029

URL: http://svn.apache.org/r1547029
Log:
123729: Factored out the creation of directory names the depend on build languages.

Modified:
    openoffice/trunk/main/solenv/bin/make_installer.pl
    openoffice/trunk/main/solenv/bin/modules/installer/control.pm
    openoffice/trunk/main/solenv/bin/modules/installer/converter.pm
    openoffice/trunk/main/solenv/bin/modules/installer/languages.pm
    openoffice/trunk/main/solenv/bin/modules/installer/systemactions.pm

Modified: openoffice/trunk/main/solenv/bin/make_installer.pl
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/bin/make_installer.pl?rev=1547029&r1=1547028&r2=1547029&view=diff
==============================================================================
--- openoffice/trunk/main/solenv/bin/make_installer.pl (original)
+++ openoffice/trunk/main/solenv/bin/make_installer.pl Mon Dec  2 14:16:32 2013
@@ -1645,15 +1645,8 @@ for (;1;last) 
 	if ( $installer::globals::updatepack ) { $logminor = $installer::globals::lastminor; }
 	else { $logminor = $installer::globals::minor; }
 
-	my $loglanguagestring = $$languagestringref;
-	my $loglanguagestring_orig = $loglanguagestring;
-	if (length($loglanguagestring) > $installer::globals::max_lang_length)
-	{
-		my $number_of_languages = installer::systemactions::get_number_of_langs($loglanguagestring);
-	    chomp(my $shorter = `echo $loglanguagestring | md5sum | sed -e "s/ .*//g"`);
-		my $id = substr($shorter, 0, 8); # taking only the first 8 digits
-		$loglanguagestring = "lang_" . $number_of_languages . "_id_" . $id;				
-	}
+    my $loglanguagestring_orig = $$languagestringref;
+	my $loglanguagestring = installer::languages::get_language_directory_name($$languagestringref);
 
     # Setup the directory where the language dependent log file will be stored.
 	$loggingdir = $loggingdir . $loglanguagestring . $installer::globals::separator;

Modified: openoffice/trunk/main/solenv/bin/modules/installer/control.pm
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/bin/modules/installer/control.pm?rev=1547029&r1=1547028&r2=1547029&view=diff
==============================================================================
--- openoffice/trunk/main/solenv/bin/modules/installer/control.pm (original)
+++ openoffice/trunk/main/solenv/bin/modules/installer/control.pm Mon Dec  2 14:16:32 2013
@@ -428,16 +428,7 @@ sub determine_ship_directory
 
 	my $shipdrive = $ENV{'SHIPDRIVE'};
 
-	my $languagestring = $$languagesref;
-
-	if (length($languagestring) > $installer::globals::max_lang_length )
-	{
-		my $number_of_languages = installer::systemactions::get_number_of_langs($languagestring);
-		chomp(my $shorter = `echo $languagestring | md5sum | sed -e "s/ .*//g"`);
-		# $languagestring = $shorter;
-		my $id = substr($shorter, 0, 8); # taking only the first 8 digits
-		$languagestring = "lang_" . $number_of_languages . "_id_" . $id;				
-	}
+	my $languagestring = installer::languages::get_language_directory_name($$languagesref);
 
 	my $productstring = $installer::globals::product;
 	my $productsubdir = "";

Modified: openoffice/trunk/main/solenv/bin/modules/installer/converter.pm
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/bin/modules/installer/converter.pm?rev=1547029&r1=1547028&r2=1547029&view=diff
==============================================================================
--- openoffice/trunk/main/solenv/bin/modules/installer/converter.pm (original)
+++ openoffice/trunk/main/solenv/bin/modules/installer/converter.pm Mon Dec  2 14:16:32 2013
@@ -305,7 +305,7 @@ sub make_path_conform
 
 sub copy_collector
 {
-	my ($oldcollector) = @_;
+	my ( $oldcollector ) = @_;
 
 	my @newcollector = ();
 

Modified: openoffice/trunk/main/solenv/bin/modules/installer/languages.pm
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/bin/modules/installer/languages.pm?rev=1547029&r1=1547028&r2=1547029&view=diff
==============================================================================
--- openoffice/trunk/main/solenv/bin/modules/installer/languages.pm (original)
+++ openoffice/trunk/main/solenv/bin/modules/installer/languages.pm Mon Dec  2 14:16:32 2013
@@ -29,6 +29,10 @@ use installer::exiter;
 use installer::globals;
 use installer::remover;
 use installer::ziplist;
+use Digest::MD5;
+
+use strict;
+
 
 =head2 analyze_languagelist()
 
@@ -70,6 +74,33 @@ sub analyze_languagelist()
 
 
 
+=head2 get_language_directory_name ($language_string)
+
+    Create a directory name that contains the given set of languages.
+    When $language_string exceeds a certain length then it is shortened.
+
+=cut
+sub get_language_directory_name ($)
+{
+    my ($language_string) = @_;
+
+    if (length($language_string) > $installer::globals::max_lang_length)
+	{
+		my $number_of_languages = ($language_string =~ tr/_//);
+        my $digest = new Digest::MD5();
+        $digest->add($language_string);
+        my $short_digest = substr($digest->hexdigest(), 0, 8);
+		return "lang_" . $number_of_languages . "_id_" . $short_digest;
+	}
+    else
+    {
+        return $language_string;
+    }
+}
+
+
+
+
 ####################################################
 # Reading languages from zip list file
 ####################################################
@@ -122,28 +153,24 @@ sub all_elements_of_array1_in_array2
 #############################################
 # All languages defined for one product
 #############################################
- 
-sub get_all_languages_for_one_product
+
+=head2 get_all_languages_for_one_product($languagestring, $allvariables)
+
+    $languagestring can be one or more language names, separated by ','.
+
+    $installer::globals::ismultilingual is set to 1 when $languagestring contains more than
one languages.
+    
+=cut
+sub get_all_languages_for_one_product ($$)
 {
 	my ( $languagestring, $allvariables ) = @_;
 	
-	my @languagearray = ();
 
-	my $last = $languagestring;
-	
-	$installer::globals::ismultilingual = 0;		# setting the global variable $ismultilingual
!
-	if ( $languagestring =~ /\,/ ) { $installer::globals::ismultilingual = 1; }
-	
-	while ( $last =~ /^\s*(.+?)\,(.+)\s*$/)	# "$" for minimal matching, comma separated list
-	{
-		my $first = $1;
-		$last = $2;
-		installer::remover::remove_leading_and_ending_whitespaces(\$first);
-		push(@languagearray, "$first");
-	}	
+	$installer::globals::ismultilingual = ($languagestring =~ /\,/ ) ? 1 : 0;
 
-	installer::remover::remove_leading_and_ending_whitespaces(\$last);
-	push(@languagearray, "$last");	
+	my $languages = $languagestring;
+    $languages =~ s/\s+//g;
+	my @languagearray = split(/,/, $languages);
 
 	if ( $installer::globals::iswindowsbuild )
 	{
@@ -381,10 +408,58 @@ sub get_java_language
 	#	$javalanguage =~ s/\-/\_/;	
 	# }
 
-	$javalanguage = $language;
+	my $javalanguage = $language;
 	$javalanguage =~ s/\-/\_/;	
 
 	return $javalanguage;
 }
 
+
+
+=head2 get_key_language ($languages)
+
+    Determine the key language from the array of @$languages.
+
+    If there is only one language then that is the key language.
+
+    If there are two languages and one is en-US and was automatically
+    added, then the other language is the key language.
+
+    When there is more than one language and the case above does not
+    apply then return either 'multiasia' or 'multiwestern' as key
+    language, depending on whether one of the asian language parts
+    'jp', 'ko', 'zh' appear.
+
+=cut
+sub get_key_language ($)
+{
+    my ($languages) = @_;
+
+    my $language_count = scalar @$languages;
+    
+    if ($language_count == 1)
+    {
+        return $languages->[0];
+    }
+    else
+    {
+		if ($installer::globals::added_english && $language_count==1)
+		{
+            # Only multilingual because of added English.
+			return $languages->[1];
+		}
+		else
+		{
+			if ($languages->[1] =~ /(jp|ko|zh)/)
+			{
+				return "multiasia";
+			}
+			else
+			{
+				return "multiwestern";
+			}
+		}
+	}
+}
+
 1;

Modified: openoffice/trunk/main/solenv/bin/modules/installer/systemactions.pm
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/solenv/bin/modules/installer/systemactions.pm?rev=1547029&r1=1547028&r2=1547029&view=diff
==============================================================================
--- openoffice/trunk/main/solenv/bin/modules/installer/systemactions.pm (original)
+++ openoffice/trunk/main/solenv/bin/modules/installer/systemactions.pm Mon Dec  2 14:16:32
2013
@@ -451,16 +451,7 @@ sub create_directories
 
 		if (!($locallanguagesref eq "" ))	# this will be a path like "01_49", for Profiles and
ConfigurationFiles, idt-Files
 		{
-			my $languagestring = $$languagesref;
-
-			if (length($languagestring) > $installer::globals::max_lang_length )
-			{
-				my $number_of_languages = get_number_of_langs($languagestring);
-				chomp(my $shorter = `echo $languagestring | md5sum | sed -e "s/ .*//g"`);
-				# $languagestring = $shorter;
-				my $id = substr($shorter, 0, 8); # taking only the first 8 digits
-				$languagestring = "lang_" . $number_of_languages . "_id_" . $id;				
-			}
+			my $languagestring = installer::languages::get_language_directory_name($$languagesref);
 
 			$path = $path . $languagestring  . $installer::globals::separator;
 			create_directory($path);



Mime
View raw message