[ooo-build-commit] bin/localize-ooo bin/setup.in patches/dev300

Petr Mladek pmladek at kemper.freedesktop.org
Wed Dec 2 08:18:43 PST 2009


 bin/localize-ooo                                   |   38 ++++---------
 bin/setup.in                                       |   10 +++
 patches/dev300/apply                               |    5 +
 patches/dev300/transex3-localize.pl-ooo-build.diff |   59 +++++++++++++++++++++
 4 files changed, 85 insertions(+), 27 deletions(-)

New commits:
commit 8ea6ec6a307fa56d10877655b679b90bfddbb90c
Author: Petr Mladek <pmladek at suse.cz>
Date:   Wed Dec 2 17:10:30 2009 +0100

    Fix ooo-build localize stuff to work again
    
    * patches/dev300/transex3-localize.pl-ooo-build.diff:
    * patches/dev300/apply: add -o option to localize.pl to force the
      localization from the l10n module; also fixed the return code with
      the -h option (i#107386)
    * bin/localize-ooo: use localize with the -o option; use -h option to
      check for working localize.pl; set WRAPCMD to get gsicheck working;
      added filtering of en-US strings; removed filtering of module specific
      strings that will not longer be used in the split build
    * bin/setup.in: updated the hack to get list of all languages

diff --git a/bin/localize-ooo b/bin/localize-ooo
index 8592e58..17cd038 100755
--- a/bin/localize-ooo
+++ b/bin/localize-ooo
@@ -28,34 +28,27 @@ merge_localization()
 {
     sdf_file="$1"
     langcode="$2"
-    split_build="$3"
-    sdf_file_filter="$4"
 
-    # filter the sdf file in the split build
-    if test "$split_build" = "yes" ; then
-	sdf_file_filtered=`mktemp /tmp/localize-ooo-sdf-filtered-XXXXXX`
-	grep -f "$sdf_file_filter" "$sdf_file" >$sdf_file_filtered
-    else
-	sdf_file_filtered="$sdf_file"
-    fi
+    # we do not want en-US strings
+    sdf_file_filtered=`mktemp /tmp/localize-ooo-sdf-filtered-XXXXXX`
+    awk -F "\t" '{ if ($10 != "en-US") print }' "$sdf_file" >$sdf_file_filtered
 
     # merge the localization
     if test `wc -l $sdf_file_filtered | cut -d " " -f 1` -eq 0 ; then
 	echo "Warning: Ignoring empty extra localization $(basename $sdf_file)..."
     else
 	echo "Merging extra localization $(basename $sdf_file)..."
-	localize -m -x -l $langcode -f $sdf_file_filtered || exit 1;
+	localize -m -x -o -l $langcode -f $sdf_file_filtered || exit 1;
 	echo ""
     fi
 
-    # remove temp file
-    if test "$split_build" = "yes" ; then
-	rm $sdf_file_filtered
-    fi
+    rm $sdf_file_filtered
 }
 
+export WRAPCMD="LD_LIBRARY_PATH=$SOLARVER/$INPATH/lib PATH=$PATH:$SOLARVER/$INPATH/bin"
+
 # build the localize tool if needed (only in the non-split build)
-if test "$split_build" != "yes" && ! which localize >/dev/null 2>&1 ; then
+if test "$split_build" != "yes" && ! localize -h >/dev/null 2>&1 ; then
     echo 'Building localize stuff at first...'
     cd $OOBUILDDIR/transex3
     perl $SOLARENV/bin/build.pl --all $EXTRA_BUILD_FLAGS $EXTRA_DMAKE_FLAGS || exit 1;
@@ -68,12 +61,6 @@ if test "$split_build" != "yes" && ! which localize >/dev/null 2>&1 ; then
     fi
 fi
 
-# will filter the sdf files in the split-build
-if test "$split_build" = "yes" ; then
-    sdf_file_filter=`mktemp /tmp/localize-ooo-sdf-filter-XXXXXX`
-    find $OOBUILDDIR -mindepth 1 -maxdepth 1 -type d -printf "^%P\t\n" >$sdf_file_filter
-fi
-
 # stamp files
 if test "$split_build" = "yes" ; then
     stamp_dir=$OOBUILDDIR/ooo-build/stamp
@@ -115,7 +102,7 @@ for sdf_file in `find $SRCDIR $DEB_GSIDIR $TOOLSDIR/po $SRCDIR_PIECE -name "*.sd
     done
     test -z "$langcode" && continue;
 
-    merge_localization "$sdf_file" "$langcode" "$split_build" "$sdf_file_filter"
+    merge_localization "$sdf_file" "$langcode"
 
     # workaround for i#56622, n#210797
     test "$langcode" = "hu" && hungarian_updated=yes
@@ -158,7 +145,7 @@ for fn in `find $SRCDIR $DEB_GSIDIR $TOOLSDIR/po $SRCDIR_PIECE -name "*.sdf"` ;
     # skip exotic localizations that are not in $ALL_LANGS and thus not detected
     echo "$fn" | grep -q "$SRCDIR/GSI" && ! echo $OOO_LANGS | grep -q "$(echo $(basename $fn) | cut -d'_' -f2)" && continue;
     echo "$fn" | grep -q "$TOOLSDIR/po/ooo-build" && ! echo $OOO_LANGS | grep -q "$(echo $(basename $fn) | cut -d'-' -f3)" && continue;
-    merge_localization "$fn" "all" "$split_build" "$sdf_file_filter" || exit 1;
+    merge_localization "$fn" "all" || exit 1;
     echo "$fn" >>$extra_trans_stamp
 done
 
@@ -166,7 +153,7 @@ if test "z$DEB_GSIDIR" != "z"; then
     for fn in $DEB_GSIDIR/*all*.sdf; do
 	[ -f "$fn" ] || continue
 	echo "Merging extra localization $(basename $fn) ..."
-	merge_localization "$fn" "all" "$split_build" "$sdf_file_filter" || exit 1;
+	merge_localization "$fn" "all" || exit 1;
     done
 fi
 
@@ -177,7 +164,7 @@ if ! grep -q "^GSI_en-GB-en-US.sdf$" $extra_trans_stamp 2>/dev/null ; then
 	    gsi_temp=`mktemp /tmp/build-ooo.XXXXXX`
 	    echo "Fixing en-GB localization..."
 	    localize -e -l en-US,en-GB=en-US -f $gsi_temp
-	    localize -m -x -l en-GB -f $gsi_temp
+	    merge_localization "$gsi_temp" "en-GB"
 	    echo "GSI_en-GB-en-US.sdf" >>$extra_trans_stamp
 	    rm -f $gsi_temp
 	    break;
@@ -186,7 +173,6 @@ if ! grep -q "^GSI_en-GB-en-US.sdf$" $extra_trans_stamp 2>/dev/null ; then
 fi
 
 # remove temporary files
-test "$split_build" = "yes" && rm $sdf_file_filter
 rm $all_langs_pattern
 
 echo "Localizations updated ...!"
diff --git a/bin/setup.in b/bin/setup.in
index 04aad65..9fa2cda 100755
--- a/bin/setup.in
+++ b/bin/setup.in
@@ -158,7 +158,15 @@ LIB=`echo $LIBDIRBASE|sed 's|.*/||'`
 
 # substitute ALL to the list of languages if possible
 if test -f $OOBUILDDIR/solenv/inc/postset.mk ; then
-    ALL_LANGS=`sed -n -e "s|^[[:space:]]*completelangiso=\(.*\)\(en-US \)\(.*\)$|\2\1\3|p" $OOBUILDDIR/solenv/inc/postset.mk`
+    # generate shell variable from completelangiso= from solenv/inc/postset.mk
+    # the sed command does the following:
+    #	+ adds " on the beginning of the value (after =)
+    #	+ adds " at the end of the value (end of line without the backslash \)
+    #	+ removes backslashes
+    #	+ removes en-US; we want to put it on the beginning
+    #	+ prints just the section starting with 'completelangiso=' and ending with the " at the end of line
+    eval $(sed -n 's/=/="/;s/\([^\\]\)$/\1"/;s/\\//;s/en-US//;/^completelangiso=/,/"$/p' $OOBUILDDIR/solenv/inc/postset.mk)
+    ALL_LANGS="en-US $completelangiso"
     OOO_LANGS_LIST=`echo $OOO_LANGS | sed -e "s|ALL|$ALL_LANGS|g"`
 fi
 # force langs
diff --git a/patches/dev300/apply b/patches/dev300/apply
index 0852ec1..fb28dcb 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1199,6 +1199,11 @@ armeabi-softfp-buildfix.diff, i#105302, doko
 [ BuildBits >= dev300-m60 < ooo320-m1 < dev300-m62 ]
 instsetoo-native-fix-system-python.diff, i#105663, rengelha
 
+[ BuildBits >= dev300-m66 >= ooo320-m6 ]
+# add -o option to force localizition of ooo modules
+# return 0 with -h option
+transex3-localize.pl-ooo-build.diff, i#107386, pmladek
+
 [ Gcc44 ]
 oox-tokenmap.string.h.diff, i#105219
 
diff --git a/patches/dev300/transex3-localize.pl-ooo-build.diff b/patches/dev300/transex3-localize.pl-ooo-build.diff
new file mode 100644
index 0000000..19f29b7
--- /dev/null
+++ b/patches/dev300/transex3-localize.pl-ooo-build.diff
@@ -0,0 +1,59 @@
+--- transex3/scripts/localize.pl.old	2009-11-27 16:11:33.000000000 +0100
++++ transex3/scripts/localize.pl	2009-11-30 19:23:28.000000000 +0100
+@@ -78,6 +78,7 @@ my $WIN;
+ my $languages;
+ #my %sl_modules;     # Contains all modules where en-US and de is source language
+ my $use_default_date = '0';
++my $force_ooo_module = '0';
+ my %is_ooo_module;
+ my %is_so_module;
+ my $DELIMITER;
+@@ -275,7 +276,7 @@ sub check_modules_scm
+ sub is_openoffice_module
+ {
+     my $module              = shift;
+-    return "TRUE", if defined $is_ooo_module{ $module };
++    return "TRUE", if ( $force_ooo_module || defined $is_ooo_module{ $module } );
+     return "";
+ }
+ 
+@@ -336,7 +337,7 @@ sub write_sdf
+             foreach my $string( @sdf_file ){
+                 print DESTFILE "$string\n";
+             }
+-            close ( DESTFILE );     
++            close ( DESTFILE );
+             if( move( $current_l10n_file , $current_l10n_file.".backup" ) ){
+                 if( copy( $tmpfile , $current_l10n_file ) ){ 
+                     unlink $l10n_file.".backup";  
+@@ -1115,7 +1116,7 @@ sub parse_options{
+     my $extract;
+     my $success = GetOptions('f=s' => \$sdffile , 'l=s' => \$languages , 's=s' => \$srcpath ,  'h' => \$help , 'v' => \$bVerbose , 
+                              'm' => \$merge , 'e' => \$extract , 'x' => \$no_sort , 'd' => \$use_default_date , 'c' => \$create_dirs ,
+-                             'n' => \$no_gsicheck );
++                             'n' => \$no_gsicheck , 'o' => \$force_ooo_module );
+     $outputfile = $sdffile;
+     
+     #print STDOUT "DBG: lang = $languages\n";
+@@ -1127,7 +1128,11 @@ sub parse_options{
+             exit(1);
+         }
+     }
+-    if( $help || !$success || $#ARGV > 1 || ( !$sdffile ) ){
++    if( $help ){
++        usage();
++        exit(0);
++    }
++    if( !$success || $#ARGV > 1 || ( !$sdffile ) ){
+         usage();
+         exit(1);
+     }
+@@ -1168,6 +1173,8 @@ sub usage{
+     print STDERR "    -h              File with localize.sdf's\n!";
+     print STDERR "    -n              No gsicheck\n"; 
+     print STDERR "    -i              Module to merge\n";
++    print STDERR "    -o              force using ooo localization from the l10n module instead of l10n_so; \n";
++    print STDERR "                    useful if the type can't be detected by the .svn tags; \n";
+     print STDERR "    -v              Verbose\n";
+     print STDERR "\nExample:\n";
+     print STDERR "\nlocalize -e -l en-US,pt-BR=en-US -f my.sdf\n( Extract en-US and pt-BR with en-US fallback )\n";


More information about the ooo-build-commit mailing list