diff options
| author | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:18:21 +0100 |
|---|---|---|
| committer | Michael Stahl <mstahl@redhat.com> | 2012-01-28 20:18:21 +0100 |
| commit | 97a0d15e61e991e84e6229ea90f6fc7fc301b379 (patch) | |
| tree | 1420a4a22edf83393ce9921cc2bb90ad607d9042 /solenv/bin/modules/pre2par | |
| parent | f9aa949d90236c3e64450544c62e62d997a55b45 (diff) | |
replace obsolete "master" branch with README that points at new repoHEADmaster-deletedmaster
Diffstat (limited to 'solenv/bin/modules/pre2par')
| -rw-r--r-- | solenv/bin/modules/pre2par/directory.pm | 54 | ||||
| -rw-r--r-- | solenv/bin/modules/pre2par/existence.pm | 74 | ||||
| -rw-r--r-- | solenv/bin/modules/pre2par/exiter.pm | 70 | ||||
| -rw-r--r-- | solenv/bin/modules/pre2par/files.pm | 125 | ||||
| -rw-r--r-- | solenv/bin/modules/pre2par/globals.pm | 68 | ||||
| -rw-r--r-- | solenv/bin/modules/pre2par/language.pm | 147 | ||||
| -rw-r--r-- | solenv/bin/modules/pre2par/parameter.pm | 178 | ||||
| -rw-r--r-- | solenv/bin/modules/pre2par/pathanalyzer.pm | 75 | ||||
| -rw-r--r-- | solenv/bin/modules/pre2par/remover.pm | 67 | ||||
| -rw-r--r-- | solenv/bin/modules/pre2par/systemactions.pm | 206 | ||||
| -rw-r--r-- | solenv/bin/modules/pre2par/work.pm | 363 |
11 files changed, 0 insertions, 1427 deletions
diff --git a/solenv/bin/modules/pre2par/directory.pm b/solenv/bin/modules/pre2par/directory.pm deleted file mode 100644 index 2637843ad..000000000 --- a/solenv/bin/modules/pre2par/directory.pm +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -package pre2par::directory; - -use pre2par::pathanalyzer; -use pre2par::systemactions; - -############################################ -# Checking, whether the output directories -# exist. If not, they are created. -############################################ - -sub check_directory -{ - my ($parfilename) = @_; - - my $productdirectory = $parfilename; - pre2par::pathanalyzer::get_path_from_fullqualifiedname(\$productdirectory); - $productdirectory =~ s/\Q$pre2par::globals::separator\E\s*$//; - - my $pardirectory = $productdirectory; - pre2par::pathanalyzer::get_path_from_fullqualifiedname(\$pardirectory); - $pardirectory =~ s/\Q$pre2par::globals::separator\E\s*$//; - - if ( ! -d $pardirectory ) { pre2par::systemactions::create_directory($pardirectory); } - if ( ! -d $productdirectory ) { pre2par::systemactions::create_directory($productdirectory); } -} - -1;
\ No newline at end of file diff --git a/solenv/bin/modules/pre2par/existence.pm b/solenv/bin/modules/pre2par/existence.pm deleted file mode 100644 index 3bbdd64b6..000000000 --- a/solenv/bin/modules/pre2par/existence.pm +++ /dev/null @@ -1,74 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - - -package pre2par::existence; - -############################# -# Test of existence -############################# - -sub exists_in_array -{ - my ($searchstring, $arrayref) = @_; - - my $alreadyexists = 0; - - for ( my $i = 0; $i <= $#{$arrayref}; $i++ ) - { - if ( ${$arrayref}[$i] eq $searchstring) - { - $alreadyexists = 1; - last; - } - } - - return $alreadyexists; -} - -sub exists_in_array_of_hashes -{ - my ($searchkey, $searchvalue, $arrayref) = @_; - - my $hashref; - my $valueexists = 0; - - for ( my $i = 0; $i <= $#{$arrayref}; $i++ ) - { - $hashref = ${$arrayref}[$i]; - - if ( $hashref->{$searchkey} eq $searchvalue ) - { - $valueexists = 1; - last; - } - } - - return $valueexists; -} - -1; diff --git a/solenv/bin/modules/pre2par/exiter.pm b/solenv/bin/modules/pre2par/exiter.pm deleted file mode 100644 index 72909e89a..000000000 --- a/solenv/bin/modules/pre2par/exiter.pm +++ /dev/null @@ -1,70 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -package pre2par::exiter; - -use pre2par::files; -use pre2par::globals; - -############################################ -# Exiting the program with an error -# This function is used instead of "die" -############################################ - -sub exit_program -{ - my ($message, $function) = @_; - - my $infoline; - - $infoline = "\n***************************************************************\n"; - push(@pre2par::globals::logfileinfo, $infoline); - print("$infoline"); - - $infoline = "$message\n"; - push(@pre2par::globals::logfileinfo, $infoline); - print("$infoline"); - - $infoline = "in function: $function\n"; - push(@pre2par::globals::logfileinfo, $infoline); - print("$infoline"); - - $infoline = "***************************************************************\n"; - push(@pre2par::globals::logfileinfo, $infoline); - - if ($pre2par::globals::logging) - { - pre2par::files::save_file($pre2par::globals::logfilename ,\@pre2par::globals::logfileinfo); - print("Saved logfile: $pre2par::globals::logfilename\n"); - } - - print("$infoline"); - - exit(-1); -} - -1; diff --git a/solenv/bin/modules/pre2par/files.pm b/solenv/bin/modules/pre2par/files.pm deleted file mode 100644 index 212c7433b..000000000 --- a/solenv/bin/modules/pre2par/files.pm +++ /dev/null @@ -1,125 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -package pre2par::files; - -use pre2par::exiter; - -############################################ -# File Operations -############################################ - -sub check_file -{ - my ($arg) = @_; - - if(!( -f $arg )) - { - pre2par::exiter::exit_program("ERROR: Cannot find file $arg", "check_file"); - } -} - -sub read_file -{ - my ($localfile) = @_; - - my @localfile = (); - - open( IN, "<$localfile" ) || pre2par::exiter::exit_program("ERROR: Cannot open file: $localfile", "read_file"); - while ( <IN> ) { push(@localfile, $_); } - close( IN ); - - return \@localfile; -} - -########################################### -# Saving files, arrays and hashes -########################################### - -sub save_file -{ - my ($savefile, $savecontent) = @_; - if (-f $savefile) { unlink $savefile }; - if (-f $savefile) { pre2par::exiter::exit_program("ERROR: Cannot delete existing file: $savefile", "save_file"); }; - open( OUT, ">$savefile" ); - print OUT @{$savecontent}; - close( OUT); - if (! -f $savefile) { pre2par::exiter::exit_program("ERROR: Cannot write file: $savefile", "save_file"); } -} - -sub save_hash -{ - my ($savefile, $hashref) = @_; - - my @printcontent = (); - - my ($itemkey, $itemvalue, $line); - - foreach $itemkey ( keys %{$hashref} ) - { - $line = ""; - $itemvalue = $hashref->{$itemkey}; - $line = $itemkey . "=" . $itemvalue . "\n"; - push(@printcontent, $line); - } - - open( OUT, ">$savefile" ); - print OUT @printcontent; - close( OUT); -} - -sub save_array_of_hashes -{ - my ($savefile, $arrayref) = @_; - - my @printcontent = (); - - my ($itemkey, $itemvalue, $line, $hashref); - - for ( my $i = 0; $i <= $#{$arrayref}; $i++ ) - { - $line = ""; - $hashref = ${$arrayref}[$i]; - - foreach $itemkey ( keys %{$hashref} ) - { - $itemvalue = $hashref->{$itemkey}; - - $line = $line . $itemkey . "=" . $itemvalue . "\t"; - } - - $line = $line . "\n"; - - push(@printcontent, $line); - } - - open( OUT, ">$savefile" ); - print OUT @printcontent; - close( OUT); -} - -1; diff --git a/solenv/bin/modules/pre2par/globals.pm b/solenv/bin/modules/pre2par/globals.pm deleted file mode 100644 index 4ad568a2c..000000000 --- a/solenv/bin/modules/pre2par/globals.pm +++ /dev/null @@ -1,68 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - - -package pre2par::globals; - -############################################ -# Global settings -############################################ - -BEGIN -{ - $prog="pre2par"; - - $prefilename = ""; - $parfilename = ""; - $langfilename = ""; - - @allitems = ("Installation", "ScpAction", "HelpText", "Directory", "DataCarrier", "StarRegistry", "File", - "Shortcut", "Custom", "Unixlink", "Procedure", "Module", "Profile", "ProfileItem", - "Folder", "FolderItem", "RegistryItem", "StarRegistryItem", "WindowsCustomAction", - "MergeModule"); - - $logging = 0; - $logfilename = "logfile.log"; # the default logfile name for global errors - @logfileinfo = (); - - $plat = $^O; - - $separator = "/"; - $pathseparator = "\:"; - $isunix = 1; - $iswin = 0; - - $islinux = 0; - $issolaris = 0; - - if ( $plat =~ /linux/i ) { $islinux = 1; } - if ( $plat =~ /kfreebsd/i ) { $islinux = 1; } - if ( $plat =~ /solaris/i ) { $issolaris = 1; } - -} - -1; diff --git a/solenv/bin/modules/pre2par/language.pm b/solenv/bin/modules/pre2par/language.pm deleted file mode 100644 index 9d8c9e820..000000000 --- a/solenv/bin/modules/pre2par/language.pm +++ /dev/null @@ -1,147 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -package pre2par::language; - -use strict; -use pre2par::existence; - -############################################################## -# Returning a specific language string from the block -# of all translations -############################################################## - -sub get_language_string_from_language_block -{ - my ($language_block, $language) = @_; - - my $newstring = ""; - - for ( my $i = 0; $i <= $#{$language_block}; $i++ ) - { - - if ( ${$language_block}[$i] =~ /^\s*$language\s*\=\s*\"(.*)\"\s*$/ ) - { - $newstring = $1; - $newstring =~ s/\"/\\\"/g; # masquerading all '"' in the string - $newstring = "\"" . $newstring . "\""; - last; - } - } - - # defaulting to english! - - if ( $newstring eq "" ) - { - $language = "en-US"; # defaulting to english - - for ( my $i = 0; $i <= $#{$language_block}; $i++ ) - { - if ( ${$language_block}[$i] =~ /^\s*$language\s*\=\s*(\".*\")\s*$/ ) - { - $newstring = $1; - last; - } - } - } - - return $newstring; -} - -############################################ -# collecting all replace variables -# in a language file -############################################ - -sub get_all_replace_variables -{ - my ($langfile) = @_; - - my %allvars = (); - - for ( my $i = 0; $i <= $#{$langfile}; $i++ ) - { - if ( ${$langfile}[$i] =~ /^\s*\[\s*(.*?)\s*\]\s*$/ ) - { - my $variable = $1; -# print "lang block '$variable'\n"; - my @lang_block = (); - my $counter; - - # Store the complete block in all languages for a specified variable - for ( $counter = $i + 1; $counter <= $#{$langfile}; $counter++ ) { - my $line = ${$langfile}[$counter]; - last if ($line =~ /^s*\[/); # next decl. - push @lang_block, $line; - } -# print "$variable = '@lang_block'\n"; - $allvars{$variable} = \@lang_block; - $i = $counter - 1; - } - } - - return \%allvars; -} - -############################################ -# localizing the par file with the -# corresponding language file -############################################ - -sub localize -{ - my ($parfile, $langfile) = @_; - - my $replace_hash = get_all_replace_variables($langfile); - - # parse lines of the form Name (st) = STR_NAME_MODULE_HELPPACK_OC; - # for variable substitution - my $langlinere = qr/^\s*\w+\s*\(([\w-]+)\)\s*\=\s*([\w-]+)\s*;/; - for ( my $i = 0; $i <= $#{$parfile}; $i++ ) - { - my $oneline = ${$parfile}[$i]; - - if ( $oneline =~ $langlinere) { - my $language = $1; # can be "01" or "en" or "en-US" or ... - my $variable = $2; - -# print "line '$oneline' split to '$language' '$variable'\n"; - - if (defined $replace_hash->{$variable}) { - my $languageblock = $replace_hash->{$variable}; - my $newstring = get_language_string_from_language_block($replace_hash->{$variable}, $language); - if ( $newstring eq "" ) { $newstring = "\"" . $variable . "\""; } - - $oneline =~ s/$variable/$newstring/g; - - ${$parfile}[$i] = $oneline; - } - } - } -} - -1; diff --git a/solenv/bin/modules/pre2par/parameter.pm b/solenv/bin/modules/pre2par/parameter.pm deleted file mode 100644 index 5dfd87975..000000000 --- a/solenv/bin/modules/pre2par/parameter.pm +++ /dev/null @@ -1,178 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - - -package pre2par::parameter; - -use Cwd; -use pre2par::files; -use pre2par::globals; -use pre2par::systemactions; - -############################################ -# Parameter Operations -############################################ - -sub usage -{ - print <<Ende; ---------------------------------------------------------- -$pre2par::globals::prog -The following parameter are needed: --s: path to the pre file --o: path to the par file --l: path to the ulf file (mlf or jlf file) --v: log process (optional) - -Example: - -perl pre2par.pl -l test.mlf -s readme.pre -o readme.par -v - ---------------------------------------------------------- -Ende - exit(-1); -} - -##################################### -# Reading parameter -##################################### - -sub getparameter -{ - while ( $#ARGV >= 0 ) - { - my $param = shift(@ARGV); - - if ($param eq "-s") { $pre2par::globals::prefilename = shift(@ARGV); } - elsif ($param eq "-o") { $pre2par::globals::parfilename = shift(@ARGV); } - elsif ($param eq "-l") { $pre2par::globals::langfilename = shift(@ARGV); } - elsif ($param eq "-v") { $pre2par::globals::logging = 1; } - else - { - print("\n*************************************\n"); - print("Sorry, unknown parameter: $param"); - print("\n*************************************\n"); - usage(); - exit(-1); - } - } -} - -############################################ -# Controlling the fundamental parameter -# (required for every process) -############################################ - -sub control_parameter -{ - if ($pre2par::globals::prefilename eq "") - { - print "\n************************************************\n"; - print "Error: Name of the input file not set (-s)!"; - print "\n************************************************\n"; - usage(); - exit(-1); - } - - if ($pre2par::globals::parfilename eq "") - { - print "\n************************************************\n"; - print "Error: Name of the output file not set (-o)!"; - print "\n************************************************\n"; - usage(); - exit(-1); - } - - if (!($pre2par::globals::prefilename =~ /\.pre\s*$/)) - { - print "\n************************************************\n"; - print "Error: Input file is no .pre file!"; - print "\n************************************************\n"; - usage(); - exit(-1); - } - - if (!($pre2par::globals::parfilename =~ /\.par\s*$/)) - { - print "\n************************************************\n"; - print "Error: Output file is no .par file!"; - print "\n************************************************\n"; - usage(); - exit(-1); - } - - # The input file has to exist - - pre2par::files::check_file($pre2par::globals::prefilename); -} - -########################################################## -# The path parameters can be relative or absolute. -# This function creates absolute pathes. -########################################################## - -sub make_path_absolute -{ - my ($pathref) = @_; - - if ( $pre2par::globals::isunix ) - { - if (!($$pathref =~ /^\s*\//)) # this is a relative unix path - { - $$pathref = cwd() . $pre2par::globals::separator . $$pathref; - } - } - - if ( $pre2par::globals::iswin ) - { - if (!($$pathref =~ /^\s*\w\:/)) # this is a relative windows path - { - $$pathref = cwd() . $pre2par::globals::separator . $$pathref; - $$pathref =~ s/\//\\/g; - } - } - - $$pathref =~ s/\Q$pre2par::globals::separator\E\s*$//; # removing ending slashes -} - -##################################### -# Writing parameter to shell -##################################### - -sub outputparameter -{ - $pre2par::globals::logging ? ($logoption = " -v") : ($logoption = ""); - print "\n$pre2par::globals::prog -l $pre2par::globals::langfilename -s $pre2par::globals::prefilename -o $pre2par::globals::parfilename$logoption\n"; - -# print "\n********************************************************\n"; -# print "This is $pre2par::globals::prog, version 1.0\n"; -# print "Input file: $pre2par::globals::prefilename\n"; -# print "Output file: $pre2par::globals::parfilename\n"; -# print "********************************************************\n"; -} - -1; diff --git a/solenv/bin/modules/pre2par/pathanalyzer.pm b/solenv/bin/modules/pre2par/pathanalyzer.pm deleted file mode 100644 index b766a8c77..000000000 --- a/solenv/bin/modules/pre2par/pathanalyzer.pm +++ /dev/null @@ -1,75 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - - -package pre2par::pathanalyzer; - -use pre2par::globals; - -########################################### -# Path analyzer -########################################### - -sub get_path_from_fullqualifiedname -{ - my ($longfilenameref) = @_; - - if ( $$longfilenameref =~ /\Q$pre2par::globals::separator\E/ ) # Is there a separator in the path? Otherwise the path is empty. - { - if ( $$longfilenameref =~ /^\s*(\S.*\S\Q$pre2par::globals::separator\E)(\S.+?\S)/ ) - { - $$longfilenameref = $1; - } - } - else - { - $$longfilenameref = ""; # there is no path - } -} - -sub make_absolute_filename_to_relative_filename -{ - my ($longfilenameref) = @_; - - if ( $pre2par::globals::isunix ) - { - if ( $$longfilenameref =~ /^.*\/(\S.+\S?)/ ) - { - $$longfilenameref = $1; - } - } - - if ( $pre2par::globals::iswin ) - { - if ( $$longfilenameref =~ /^.*\\(\S.+\S?)/ ) - { - $$longfilenameref = $1; - } - } -} - -1; diff --git a/solenv/bin/modules/pre2par/remover.pm b/solenv/bin/modules/pre2par/remover.pm deleted file mode 100644 index adae116bf..000000000 --- a/solenv/bin/modules/pre2par/remover.pm +++ /dev/null @@ -1,67 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - - -package pre2par::remover; - -############################################ -# Remover -############################################ - -sub remove_leading_and_ending_whitespaces -{ - my ( $stringref ) = @_; - - $$stringref =~ s/^\s*//g; - $$stringref =~ s/\s*$//g; -} - -sub remove_leading_and_ending_quotationmarks -{ - my ( $stringref ) = @_; - - $$stringref =~ s/^\s*\"//g; - $$stringref =~ s/\"\s*$//g; -} - -sub remove_leading_and_ending_slashes -{ - my ( $stringref ) = @_; - - $$stringref =~ s/^\s*\///g; - $$stringref =~ s/\/\s*$//g; -} - -sub remove_leading_and_ending_backslashes -{ - my ( $stringref ) = @_; - - $$stringref =~ s/^\s*\\//g; - $$stringref =~ s/\\\s*$//g; -} - -1; diff --git a/solenv/bin/modules/pre2par/systemactions.pm b/solenv/bin/modules/pre2par/systemactions.pm deleted file mode 100644 index 1634a2d46..000000000 --- a/solenv/bin/modules/pre2par/systemactions.pm +++ /dev/null @@ -1,206 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - - -package pre2par::systemactions; - -use File::Copy; -use pre2par::exiter; -use pre2par::globals; - -###################################################### -# Creating a new direcotory -###################################################### - -sub create_directory -{ - my ($directory) = @_; - - my $returnvalue = 1; - my $infoline = ""; - - if ($directory eq "" ) - { - return 0; - } - - if (!(-d $directory)) - { - $returnvalue = mkdir($directory, 0775); - - if ($returnvalue) - { - $infoline = "Created directory: $directory\n"; - push(@pre2par::globals::logfileinfo, $infoline); - - if ($pre2par::globals::isunix) - { - my $localcall = "chmod 775 $directory \>\/dev\/null 2\>\&1"; - system($localcall); - } - } - else - { - # New solution in parallel packing: It is possible, that the directory now exists, although it - # was not created in this process. There is only an important error, if the directory does not - # exist now. - - if (!(-d $directory)) - { - pre2par::exiter::exit_program("Error: Could not create directory: $directory", "create_directory"); - } - else - { - $infoline = "\nAnother process created this directory in exactly this moment :-) : $directory\n"; - push(@pre2par::globals::logfileinfo, $infoline); - } - } - } - else - { - $infoline = "\nAlready existing directory, did not create: $directory\n"; - push(@pre2par::globals::logfileinfo, $infoline); - } -} - -####################################################################### -# Creating the directories, in which files are generated or unzipped -####################################################################### - -sub create_directories -{ - my ($directory, $languagesref) =@_; - - $pre2par::globals::unpackpath =~ s/\Q$pre2par::globals::separator\E\s*$//; # removing ending slashes and backslashes - - my $path = $pre2par::globals::unpackpath; # this path already exists - - $path = $path . $pre2par::globals::separator . $pre2par::globals::build . $pre2par::globals::separator; - create_directory($path); - - $path = $path . $pre2par::globals::minor . $pre2par::globals::separator; - create_directory($path); - - if ($directory eq "unzip" ) - { - $path = $path . "common" . $pre2par::globals::productextension . $pre2par::globals::separator; - create_directory($path); - - $path = $path . $directory . $pre2par::globals::separator; - create_directory($path); - } - else - { - $path = $path . $pre2par::globals::compiler . $pre2par::globals::productextension . $pre2par::globals::separator; - create_directory($path); - - $path = $path . $pre2par::globals::product . $pre2par::globals::separator; - create_directory($path); - - $path = $path . $directory . $pre2par::globals::separator; - create_directory($path); - - if (!($$languagesref eq "" )) # this will be a path like "01_49", for Profiles and ConfigurationFiles, idt-Files - { - $path = $path . $$languagesref . $pre2par::globals::separator; - create_directory($path); - } - } - - $path =~ s/\Q$pre2par::globals::separator\E\s*$//; - - return $path; -} - -######################## -# Copying one file -######################## - -sub copy_one_file -{ - my ($source, $dest) = @_; - - my ($copyreturn, $returnvalue, $infoline); - - $copyreturn = copy($source, $dest); - - if ($copyreturn) - { - $infoline = "Copy: $source to $dest\n"; - $returnvalue = 1; - } - else - { - $infoline = "Error: Could not copy $source to $dest $!\n"; - $returnvalue = 0; - } - - push(@pre2par::globals::logfileinfo, $infoline); - - return $returnvalue; -} - -########################################## -# Copying all files from one directory -# to another directory -########################################## - -sub copy_directory -{ - my ($sourcedir, $destdir) = @_; - - my ($onefile, $sourcefile, $destfile); - my @sourcefiles = (); - - $sourcedir =~ s/\Q$pre2par::globals::separator\E\s*$//; - $destdir =~ s/\Q$pre2par::globals::separator\E\s*$//; - - $infoline = "\n"; - push(@pre2par::globals::logfileinfo, $infoline); - $infoline = "Copying files from directory $sourcedir to directory $destdir\n"; - push(@pre2par::globals::logfileinfo, $infoline); - - opendir(DIR, $sourcedir); - @sourcefiles = readdir(DIR); - closedir(DIR); - - foreach $onefile (@sourcefiles) - { - if ((!($onefile eq ".")) && (!($onefile eq ".."))) - { - $sourcefile = $sourcedir . $pre2par::globals::separator . $onefile; - $destfile = $destdir . $pre2par::globals::separator . $onefile; - if ( -f $sourcefile ) # only files, no directories - { - copy_one_file($sourcefile, $destfile); - } - } - } -} - - -1; diff --git a/solenv/bin/modules/pre2par/work.pm b/solenv/bin/modules/pre2par/work.pm deleted file mode 100644 index 5651d060e..000000000 --- a/solenv/bin/modules/pre2par/work.pm +++ /dev/null @@ -1,363 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - - -package pre2par::work; - -use pre2par::exiter; -use pre2par::remover; -use pre2par::pathanalyzer; - -############################################ -# pre2par working module -############################################ - -############################################ -# procedure to split a line, that contains -# more than one par file lines -############################################ - -sub split_line -{ - my ($line, $parfile) = @_; - - while ( $line =~ /^((?:[^"]|\"(?:[^"\\]|\\.)*\")*?\;\s+)\s*(.*)$/ ) - { - my $oneline = $1; - $line = $2; - pre2par::remover::remove_leading_and_ending_whitespaces(\$oneline); - $oneline = $oneline . "\n"; - push(@{$parfile}, $oneline); - - if ( $line =~ /^\s*End\s+(\w+.*$)/i ) - { - $line = $1; - push(@{$parfile}, "End\n\n"); - } - } - - # the last line - - pre2par::remover::remove_leading_and_ending_whitespaces(\$line); - $line = $line . "\n"; - push(@{$parfile}, $line); - - if ( $line =~ /^\s*End\s*$/i ) { push(@{$parfile}, "\n"); } -} - -################################################################### -# Preprocessing the pre file to split all lines with semicolon -################################################################### - -sub preprocess_macros -{ - my ($prefile) = @_; - - my @newprefile = (); - - for ( my $i = 0; $i <= $#{$prefile}; $i++ ) - { - my $oneline = ${$prefile}[$i]; - if ( $oneline =~ /\;\s*\w+/ ) - { - split_line($oneline, \@newprefile); - } - else - { - push(@newprefile, $oneline); - } - } - - return \@newprefile; -} - -############################################ -# main working procedure -############################################ - -sub convert -{ - my ($prefile) = @_; - - my @parfile = (); - - my $iscodesection = 0; - my $ismultiliner = 0; - my $globalline = ""; - - # Preprocessing the pre file to split all lines with semicolon - $prefile = preprocess_macros($prefile); - - for ( my $i = 0; $i <= $#{$prefile}; $i++ ) - { - my $oneline = ${$prefile}[$i]; - - if ($iscodesection) - { - if ( $oneline =~ /^\s*\}\;\s*$/ ) - { - $iscodesection = 0; - } - else # nothing to do for code inside a code section - { - push(@parfile, $oneline); - next; - } - } - - if ( $oneline =~ /^\s*$/ ) { next; } - - if ( $oneline =~ /^\s*Code\s+\=\s+\{/ ) - { - $iscodesection = 1; - } - - pre2par::remover::remove_leading_and_ending_whitespaces(\$oneline); - - my $insertemptyline = 0; - - if ( $oneline =~ /^\s*End\s*$/i ) { $insertemptyline = 1; } - - # Sometimes the complete file is in one line, then the gid line has to be separated - - if ( $oneline =~ /^\s*(\w+\s+\w+)\s+(\w+\s+\=.*$)/ ) # three words before the equal sign - { - my $gidline = $1; - $oneline = $2; - $gidline = $gidline . "\n"; - - push(@parfile, $gidline); - } - - if ( $oneline =~ /\;\s*\w+/ ) - { - split_line($oneline, \@parfile); - next; - } - - # searching for lines with brackets, like Customs = { ..., which can be parted above several lines - - if ( $oneline =~ /^\s*\w+\s+\=\s*\(.*\)\s*\;\s*$/ ) # only one line - { - if (( ! ( $oneline =~ /^\s*Assignment\d+\s*\=/ )) && ( ! ( $oneline =~ /^\s*PatchAssignment\d+\s*\=/ ))) - { - $oneline =~ s/\s//g; # removing whitespaces in lists - $oneline =~ s/\=/\ \=\ /; # adding whitespace around equals sign - } - } - - if ( $oneline =~ /^\s*\w+\s+\=\s*$/ ) - { - $oneline =~ s/\s*$//; - pre2par::exiter::exit_program("Error: Illegal syntax, no line break after eqals sign allowed. Line: \"$oneline\"", "convert"); - } - - if (( $oneline =~ /^\s*\w+\s+\=\s*\(/ ) && (!( $oneline =~ /\)\s*\;\s*$/ ))) # several lines - { - $ismultiliner = 1; - $oneline =~ s/\s//g; - $globalline .= $oneline; - next; # not including yet - } - - if ( $ismultiliner ) - { - $oneline =~ s/\s//g; - $globalline .= $oneline; - - if ( $oneline =~ /\)\s*\;\s*$/ ) { $ismultiliner = 0; } - - if (! ( $ismultiliner )) - { - $globalline =~ s/\=/\ \=\ /; # adding whitespace around equals sign - $globalline .= "\n"; - push(@parfile, $globalline); - $globalline = ""; - } - - next; - } - - $oneline = $oneline . "\n"; - - $oneline =~ s/\s*\=\s*/ \= /; # nice, to have only one whitespace around equal signs - - # Concatenate adjacent string literals: - while ($oneline =~ - s/^((?:[^"]* - \"(?:[^\\"]|\\.)*\" - (?:[^"]*[^[:blank:]"][^"]*\"(?:[^\\"]|\\.)*\")*)* - [^"]* - \"(?:[^\\"]|\\.)*) - \"[[:blank:]]*\" - ((?:[^\\"]|\\.)*\") - /\1\2/x) - {} - - push(@parfile, $oneline); - - if ($insertemptyline) { push(@parfile, "\n"); } - - } - - return \@parfile; -} - -############################################ -# formatting the par file -############################################ - -sub formatter -{ - my ($parfile) = @_; - - my $iscodesection = 0; - - my $tabcounter = 0; - my $isinsideitem = 0; - my $currentitem; - - for ( my $i = 0; $i <= $#{$parfile}; $i++ ) - { - my $oneline = ${$parfile}[$i]; - my $isitemline = 0; - - if (! $isinsideitem ) - { - for ( my $j = 0; $j <= $#pre2par::globals::allitems; $j++ ) - { - if ( $oneline =~ /^\s*$pre2par::globals::allitems[$j]\s+\w+\s*$/ ) - { - $currentitem = $pre2par::globals::allitems[$j]; - $isitemline = 1; - $isinsideitem = 1; - $tabcounter = 0; - last; - } - } - } - - if ( $isitemline ) - { - next; # nothing to do - } - - if ( $oneline =~ /^\s*end\s*$/i ) - { - $isinsideitem = 0; - $tabcounter--; - } - - if ( $isinsideitem ) - { - $oneline = "\t" . $oneline; - ${$parfile}[$i] = $oneline; - } - } -} - -################################################### -# Returning the language file name -################################################### - -sub getlangfilename -{ - return $pre2par::globals::langfilename; -} - -################################################### -# Creating the ulf file name from the -# corresponding pre file name -################################################### - -sub getulffilename -{ - my ($prefilename) = @_; - - my $ulffilename = $prefilename; - $ulffilename =~ s/\.pre\s*$/\.ulf/; - pre2par::pathanalyzer::make_absolute_filename_to_relative_filename(\$ulffilename); - - return $ulffilename; -} - -############################################ -# Checking if a file exists -############################################ - -sub fileexists -{ - my ($langfilename) = @_; - - my $fileexists = 0; - - if( -f $langfilename ) { $fileexists = 1; } - - return $fileexists; -} - -############################################ -# Checking the existence of ulf and -# jlf/mlf files -############################################ - -sub check_existence_of_langfiles -{ - my ($langfilename, $ulffilename) = @_; - - my $do_localize = 0; - - if (( fileexists($ulffilename) ) && ( ! fileexists($langfilename) )) { pre2par::exiter::exit_program("Error: Did not find language file $langfilename", "check_existence_of_langfiles"); } - if (( fileexists($ulffilename) ) && ( fileexists($langfilename) )) { $do_localize = 1; } - - return $do_localize; -} - -############################################ -# Checking that the pre file has content -############################################ - -sub check_content -{ - my ($filecontent, $filename) = @_; - - if ( $#{$filecontent} < 0 ) { pre2par::exiter::exit_program("Error: $filename has no content!", "check_content"); } -} - -############################################ -# Checking content of par files. -# Currently only size. -############################################ - -sub diff_content -{ - my ($content1, $content2, $filename) = @_; - - if ( $#{$content1} != $#{$content2} ) { pre2par::exiter::exit_program("Error: $filename was not saved correctly!", "diff_content"); } -} - -1; |
