Hello community,

here is the log from the commit of package libreoffice-l10n for 
openSUSE:Factory checked in at 2012-04-04 16:41:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libreoffice-l10n (Old)
 and      /work/SRC/openSUSE:Factory/.libreoffice-l10n.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libreoffice-l10n", Maintainer is "pmla...@suse.com"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libreoffice-l10n/libreoffice-l10n.changes        
2012-03-09 21:24:25.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.libreoffice-l10n.new/libreoffice-l10n.changes   
2012-04-04 16:41:36.000000000 +0200
@@ -1,0 +2,28 @@
+Tue Apr  3 16:22:43 UTC 2012 - pmla...@suse.com
+
+- generate the whole spec file from a template and a data file
+- do not recommend help packages and dictionaries; they provide support
+  for the given locale itself; the extra recommends annoys users
+  when updating on Live-CD (bnc#551003)
+- use Requires(pre) instead of PreReq on never distributions
+- spec file clean up
+
+-------------------------------------------------------------------
+Wed Mar 28 15:43:47 UTC 2012 - pmla...@suse.com
+
+- updated to libreoffice-3.5.5.2 (3.5.2-rc2)
+- basis subdirectory does not longer exists on the installed system
+- remove unused ooo_piece_version, ooo_build_version, and ooo_sourcedirname
+  macros
+
+-------------------------------------------------------------------
+Wed Mar 14 14:34:11 UTC 2012 - pmla...@suse.com
+
+- libreoffice-3.4.5.5 == SUSE 3.4.5-rc3 == final
+
+-------------------------------------------------------------------
+Mon Mar 12 18:58:39 UTC 2012 - pmla...@suse.com
+
+- updated to libreoffice-3.4.5.5 (SUSE 3.4.5-rc3)
+
+-------------------------------------------------------------------

Old:
----
  lo-l10n-group1
  lo-l10n-group2

New:
----
  libreoffice-l10n.spec.in
  lo-l10n-data

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libreoffice-l10n.spec ++++++
++++ 3353 lines (skipped)
++++ between /work/SRC/openSUSE:Factory/libreoffice-l10n/libreoffice-l10n.spec
++++ and /work/SRC/openSUSE:Factory/.libreoffice-l10n.new/libreoffice-l10n.spec

++++++ libreoffice-l10n.spec.in ++++++
#
# spec file for package libreoffice-l10n
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


@DO_NOT_EDIT_COMMENT@
Name:           libreoffice-l10n
Version:        3.5.2.2
Release:        0
%define         piece             l10n
%define         ooo_home          libreoffice
# test_build_langs:        1 = de and cs
#                          2 = all supported languages
%define         test_build_langs                2
# build_module_in_parallel 0 = no
#                          1 = yes (the number is defined be the number of cpus)
#                          2,3,4... = yes (force the number of modules to be 
built in parallel)
%define         build_module_in_parallel        1
# prepare_build:           0 = no
#                          1 = yes (just build, install and create packages; 
without %%prep section and configure)
%define         prepare_build                   1
#
%if %test_build_langs == 0
%define       lo_langs          "@OOO_LANGS_MIN_0@"
%else
%if %test_build_langs == 1
%define       lo_langs          "@OOO_LANGS_MIN_1@"
%else
%define       lo_langs          "@OOO_LANGS_MIN_2@"
%endif
%endif
License:        LGPL-3.0
Summary:        A Source Package for LibreOffice Localizations
Url:            http://www.documentfoundation.org/
Group:          Productivity/Office/Suite
Source0:        install-l10n-helper
# helper stuff to produce the spec file
Source100:      libreoffice-l10n.spec.in
Source101:      lo-l10n-gen-spec
Source102:      lo-l10n-data
# FIXME: the l10n files includes some duplicated files
Source200:      libreoffice-l10n-rpmlintrc
#!BuildIgnore:  libreoffice
BuildRequires:  libreoffice-l10n-prebuilt = %{version}
BuildRequires:  unzip
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
#!ExclusiveArch:  %ix86 x86_64 ppc
ExcludeArch:    %arm ia64 s390 s390x

%description
This source package is used to build the LibreOffice artwork
development package.

@METADATA@
%prep

%build

%install
# setup env.
export DESTDIR=%{buildroot}
/bin/bash -x $RPM_SOURCE_DIR/install-l10n-helper %{_libdir}/%ooo_home  
%{_datadir}/%ooo_home %{_libdir}/%ooo_home/share/file-lists/lang_*_list.txt

%clean
rm -rf %{buildroot}

@INSTALL_SCRIPTS@
@FILES@
%changelog
++++++ lo-l10n-data ++++++
# %lang lang-code[/upstream-lang-code] lang-name min-build-number

%lang af African 2

%lang ar Arabic 2
%package Requires:       scalable-font-ar

%lang be-BY/be Belorussian 2
%package Requires:       scalable-font-ru

%lang bg Bulgarian 2
%package Requires:       scalable-font-bg

%lang br "Breton French" 2

%lang ca Catalan 2

%lang cs Czech 1

%lang cy Welsh 2

%lang da Danish 2

%lang de German 1

%lang el Greek 2
%package Requires:       scalable-font-el

%lang en-GB British 2

%lang en-ZA "South Africa English" 2

%lang es Spanish 2

%lang et Estonian 2

%lang fi Finnish 2

%lang fr French 2

%lang ga Gaelic 2

%lang gl Galician 2

%lang he Hebrew 2

%lang hi-IN/hi Hindi 2
%package Requires:       scalable-font-hi

%lang hr Croatian 2

%lang gu-IN/gu Gujarati 2
%package Requires:       scalable-font-gu

%lang hu Hungarian 1

%lang it Italian 2

%lang ja Japanese 1
%package Requires:       scalable-font-ja

%lang ka Georgian 2

%lang km Khmer 2
%package Requires:       scalable-font-km

%lang ko Korean 2
%package Requires:       scalable-font-ko

%lang lt Lithuanian 2

%lang mk Macedonian 2
%package Requires:       scalable-font-ru

%lang nb "Norwegian Bokmaal" 2

%lang nl Dutch 2

%lang nn "Norwegian Nynorsk" 2

%lang nr Ndebele 2

%lang pa-IN Punjabi 2
%package Requires:       scalable-font-pa

%lang pl Polish 2

%lang pt Portuguese 2

%lang pt-BR "Brazilian Portuguese" 2

%lang rw Kinyarwanda 2

%lang ru Russian 2
%package Requires:       scalable-font-ru

%lang sh "Latin Serbian" 2
%package Provides:       
OpenOffice_org-sh-YU:%_prefix/ooo-2.0/program/resource/sw680sh-YU.res
%package Provides:       OpenOffice_org-sh-YU = %version
%package Obsoletes:      OpenOffice_org-sh-YU < %version

%lang sk Slovak 2

%lang sl Slovene 2

%lang sr Serbian 2
%package Requires:       scalable-font-ru
%package Provides:       
OpenOffice_org-sr-CS:%_prefix/ooo-2.0/program/resource/sw680sr-CS.res
%package Provides:       OpenOffice_org-sr-CS = %version
%package Obsoletes:      OpenOffice_org-sr-CS < %version

%lang ss Swazi 2

%lang st Sotho 2

%lang sv Swedish 2

%lang tg Tajiki 2

%lang th Thai 2

%lang tr Turkish 2

%lang ts Tsonga 2

%lang uk Ukrainian 2

%lang ve Venda 2

%lang vi Vietnamese 2

%lang xh Xhosa 2

%lang zh-CN "Chinese Simplified" 2
%package Requires:       scalable-font-zh-CN

%lang zh-TW "Chinese Traditional" 2
%package Requires:       scalable-font-zh-TW

%lang zu Zulu 2
++++++ lo-l10n-gen-spec ++++++
--- /var/tmp/diff_new_pack.6Soxg2/_old  2012-04-04 16:41:38.000000000 +0200
+++ /var/tmp/diff_new_pack.6Soxg2/_new  2012-04-04 16:41:38.000000000 +0200
@@ -3,61 +3,74 @@
 # This script changes the definite article of ProductName
 
 use strict;
+use File::Copy;
+
+my $args = join ' ',  @ARGV;
+my $max_level = 2;
 
 sub init_lang_data($$$$)
 {
-    my ($datap, $lang_code, $long_name, $level) = @_;
+    my ($pdata, $lang_code, $long_name, $level) = @_;
 
     my $curLang;
-    my $locale;
-    # we support the syntax: package_lang_code[/ooo_source_lang_code]
+    my $upstreamLang;
+    # we support the syntax: package_lang_code[/lo_source_lang_code]
     if ($lang_code =~ m/([\w\-]+)\/?([\w\-]+)?/) {
        $curLang = "$1";
        if (defined $2) {
-           $locale = "$2";
+           $upstreamLang = "$2";
        } else {
-           $locale = $curLang;
-           $locale =~ s/-/_/g;
+           $upstreamLang = $curLang;
        }
     } else {
        die "Syntax error: unknown format of the language code: $lang_code, 
line $.";
     }
 
-    $datap->{$curLang}{'long_name'} = $long_name;
-    $datap->{$curLang}{'level'} = $level;
-    $datap->{$curLang}{'locale'} = $locale;
-    $datap->{$curLang}{'package-l10n'} = ();
-    $datap->{$curLang}{'package-help'} = ();
+    % {$pdata->{'lang'}{$curLang}} = ();
+    my $pld = \% {$pdata->{'lang'}{$curLang}};
+
+    $pld->{'long_name'} = $long_name;
+    $pld->{'level'} = $level;
+    $pld->{'locale'} = $upstreamLang;
+    $pld->{'locale'} =~ s/-/_/g;
+    $pld->{'package'} = ();
+
+    ($level <= $max_level) || die "Error: Maximum allowed level is $max_level, 
line $.";
+    foreach my $l ($level .. $max_level) {
+       @ {$pdata->{'level_langs_list'}[$l]} = () unless (defined 
$pdata->{'level_langs_list'}[$l]);
+       push @ {$pdata->{'level_langs_list'}[$l]}, $upstreamLang;
+       $l++;
+    }
 
-    return $curLang;
+    return $pld;
 }
 
 sub read_data($$)
 {
-    my ($data_file, $datap) = @_;
-    my $curLang;
+    my ($pdata, $data_file) = @_;
+    # pointer to locale data
+    my $pld = undef;
+
+    $pdata->{'max_group'} = 0;
+    $pdata->{'level_langs_list'} = ();
+    @ {$pdata->{'level_langs_list'}[$_]} = () foreach (0 .. $max_level);
 
     open DATA , "< $data_file" or die "Can't open '$data_file'\n";
 
     while( my $line = <DATA>){
        chomp $line;
-       $line =~ s/#.*//;       # remove comments
+       # ignore comments
+       $line =~ s/#.*$//;
        if ($line =~ m/^\s*\%lang\s+([\w\-\/]+)\s+(\w+)\s+(\d+)\s*$/ ) {
            # long name without without quotation marks, e.g. %lang de German 1
-           $curLang = init_lang_data($datap, "$1", "$2", "$3");
+           $pld = init_lang_data($pdata, "$1", "$2", "$3");
        } elsif ( $line =~ 
m/^\s*\%lang\s+([\w\-\/]+)\s+\"([\w\s]+)\"\s+(\d+)\s*$/ ) {
            # long name with with quotation marks, e.g. %lang br "Breton 
French" 2
-           $curLang = init_lang_data($datap, "$1", "$2", "$3");
+           $pld = init_lang_data($pdata, "$1", "$2", "$3");
        } elsif ( $line =~ /^\s*\%poor-help\s*$/ ) {
-           $datap->{$curLang}{'poor-help'} = 1;
-       } elsif ( $line =~ /^\s*\%package-l10n\s+(.*)$/ ) {
-           push @ {$datap->{$curLang}{'package-l10n'}}, "$1";
-       } elsif ( $line =~ /^\s*\%package-help\s+(.*)$/ ) {
-           push @ {$datap->{$curLang}{'package-help'}}, "$1";
-       } elsif ( $line =~ /^\s*\%files-l10n\s+(.*)$/ ) {
-           push @ {$datap->{$curLang}{'files-l10n'}}, "$1";
-       } elsif ( $line =~ /^\s*\%files-help\s+(.*)$/ ) {
-           push @ {$datap->{$curLang}{'files-help'}}, "$1";
+           $pld->{'poor-help'} = 1;
+       } elsif ( $line =~ /^\s*\%package\s+(.*)$/ ) {
+           push @ {$pld->{'package'}}, "$1";
        } elsif ( $line =~ /^\s*$/ ) {
            # ignore empty line
        } else {
@@ -67,228 +80,224 @@
     close(DATA);
 }
 
-sub write_generated_section_start($)
-{
-    my ($pARGV) = @_;
-
-    print "####################################################\n";
-    print "# DO NOT EDIT THIS SECTION!\n";
-    print "# Start of a section generated by\n";
-    print "# lo-l10n-gen-spec " . join(' ', @{$pARGV}) . "\n";
-    print "####################################################\n";
-}
-
-sub write_generated_section_end()
-{
-    print "####################################################\n";
-    print "# End of a section generated by lo-l10n-gen-spec\n";
-    print "####################################################\n";
-    print "\n";
-}
-
-sub write_section_comment($)
-{
-    my ($section_name) = @_;
-
-    print "#\n";
-    print "# $section_name\n";
-    print "#\n";
-    print "\n";
 
-}
+##################################
+# conditional lines
 
-sub write_level_begin($$)
+sub write_level_begin($$$)
 {
-    my ($curLevel, $newLevel) = @_;
+    my ($curLevel, $newLevel, $outp) = @_;
 
     if ($curLevel != $newLevel) {
-       print "\n";
-       print "%endif\n"                                if ($curLevel > 0);
-       print "%if %test_build_langs >= $newLevel\n"    if ($newLevel > 0);
+       ${$outp} .= "%endif\n"                          if ($curLevel > 0);
+       ${$outp} .= "%if %test_build_langs >= $newLevel\n"      if ($newLevel > 
0);
+        ${$outp} .= "\n"                               if ($curLevel > 0);
     }
 
     return $newLevel;
 }
 
-sub write_level_end($)
+sub write_level_end($$)
 {
-    my ($curLevel) = @_;
+    my ($curLevel, $outp) = @_;
 
     if ($curLevel > 0) {
-       print "%endif\n";
+       ${$outp} .= "%endif\n";
     }
 
     return 0;
 }
 
-sub write_l10n_package_section($$)
+##############################
+# simple sections
+
+sub write_do_not_edit_section($)
 {
-    my ($datap, $curLang) = @_;
+    my $out = 
"###################################################################\n" .
+              "## DO NOT EDIT THIS SPEC FILE\n" .
+              "## Generated by:\n" .
+              "## perl lo-l10n-gen-spec $args\n" .
+              
"###################################################################";
+    return $out;
+}
 
-    return if ("$curLang" eq "en-US"); # we do not have the l10n-en-US package
 
-    print "\n";
-    print "%package -n libreoffice-l10n-$curLang\n";
-    print "Summary:        $datap->{$curLang}{'long_name'} Localization Files 
for LibreOffice\n";
-    print "Group:          Productivity/Office/Suite\n";
-    print "Provides:       locale(libreoffice:$datap->{$curLang}{'locale'})\n";
-    print "PreReq:         libreoffice = %version\n";
-    print "# compat stuff\n";
-    print "Provides:       OpenOffice_org-$curLang = %version\n";
-    print "Obsoletes:      OpenOffice_org-$curLang <= %version\n";
-    print "Provides:       OpenOffice_org-l10n-$curLang = %version\n";
-    print "Obsoletes:      OpenOffice_org-l10n-$curLang <= %version\n";
-    print "Provides:       
OpenOffice_org-$curLang:%_prefix/ooo-2.0/program/resource/sw680$curLang.res\n";
+##############################
+# all langs sections
+
+sub write_metadata_section($$)
+{
+    my ($pdata, $curLang) = @_;
+    my $pld = \% {$pdata->{'lang'}{$curLang}};
+    my $out = "";
+
+    $out .= "%package -n libreoffice-l10n-$curLang\n";
+    $out .= "Summary:        $pld->{'long_name'} Localization Files for 
LibreOffice\n";
+    $out .= "Group:          Productivity/Office/Suite\n";
+    $out .= "Provides:       locale(libreoffice:$pld->{'locale'})\n";
+    $out .= "%if 0%{?suse_version} > 01120\n";
+    $out .= "Requires(post):   coreutils\n";
+    $out .= "Requires(post):   grep\n";
+    $out .= "Requires(post):   libreoffice >= 3.5\n";
+    $out .= "Requires(postun): coreutils\n";
+    $out .= "Requires(postun): grep\n";
+    $out .= "Requires(postun): libreoffice >= 3.5\n";
+    $out .= "%endif\n";
+    $out .= "%if 0%{?suse_version} && 0%{?suse_version} <= 01120\n";
+    $out .= "PreReq:         coreutils\n";
+    $out .= "PreReq:         grep\n";
+    $out .= "PreReq:         libreoffice >= 3.5\n";
+    $out .= "%endif\n";
+    $out .= "Requires:       libreoffice = %{version}\n";
+    foreach  my $line (@{$pld->{'package'}}) {
+        $out .= "$line\n";
+    }
+    $out .= "# compat stuff\n";
+    $out .= "Provides:       OpenOffice_org-$curLang = %{version}\n";
+    $out .= "Obsoletes:      OpenOffice_org-$curLang <= %{version}\n";
+    $out .= "Provides:       OpenOffice_org-l10n-$curLang = %{version}\n";
+    $out .= "Obsoletes:      OpenOffice_org-l10n-$curLang <= %{version}\n";
+    $out .= "Provides:       
OpenOffice_org-$curLang:%{_prefix}/ooo-2.0/program/resource/sw680$curLang.res\n";
+
+    $out .= "\n";
+
+    $out .= "%description -n libreoffice-l10n-$curLang\n";
+    $out .= "$pld->{'long_name'} localization files for LibreOffice.\n";
+    $out .= "\n";
+    
+    return $out;
+}
 
-    foreach  my $line (@{$datap->{$curLang}{'package-l10n'}}) {
-        print "$line\n";
-    }
+sub write_install_scripts_section($$)
+{
+    my ($pdata, $curLang) = @_;
+    my $pld = \% {$pdata->{'lang'}{$curLang}};
+    my $out = "";
 
-    print "\n";
+    $out .= "# $curLang\n";
+    $out .= "%posttrans -n libreoffice-l10n-$curLang\n";
+    $out .= "%{_datadir}/%ooo_home/link-to-ooo-home 
%{_datadir}/%ooo_home/lang_$pld->{'locale'}_list.txt || true\n";
+    $out .= "\n";
+    $out .= "%preun -n libreoffice-l10n-$curLang\n";
+    $out .= "test \"\$1\" = \"0\" && cp 
%{_datadir}/%ooo_home/lang_$pld->{'locale'}_list.txt 
%{_datadir}/%ooo_home/lang_$pld->{'locale'}_list.txt.postun || true\n";
+    $out .= "\n";
+    $out .= "%postun -n libreoffice-l10n-$curLang\n";
+    $out .= "test \"\$1\" = \"0\" && %{_datadir}/%ooo_home/link-to-ooo-home 
--unlink %{_datadir}/%ooo_home/lang_$pld->{'locale'}_list.txt.postun || true\n";
+    $out .= "rm -f %{_datadir}/%ooo_home/lang_$pld->{'locale'}_list.txt.postun 
2>/dev/null\n";
 
-    print "%description -n libreoffice-l10n-$curLang\n";
-    print "$datap->{$curLang}{'long_name'} localization files for 
LibreOffice.\n";
-    print "The localized help content is in libreoffice-help-$curLang.\n" 
unless (defined $datap->{$curLang}{'poor-help'});
-    print "\n";
-    print "\n";
+    return $out;
 }
 
-sub write_help_package_section($$)
+sub write_files_section($$)
 {
-    my ($datap, $curLang) = @_;
-    my $oldPackage;
+    my ($pdata, $curLang) = @_;
+    my $pld = \% {$pdata->{'lang'}{$curLang}};
+    my $out = "";
 
-    return if (defined $datap->{$curLang}{'poor-help'});
-
-    if ("$curLang" eq "en-US") {
-       $oldPackage = "OpenOffice_org";
-    } else {
-       $oldPackage = "OpenOffice_org-$curLang";
-    }
-
-    print "\n";
-    print "%package -n OpenOffice_org-help-$curLang\n";
-    print "License:        LGPL-3.0\n";
-    print "Summary:        $datap->{$curLang}{'long_name'} Help Localization 
for LibreOffice\n";
-    print "Group:          Productivity/Office/Suite\n";
-    print "Provides:       
locale(OpenOffice_org:$datap->{$curLang}{'locale'})\n";
-    print "Provides:       $oldPackage:%_prefix/ooo-2.0/help/cs/default.css\n";
-    print "PreReq:         OpenOffice_org = %version\n";
-    print "Supplements:    OpenOffice_org-l10n-$curLang\n";
+    return if ("$curLang" eq "en-US"); # we do not have the l10n-en-US package
 
-    foreach  my $line (@{$datap->{$curLang}{'package-help'}}) {
-        print "$line\n";
-    }
+    $out .= "%files -f lang_$pld->{'locale'}_list.txt -n 
libreoffice-l10n-$curLang\n";
+    $out .= "%defattr(-,root,root)\n";
+    $out .= "\n";
 
-    print "\n";
+    return $out;
 
-    print "%description -n OpenOffice_org-help-$curLang\n";
-    print "$datap->{$curLang}{'long_name'} help localization for LibreOffice. 
The other localized stuff\n";
-    print "is in libreoffice-l10n-$curLang.\n";
-    print "\n";
-    print "\n";
 }
 
+########################################################
+# universal writing functions
 
-sub write_l10n_scripts_section($$)
+sub write_level_langs($$)
 {
-    my ($datap, $curLang) = @_;
+    my ($pdata, $level) = @_;
 
-    return if ("$curLang" eq "en-US"); # we do not have the l10n-en-US package
+    my $out = "";
+    foreach my $curLang (sort keys %{$pdata->{'lang'}}) {
+       $out .= " $curLang" if ($level >= $pdata->{'lang'}{$curLang}{'level'});
+    }
+    $out =~ s/^ //;
+    $out =~ s/_/-/g;
 
-    print "# $curLang\n";
-    print "%posttrans -n libreoffice-l10n-$curLang\n";
-    print "%_datadir/%ooo_home/link-to-ooo-home 
%_datadir/%ooo_home/lang_$datap->{$curLang}{'locale'}_list.txt || true\n";
-    print "\n";
-    print "%preun -n libreoffice-l10n-$curLang\n";
-    print "test \"\$1\" = \"0\" && cp 
%_datadir/%ooo_home/lang_$datap->{$curLang}{'locale'}_list.txt 
%_datadir/%ooo_home/lang_$datap->{$curLang}{'locale'}_list.txt.postun || 
true\n";
-    print "\n";
-    print "%postun -n libreoffice-l10n-$curLang\n";
-    print "test \"\$1\" = \"0\" && %_datadir/%ooo_home/link-to-ooo-home 
--unlink %_datadir/%ooo_home/lang_$datap->{$curLang}{'locale'}_list.txt.postun 
|| true\n";
-    print "rm -f 
%_datadir/%ooo_home/lang_$datap->{$curLang}{'locale'}_list.txt.postun 
2>/dev/null\n";
-}
-
-sub write_help_scripts_section($$)
-{
-    my ($datap, $curLang) = @_;
-
-    return if (defined $datap->{$curLang}{'poor-help'});
-
-    print "# $curLang\n";
-    print "%posttrans -n libreoffice-help-$curLang\n";
-    print "%_datadir/%ooo_home/link-to-ooo-home 
%_datadir/%ooo_home/lang_$datap->{$curLang}{'locale'}_list.txt || true\n";
-    print "\n";
-    print "%preun -n libreoffice-help-$curLang\n";
-    print "test \"\$1\" = \"0\" && cp 
%_datadir/%ooo_home/lang_$datap->{$curLang}{'locale'}_list.txt 
%_datadir/%ooo_home/lang_$datap->{$curLang}{'locale'}_list.txt.postun || 
true\n";
-    print "\n";
-    print "%postun -n libreoffice-help-$curLang\n";
-    print "test \"\$1\" = \"0\" && %_datadir/%ooo_home/link-to-ooo-home 
--unlink %_datadir/%ooo_home/lang_$datap->{$curLang}{'locale'}_list.txt.postun 
|| true\n";
-    print "rm -f 
%_datadir/%ooo_home/lang_$datap->{$curLang}{'locale'}_list.txt.postun 
2>/dev/null\n";
+    return $out;
 }
 
-sub write_l10n_files_section($$)
+# the text is not repeated for each locale
+sub write_simple_section($$)
 {
-    my ($datap, $curLang) = @_;
+    my ($pdata, $write_section) = @_;
 
-    return if ("$curLang" eq "en-US"); # we do not have the l10n-en-US package
+    return & {$write_section} ($pdata);
+}
 
-    print "\n";
-    print "%files -f lang_$datap->{$curLang}{'locale'}_list.txt -n 
libreoffice-l10n-$curLang\n";
-    print "%defattr(-,root,root)\n";
+# the text is repeated for each locale
+# it is used on all distributions
+sub write_locale_sections($$)
+{
+    my ($pdata, $write_single_lang_section, $outp) = @_;
+    my $curLevel = 0;
+    my $out = "";
 
-    foreach  my $line (@{$datap->{$curLang}{'files-l10n'}}) {
-        print "$line\n";
+    foreach my $curLang (sort keys %{$pdata->{'lang'}}) {
+       $curLevel = write_level_begin($curLevel, 
$pdata->{'lang'}{$curLang}{'level'}, \$out);
+       $out .= & {$write_single_lang_section} ($pdata, $curLang);
     }
+
+    $curLevel = write_level_end($curLevel, \$out);
+    
+    return $out;
 }
 
-sub write_help_files_section($$$)
+########################################################
+# main write function
+
+sub write_spec($$)
 {
-    my ($datap, $curLang) = @_;
+    my ($pdata, $spec_template) = @_;
 
-    return if (defined $datap->{$curLang}{'poor-help'});
+    my $do_not_edit = write_simple_section ($pdata, 
\&write_do_not_edit_section);
+    my $metadata = write_locale_sections ($pdata, \&write_metadata_section);
+    my $install_scripts = write_locale_sections ($pdata, 
\&write_install_scripts_section);
+    my $files = write_locale_sections ($pdata, \&write_files_section);
 
-    print "\n";
-    print "%files -f lang_$datap->{$curLang}{'locale'}_list.txt -n 
libreoffice-help-$curLang\n";
-    print "%defattr(-,root,root)\n";
+    my $spec = $spec_template;
+    $spec =~ s/.in$//;
 
-    foreach  my $line (@{$datap->{$curLang}{'files-help'}}) {
-        print "$line\n";
-    }
-}
+    print "Generating $spec...\n";
 
-sub write_lang_section($$$)
-{
-    my ($datap, $write_single_lang_section, $section_name) = @_;
-    my $curLevel = 0;
+    open TEMPLATE , "< $spec_template" or die "Can't open '$spec_template'\n";
+    open SPEC , "> $spec" or die "Can't open '$spec for writing'\n";
 
-    write_section_comment($section_name);
-    
-    foreach my $curLang (sort keys %{$datap}) {
-       $curLevel = write_level_begin($curLevel, $datap->{$curLang}{'level'});
-       & {$write_single_lang_section} ($datap, $curLang);
+    while( my $line = <TEMPLATE>) {
+       foreach my $level (0..2) {
+           my $level_langs = write_level_langs($pdata, $level);
+           $line =~ s/\@OOO_LANGS_MIN_$level\@/$level_langs/;
+       }
+       $line =~ s/\@DO_NOT_EDIT_COMMENT\@/$do_not_edit/;
+       $line =~ s/\@METADATA\@/$metadata/;
+       $line =~ s/\@INSTALL_SCRIPTS\@/$install_scripts/;
+       $line =~ s/\@FILES\@/$files/;
+
+       print SPEC $line;
     }
 
-    $curLevel = write_level_end($curLevel);
+    close(TEMPLATE);
+    close(SPEC);
 }
 
 sub usage()
 {
-    print "This tool generates pieces of the l10n and help spec files\n\n" .
+    print "This tool generates the l10n spec file\n\n" .
 
           "Usage:\n".
-         "\tooo-l10n-gen-spec [--help] [--gen-l10n|--gen-help] 
data_file...\n\n" .
-       
-         "Options:\n" .
-         "\t--help: prints this help\n" .
-         "\t--gen-l10n: print onyl the l10n pieces\n" .
-         "\t--gen-help: print only the help pieces\n" .
-         "\tdata_file: input file\n";
+         "\tlo-l10n-gen-spec [--help] spec_template.in data_file\n\n";
 }
 
-
 # info about localizations
-# it is a hash, the key is the lang id, e.g. "en-US", the value is:
-#        a hash, keys introduce perl-like structure items:
+# it is a hash, keys introduce perl-like structure items:
+#       'level_langs_list'      ... array, index is the level number, value is 
an array of
+#                                  the localizations defined for the givel 
level
+#       'lang'                 ...the key is the lang id, e.g. "en-US", the 
value is:
+#                                 a hash, keys introduce perl-like structure 
items:
 #            'long_name'               ... string, long name of the language, 
e.g. "American"
 #            'level'                   ... integer, level in whih it should 
get build, e.g. '1'
 #                                          it is the level in the rpm spec to 
do a reduced build
@@ -297,52 +306,30 @@
 #                                          e.g. "en_US"; ot it might differ 
from the package lang code if
 #                                          upstream renamed it later, for 
example, "gu-IN" was renamed to
 #                                          "gu" in ooo320-m5
-#            'poor-help'               ... integer, is defined when the help 
is poor and the help package
-#                                          is not created
 #            'package-l10n'            ... array of strings that should be 
added to the %package section for
 #                                           the given language
-#            'package-help'            ... array of strings that should be 
added to the %package section for
-#                                           the given help package
-#            'files-l10n'              ... array of strings that should be 
added to the %files section for
-#                                           the given language
-#            'package-help'            ... array of strings that should be 
added to the %files section for
-#                                           the given help package
 my %data;
-my $l10n = 1;
-my $help = 1;
-
+my $spec_template;
+my $data_file;
 
 for my $arg (@ARGV) {
     if ($arg eq '--help' || $arg eq '-h') {
        usage;
        exit 0;
-    } elsif ($arg =~ m/--gen-l10n/) {
-       $l10n = 1;
-       $help = 0;
-    } elsif ($arg =~ m/--gen-help/) {
-       $l10n = 0;
-       $help = 1;
     } else {
-       if (-f $arg) {
-           read_data($arg, \%data);
+       -f $arg || die "Error: The file does not exist: $arg\n";
+       if (! defined $spec_template) {
+           $spec_template = $arg;
+       } elsif (! defined $data_file) {
+           $data_file = $arg;
        } else {
-           die "File does not exist: $arg\n";
+           die "Error: Too many arguments!\n";
        }
     }
 }
 
-write_generated_section_start(\@ARGV);
-write_lang_section(\%data, \&write_l10n_package_section, "l10n packages") if 
($l10n);
-write_lang_section(\%data, \&write_help_package_section, "help packages") if 
($help);
-write_generated_section_end();
-
-write_generated_section_start(\@ARGV);
-print "# FIXME: call script that links noarch stuff to the ooo-home\n";
-print "# it will be better to fix OOo to find the noarch stuff\n";
-print "# on the right place\n";
-print "\n";
-write_lang_section(\%data, \&write_l10n_scripts_section, "l10n scripts") if 
($l10n);
-write_lang_section(\%data, \&write_help_scripts_section, "help scripts") if 
($help);
-write_lang_section(\%data, \&write_l10n_files_section, "l10n files") if 
($l10n);
-write_lang_section(\%data, \&write_help_files_section, "help files") if 
($help);
-write_generated_section_end();
+die "Error: Spec file template is not defined, try --help" unless (defined 
$spec_template);
+die "Error: Data file is not defined, try --help" unless (defined $data_file);
+
+read_data(\%data, $data_file);
+write_spec(\%data, $spec_template);

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to