Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


These three patches remove some home-grown path manipulation from
solenv, and replace it with functions shipped with the Perl core.

Kind regards,

-- 
Tim Retout <tim@retout.co.uk>
From 65e81a1935604058082929e772e2f789533eb610 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Sun, 19 Feb 2012 12:45:56 +0000
Subject: [PATCH 1/3] Remove unused pre2par::parameter::make_path_absolute

---
 solenv/bin/modules/pre2par/parameter.pm |   29 -----------------------------
 1 files changed, 0 insertions(+), 29 deletions(-)

diff --git a/solenv/bin/modules/pre2par/parameter.pm b/solenv/bin/modules/pre2par/parameter.pm
index a39dbd0..efda79d 100644
--- a/solenv/bin/modules/pre2par/parameter.pm
+++ b/solenv/bin/modules/pre2par/parameter.pm
@@ -130,35 +130,6 @@ sub control_parameter
     pre2par::files::check_file($pre2par::globals::prefilename);
 }
 
-##########################################################
-# The path parameters can be relative or absolute.
-# This function creates absolute paths.
-##########################################################
-
-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
 #####################################
-- 
1.7.8.3

From ca4f8f6a043b4883f67bb8489114eab75f5ecc21 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Sun, 19 Feb 2012 14:04:09 +0000
Subject: [PATCH 2/3] Avoid using installer::parameter in installer::ziplist

---
 solenv/bin/modules/installer/ziplist.pm |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/solenv/bin/modules/installer/ziplist.pm b/solenv/bin/modules/installer/ziplist.pm
index 5ee0bb6..6435445 100644
--- a/solenv/bin/modules/installer/ziplist.pm
+++ b/solenv/bin/modules/installer/ziplist.pm
@@ -27,10 +27,11 @@
 
 package installer::ziplist;
 
+use File::Spec::Functions qw(rel2abs);
+
 use installer::exiter;
 use installer::globals;
 use installer::logger;
-use installer::parameter;
 use installer::remover;
 use installer::systemactions;
 
@@ -702,10 +703,10 @@ sub resolve_relative_pathes
 {
     my ( $patharrayref ) = @_;
 
-    for ( my $i = 0; $i <= $#{$patharrayref}; $i++ )
+    for my $path ( @{$patharrayref} )
     {
-        installer::parameter::make_path_absolute(\${$patharrayref}[$i]);
-        simplify_path(\${$patharrayref}[$i]);
+        $path = rel2abs($path);
+        simplify_path(\$path);
     }
 }
 
-- 
1.7.8.3

From 4842da3479edaba35bdeb3044992d07a596e17e9 Mon Sep 17 00:00:00 2001
From: Tim Retout <tim@retout.co.uk>
Date: Sun, 19 Feb 2012 13:14:22 +0000
Subject: [PATCH 3/3] Replace installer::parameter::make_absolute_path.

---
 solenv/bin/modules/installer/parameter.pm |   62 +++--------------------------
 1 files changed, 6 insertions(+), 56 deletions(-)

diff --git a/solenv/bin/modules/installer/parameter.pm b/solenv/bin/modules/installer/parameter.pm
index 3ea13f8..7335c01 100644
--- a/solenv/bin/modules/installer/parameter.pm
+++ b/solenv/bin/modules/installer/parameter.pm
@@ -28,6 +28,8 @@
 package installer::parameter;
 
 use Cwd;
+use File::Spec::Functions qw(rel2abs);
+
 use installer::exiter;
 use installer::files;
 use installer::globals;
@@ -195,58 +197,6 @@ sub control_fundamental_parameter
     }
 }
 
-##########################################################
-# The path parameters can be relative or absolute.
-# This function creates absolute paths.
-##########################################################
-
-sub make_path_absolute
-{
-    my ($pathref) = @_;
-
-    if ( $installer::globals::isunix )
-    {
-        if (!($$pathref =~ /^\s*\//))   # this is a relative unix path
-        {
-            $$pathref = cwd() . $installer::globals::separator . $$pathref;
-        }
-    }
-
-    if ( $installer::globals::iswin )
-    {
-        if ( $^O =~ /cygwin/i )
-        {
-            if ( $$pathref !~ /^\s*\// && $$pathref !~ /^\s*\w\:/ ) # not an absolute POSIX or DOS 
path
-            {
-                $$pathref = cwd() . $installer::globals::separator . $$pathref;
-            }
-            my $p = $$pathref;
-            chomp( $p );
-            my $q = '';
-            # Avoid the $(LANG) problem.
-            if ($p =~ /(\A.*)(\$\(.*\Z)/) {
-                $p = $1;
-                $q = $2;
-            }
-            $p =~ s/\\/\\\\/g;
-            chomp( $p = qx{cygpath -w "$p"} );
-            $$pathref = $p.$q;
-            # Use windows paths, but with '/'s.
-            $$pathref =~ s/\\/\//g;
-        }
-        else
-        {
-            if (!($$pathref =~ /^\s*\w\:/)) # this is a relative windows path (no dos drive)
-            {
-                $$pathref = cwd() . $installer::globals::separator . $$pathref;
-
-                $$pathref =~ s/\//\\/g;
-            }
-        }
-    }
-    $$pathref =~ s/[\/\\]\s*$//;    # removing ending slashes
-}
-
 ##################################################
 # Setting some global parameters
 # This has to be expanded with furher platforms
@@ -388,7 +338,7 @@ sub setglobalvariables
 
     if (!($installer::globals::unpackpath eq ""))
     {
-        make_path_absolute(\$installer::globals::unpackpath);
+        $installer::globals::unpackpath = rel2abs($installer::globals::unpackpath);
     }
 
     $installer::globals::unpackpath =~ s/\Q$installer::globals::separator\E\s*$//;
@@ -478,7 +428,7 @@ sub control_required_parameter
 
         if (!($installer::globals::idttemplatepath eq ""))  # idttemplatepath set, relative or 
absolute?
         {
-            make_path_absolute(\$installer::globals::idttemplatepath);
+            $installer::globals::idttemplatepath = rel2abs($installer::globals::idttemplatepath);
         }
 
         installer::remover::remove_ending_pathseparator(\$installer::globals::idttemplatepath);
@@ -487,7 +437,7 @@ sub control_required_parameter
 
         if (!($installer::globals::idtlanguagepath eq ""))  # idtlanguagepath set, relative or 
absolute?
         {
-            make_path_absolute(\$installer::globals::idtlanguagepath);
+            $installer::globals::idtlanguagepath = rel2abs($installer::globals::idtlanguagepath);
         }
 
         installer::remover::remove_ending_pathseparator(\$installer::globals::idtlanguagepath);
@@ -527,7 +477,7 @@ sub control_required_parameter
 
     if (( $installer::globals::patch ) && ( $installer::globals::issolarispkgbuild ) && ( 
$installer::globals::patchincludepath ))
     {
-        make_path_absolute(\$installer::globals::patchincludepath);
+        $installer::globals::patchincludepath = rel2abs($installer::globals::patchincludepath);
         $installer::globals::patchincludepath = 
installer::converter::make_path_conform($installer::globals::patchincludepath);
     }
 
-- 
1.7.8.3


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.