summaryrefslogtreecommitdiff
path: root/solenv
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2021-05-27 15:40:41 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2021-05-27 19:10:19 +0200
commita04bb13513ea64fef867365d6eb0264970d58182 (patch)
tree0276ae62da7b39e849b320f2a72ee72de2d26a68 /solenv
parentcb7bf2ce168bc262d324e62888934cdf4113170d (diff)
installer-code: remove some unused or pointless subs
of course just the very tip of the iceberg, but you gotta start somewhere… Change-Id: I24ef6a51ec70c70418368da54595637283055d84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116255 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'solenv')
-rw-r--r--solenv/bin/modules/installer/remover.pm8
-rw-r--r--solenv/bin/modules/par2script/converter.pm64
-rw-r--r--solenv/bin/modules/par2script/parameter.pm1
-rw-r--r--solenv/bin/modules/par2script/remover.pm24
-rw-r--r--solenv/bin/modules/par2script/systemactions.pm170
-rw-r--r--solenv/bin/modules/pre2par/files.pm10
-rw-r--r--solenv/bin/modules/pre2par/parameter.pm14
-rw-r--r--solenv/bin/modules/pre2par/remover.pm24
-rw-r--r--solenv/bin/modules/pre2par/systemactions.pm111
-rw-r--r--solenv/bin/modules/pre2par/work.pm39
-rw-r--r--solenv/bin/pre2par.pl6
11 files changed, 11 insertions, 460 deletions
diff --git a/solenv/bin/modules/installer/remover.pm b/solenv/bin/modules/installer/remover.pm
index 1e088a63e0a1..426056eef37f 100644
--- a/solenv/bin/modules/installer/remover.pm
+++ b/solenv/bin/modules/installer/remover.pm
@@ -40,14 +40,6 @@ sub remove_leading_and_ending_quotationmarks
$$stringref =~ s/\"\s*$//;
}
-sub remove_leading_and_ending_slashes
-{
- my ( $stringref ) = @_;
-
- $$stringref =~ s/^\s*\///g;
- $$stringref =~ s/\/\s*$//g;
-}
-
sub remove_ending_pathseparator
{
my ( $stringref ) = @_;
diff --git a/solenv/bin/modules/par2script/converter.pm b/solenv/bin/modules/par2script/converter.pm
index d8323f40dc37..43c3a751f14a 100644
--- a/solenv/bin/modules/par2script/converter.pm
+++ b/solenv/bin/modules/par2script/converter.pm
@@ -25,29 +25,6 @@ use par2script::remover;
# Converter
#############################
-sub convert_array_to_hash
-{
- my ($arrayref) = @_;
-
- my ($line, $key, $value);
-
- my %newhash = ();
-
- for ( my $i = 0; $i <= $#{$arrayref}; $i++ )
- {
- $line = ${$arrayref}[$i];
-
- if ( $line =~ /^\s*(\w+?)\s+(.*?)\s*$/ )
- {
- $key = $1;
- $value = $2;
- $newhash{$key} = $value;
- }
- }
-
- return \%newhash;
-}
-
sub convert_stringlist_into_array_2
{
my ( $input, $separator ) = @_;
@@ -72,45 +49,4 @@ sub convert_stringlist_into_array_2
return \@newarray;
}
-sub convert_stringlist_into_array
-{
- my ( $includestringref, $separator ) = @_;
-
- my @newarray = ();
- my ($first, $last);
-
- $last = ${$includestringref};
-
- while ( $last =~ /^\s*(.+?)\s*\Q$separator\E\s*(.+)\s*$/) # "$" for minimal matching
- {
- $first = $1;
- $last = $2;
- par2script::remover::remove_leading_and_ending_whitespaces(\$first);
- push(@newarray, $first);
- }
-
- par2script::remover::remove_leading_and_ending_whitespaces(\$last);
- push(@newarray, $last);
-
- return \@newarray;
-}
-
-#############################################################################
-# The file name contains for some files "/". If this programs runs on
-# a windows platform, this has to be converted to "\".
-#############################################################################
-
-sub convert_slash_to_backslash
-{
- my ($filesarrayref) = @_;
-
- my ($onefile, $filename);
-
- for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
- {
- $onefile = ${$filesarrayref}[$i];
- $onefile->{'Name'} =~ s/\//\\/g;
- }
-}
-
1;
diff --git a/solenv/bin/modules/par2script/parameter.pm b/solenv/bin/modules/par2script/parameter.pm
index 645b28255686..86416cd9e265 100644
--- a/solenv/bin/modules/par2script/parameter.pm
+++ b/solenv/bin/modules/par2script/parameter.pm
@@ -22,7 +22,6 @@ package par2script::parameter;
use Cwd;
use par2script::files;
use par2script::globals;
-use par2script::systemactions;
############################################
# Parameter Operations
diff --git a/solenv/bin/modules/par2script/remover.pm b/solenv/bin/modules/par2script/remover.pm
index 4625bf0b0405..8b40a8ff46f7 100644
--- a/solenv/bin/modules/par2script/remover.pm
+++ b/solenv/bin/modules/par2script/remover.pm
@@ -39,28 +39,4 @@ sub remove_leading_and_ending_comma
$$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/par2script/systemactions.pm b/solenv/bin/modules/par2script/systemactions.pm
deleted file mode 100644
index b6e6b546b8c5..000000000000
--- a/solenv/bin/modules/par2script/systemactions.pm
+++ /dev/null
@@ -1,170 +0,0 @@
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-
-package par2script::systemactions;
-
-use File::Copy;
-use par2script::exiter;
-use par2script::globals;
-
-######################################################
-# Creating a new directory
-######################################################
-
-sub create_directory
-{
- my ($directory) = @_;
-
- my $returnvalue = 1;
-
- if (!(-d $directory))
- {
- $returnvalue = mkdir($directory, 0775);
-
- if ($returnvalue)
- {
- $infoline = "Created directory: $directory\n";
- push(@par2script::globals::logfileinfo, $infoline);
-
- if ($par2script::globals::isunix)
- {
- my $localcall = "chmod 775 $directory \>\/dev\/null 2\>\&1";
- system($localcall);
- }
- }
- else
- {
- par2script::exiter::exit_program("Error: Could not create directory: $directory", "create_directory");
- }
- }
-}
-
-#######################################################################
-# Creating the directories, in which files are generated or unzipped
-#######################################################################
-
-sub create_directories
-{
- my ($directory, $languagesref) =@_;
-
- $par2script::globals::unpackpath =~ s/\Q$par2script::globals::separator\E\s*$//; # removing ending slashes and backslashes
-
- my $path = $par2script::globals::unpackpath; # this path already exists
-
- $path = $path . $par2script::globals::separator . $par2script::globals::build . $par2script::globals::separator;
- create_directory($path);
-
- $path = $path . $par2script::globals::minor . $par2script::globals::separator;
- create_directory($path);
-
- if ($directory eq "unzip" )
- {
- }
- else
- {
- $path = $path . $par2script::globals::platformid . $par2script::globals::separator;
- create_directory($path);
-
- $path = $path . $par2script::globals::product . $par2script::globals::separator;
- create_directory($path);
-
- $path = $path . $directory . $par2script::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 . $par2script::globals::separator;
- create_directory($path);
- }
- }
-
- $path =~ s/\Q$par2script::globals::separator\E\s*$//;
-
- return $path;
-}
-
-########################
-# Copying one file
-########################
-
-sub copy_one_file
-{
- my ($source, $dest) = @_;
-
- my ($copyreturn, $returnvalue);
- my $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(@par2script::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$par2script::globals::separator\E\s*$//;
- $destdir =~ s/\Q$par2script::globals::separator\E\s*$//;
-
- $infoline = "\n";
- push(@par2script::globals::logfileinfo, $infoline);
- $infoline = "Copying files from directory $sourcedir to directory $destdir\n";
- push(@par2script::globals::logfileinfo, $infoline);
-
- opendir(DIR, $sourcedir);
- @sourcefiles = readdir(DIR);
- closedir(DIR);
-
- foreach $onefile (@sourcefiles)
- {
- if ((!($onefile eq ".")) && (!($onefile eq "..")))
- {
- $sourcefile = $sourcedir . $par2script::globals::separator . $onefile;
- $destfile = $destdir . $par2script::globals::separator . $onefile;
- if ( -f $sourcefile ) # only files, no directories
- {
- copy_one_file($sourcefile, $destfile);
- }
- }
- }
-}
-
-
-1;
diff --git a/solenv/bin/modules/pre2par/files.pm b/solenv/bin/modules/pre2par/files.pm
index af216e11a148..ddc8d9157eae 100644
--- a/solenv/bin/modules/pre2par/files.pm
+++ b/solenv/bin/modules/pre2par/files.pm
@@ -24,16 +24,6 @@ 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) = @_;
diff --git a/solenv/bin/modules/pre2par/parameter.pm b/solenv/bin/modules/pre2par/parameter.pm
index 08c2d7cd02ff..aa9fe3399a57 100644
--- a/solenv/bin/modules/pre2par/parameter.pm
+++ b/solenv/bin/modules/pre2par/parameter.pm
@@ -20,7 +20,6 @@
package pre2par::parameter;
use Cwd;
-use pre2par::files;
use pre2par::globals;
use pre2par::systemactions;
@@ -89,6 +88,15 @@ sub control_parameter
exit(-1);
}
+ if (!(-f $pre2par::globals::prefilename))
+ {
+ print "\n************************************************\n";
+ print "Error: Input file does not exist!";
+ print "\n************************************************\n";
+ usage();
+ exit(-1);
+ }
+
if ($pre2par::globals::parfilename eq "")
{
print "\n************************************************\n";
@@ -115,10 +123,6 @@ sub control_parameter
usage();
exit(-1);
}
-
- # The input file has to exist
-
- pre2par::files::check_file($pre2par::globals::prefilename);
}
#####################################
diff --git a/solenv/bin/modules/pre2par/remover.pm b/solenv/bin/modules/pre2par/remover.pm
index aa90ec4a56c4..029d09a4e419 100644
--- a/solenv/bin/modules/pre2par/remover.pm
+++ b/solenv/bin/modules/pre2par/remover.pm
@@ -31,28 +31,4 @@ sub remove_leading_and_ending_whitespaces
$$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
index c5f5e44f5f41..7848b64950ec 100644
--- a/solenv/bin/modules/pre2par/systemactions.pm
+++ b/solenv/bin/modules/pre2par/systemactions.pm
@@ -78,115 +78,4 @@ sub create_directory
}
}
-#######################################################################
-# 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" )
- {
- }
- else
- {
- $path = $path . $pre2par::globals::platformid . $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
index b05940c441b2..6ee87ec3786b 100644
--- a/solenv/bin/modules/pre2par/work.pm
+++ b/solenv/bin/modules/pre2par/work.pm
@@ -271,45 +271,6 @@ sub formatter
}
}
-###################################################
-# Returning the language file name
-###################################################
-
-sub getlangfilename
-{
- return $pre2par::globals::langfilename;
-}
-
-############################################
-# Checking if a file exists
-############################################
-
-sub fileexists
-{
- my ($langfilename) = @_;
-
- my $fileexists = 0;
-
- if( -f $langfilename ) { $fileexists = 1; }
-
- return $fileexists;
-}
-
-############################################
-# Checking the existence of ulf file
-############################################
-
-sub check_existence_of_langfiles
-{
- my ($langfilename) = @_;
-
- my $do_localize = 0;
-
- if ( fileexists($langfilename) ) { $do_localize = 1; }
-
- return $do_localize;
-}
-
############################################
# Checking that the pre file has content
############################################
diff --git a/solenv/bin/pre2par.pl b/solenv/bin/pre2par.pl
index 42c319dd2c08..28ca73312dc7 100644
--- a/solenv/bin/pre2par.pl
+++ b/solenv/bin/pre2par.pl
@@ -43,11 +43,9 @@ my $parfile = pre2par::work::convert($prefile);
pre2par::work::formatter($parfile);
-my $langfilename = pre2par::work::getlangfilename();
+my $langfilename = $pre2par::globals::langfilename;
-my $dolocalization = pre2par::work::check_existence_of_langfiles($langfilename);
-
-if ( $dolocalization )
+if ( -f $langfilename )
{
my $langfile = pre2par::files::read_file($langfilename);
pre2par::language::localize($parfile, $langfile);