[Libreoffice-commits] .: 2 commits - solenv/bin
Norbert Thiebaud
nthiebaud at kemper.freedesktop.org
Sun Nov 7 22:17:12 PST 2010
solenv/bin/modules/installer/copyproject.pm | 24 +----
solenv/bin/modules/installer/download.pm | 6 -
solenv/bin/modules/installer/epmfile.pm | 21 ----
solenv/bin/modules/installer/javainstaller.pm | 6 -
solenv/bin/modules/installer/languagepack.pm | 3
solenv/bin/modules/installer/parameter.pm | 3
solenv/bin/modules/installer/simplepackage.pm | 12 --
solenv/bin/modules/installer/systemactions.pm | 124 +-------------------------
solenv/bin/modules/installer/worker.pm | 12 --
9 files changed, 31 insertions(+), 180 deletions(-)
New commits:
commit a7d476f2737582b02e377112d70fff09606874d1
Author: Jordan Ayers <jordan.ayers at gmail.com>
Date: Sun Nov 7 18:03:56 2010 -0600
Perl Installer: Use built-in chmod
Replace system calls which performed single-file permission sets with calls to the built-in chmod.
Replace the implementation of create_directory with a call to create_directory_with_privileges.
diff --git a/solenv/bin/modules/installer/systemactions.pm b/solenv/bin/modules/installer/systemactions.pm
index 83502ef..626af7f 100644
--- a/solenv/bin/modules/installer/systemactions.pm
+++ b/solenv/bin/modules/installer/systemactions.pm
@@ -42,109 +42,8 @@ use installer::remover;
sub create_directory
{
my ($directory) = @_;
-
- my $returnvalue = 1;
- my $infoline = "";
-
- if (!(-d $directory))
- {
- $returnvalue = mkdir($directory, 0775);
-
- if ($returnvalue)
- {
- $infoline = "\nCreated directory: $directory\n";
- push(@installer::globals::logfileinfo, $infoline);
-
- my $localcall = "chmod 0775 $directory \>\/dev\/null 2\>\&1";
- system($localcall);
-
- # chmod 0775 is not sufficient on mac to remove sticky tag
- $localcall = "chmod a-s $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.
-
- $infoline = "\nDid not succeed in creating directory: \"$directory\". Further attempts will follow.\n";
- push(@installer::globals::logfileinfo, $infoline);
-
- if (!(-d $directory))
- {
- # Problem with parallel packaging? -> Try a little harder, before exiting.
- # Did someone else remove the parent directory in the meantime?
- my $parentdir = $directory;
- installer::pathanalyzer::get_path_from_fullqualifiedname(\$parentdir);
- if (!(-d $parentdir))
- {
- $returnvalue = mkdir($parentdir, 0775);
-
- if ($returnvalue)
- {
- $infoline = "\nAttention: Successfully created parent directory (should already be created before): $parentdir\n";
- push(@installer::globals::logfileinfo, $infoline);
-
- my $localcall = "chmod 775 $parentdir \>\/dev\/null 2\>\&1";
- system($localcall);
- }
- else
- {
- $infoline = "\Error: \"$directory\" could not be created. Even the parent directory \"$parentdir\" does not exist and could not be created.\n";
- push(@installer::globals::logfileinfo, $infoline);
- if ( -d $parentdir )
- {
- $infoline = "\nAttention: Finally the parent directory \"$parentdir\" exists, but I could not create it.\n";
- push(@installer::globals::logfileinfo, $infoline);
- }
- else
- {
- # Now it is time to exit, even the parent could not be created.
- installer::exiter::exit_program("ERROR: Could not create parent directory \"$parentdir\"", "create_directory");
- }
- }
- }
-
- # At this point we have to assume, that the parent directory exist.
- # Trying once more to create the desired directory
- $returnvalue = mkdir($directory, 0775);
-
- if ($returnvalue)
- {
- $infoline = "\nAttention: Created directory \"$directory\" in the second try.\n";
- push(@installer::globals::logfileinfo, $infoline);
-
- my $localcall = "chmod 775 $directory \>\/dev\/null 2\>\&1";
- system($localcall);
- }
- else
- {
- if ( -d $directory )
- {
- $infoline = "\nAttention: Finally the directory \"$directory\" exists, but I could not create it.\n";
- push(@installer::globals::logfileinfo, $infoline);
- }
- else
- {
- # It is time to exit, even the second try failed.
- installer::exiter::exit_program("ERROR: Failed to create the directory: $directory", "create_directory");
- }
- }
- }
- else
- {
- $infoline = "\nAnother process created this directory in exactly this moment :-) : $directory\n";
- push(@installer::globals::logfileinfo, $infoline);
- }
- }
- }
- else
- {
- $infoline = "\nAlready existing directory, did not create: $directory\n";
- push(@installer::globals::logfileinfo, $infoline);
- }
+ create_directory_with_privileges( $directory, "755" );
}
######################################################
@@ -157,10 +56,10 @@ sub create_directory_with_privileges
my $returnvalue = 1;
my $infoline = "";
+ my $localprivileges = oct("0".$privileges); # changes "777" to 0777
if (!(-d $directory))
{
- my $localprivileges = oct("0".$privileges); # changes "777" to 0777
$returnvalue = mkdir($directory, $localprivileges);
if ($returnvalue)
@@ -168,8 +67,7 @@ sub create_directory_with_privileges
$infoline = "\nCreated directory: $directory\n";
push(@installer::globals::logfileinfo, $infoline);
- my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod $localprivileges, $directory;
}
else
{
@@ -195,8 +93,7 @@ sub create_directory_with_privileges
$infoline = "\nAttention: Successfully created parent directory (should already be created before): $parentdir\n";
push(@installer::globals::logfileinfo, $infoline);
- my $localcall = "chmod $privileges $parentdir \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod $localprivileges, $parentdir;
}
else
{
@@ -225,8 +122,7 @@ sub create_directory_with_privileges
$infoline = "\nAttention: Created directory \"$directory\" in the second try.\n";
push(@installer::globals::logfileinfo, $infoline);
- my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod $localprivileges, $directory;
}
else
{
@@ -254,8 +150,7 @@ sub create_directory_with_privileges
$infoline = "\nAlready existing directory, did not create: $directory\n";
push(@installer::globals::logfileinfo, $infoline);
- my $localcall = "chmod $privileges $directory \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod $localprivileges, $directory;
}
}
@@ -1443,12 +1338,7 @@ sub try_to_create_directory
$infoline = "\nCreated directory: $directory\n";
push(@installer::globals::logfileinfo, $infoline);
- my $localcall = "chmod 0775 $directory \>\/dev\/null 2\>\&1";
- system($localcall);
-
- # chmod 0775 is not sufficient on mac to remove sticky tag
- $localcall = "chmod a-s $directory \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod 0775, $directory;
}
else
{
commit e5243d483915a07eb2f0ec09aa07ed33190ee621
Author: Jordan Ayers <jordan.ayers at gmail.com>
Date: Sun Nov 7 18:02:12 2010 -0600
Perl Installer: Use built-in chmod
Replace several system calls which performed single-file permission sets with the built-in chmod command.
diff --git a/solenv/bin/modules/installer/copyproject.pm b/solenv/bin/modules/installer/copyproject.pm
index 88f3b79..93f4d29 100644
--- a/solenv/bin/modules/installer/copyproject.pm
+++ b/solenv/bin/modules/installer/copyproject.pm
@@ -69,17 +69,14 @@ sub copy_project
installer::systemactions::copy_one_file($source, $destination);
- if ( $destination =~ /install\s*$/ )
+ if ( $onefile->{'UnixRights'} )
{
- my $localcall = "chmod 775 $destination \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod oct($onefile->{'UnixRights'}), $destination;
}
-
- if ( $onefile->{'UnixRights'} )
+ elsif ( $destination =~ /install\s*$/ )
{
- my $localcall = "chmod $onefile->{'UnixRights'} $destination \>\/dev\/null 2\>\&1";
- system($localcall);
- }
+ chmod 0775, $destination;
+ }
}
# copy ScpActions
@@ -93,16 +90,13 @@ sub copy_project
installer::systemactions::copy_one_file($source, $destination);
- if ( $destination =~ /install\s*$/ )
+ if ( $onefile->{'UnixRights'} )
{
- my $localcall = "chmod 775 $destination \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod oct($onefile->{'UnixRights'}), $destination;
}
-
- if ( $onefile->{'UnixRights'} )
+ elsif ( $destination =~ /install\s*$/ )
{
- my $localcall = "chmod $onefile->{'UnixRights'} $destination \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod 0775, $destination;
}
}
diff --git a/solenv/bin/modules/installer/download.pm b/solenv/bin/modules/installer/download.pm
index 8e70bbb..7b30c43 100644
--- a/solenv/bin/modules/installer/download.pm
+++ b/solenv/bin/modules/installer/download.pm
@@ -118,8 +118,7 @@ sub save_script_file
if ( ! $installer::globals::iswindowsbuild )
{
- my $localcall = "chmod 775 $newscriptfilename \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod 0775, $newscriptfilename;
}
return $newscriptfilename;
@@ -339,8 +338,7 @@ sub tar_package
push( @installer::globals::logfileinfo, $infoline);
}
- my $localcall = "chmod 775 $tarfilename \>\/dev\/null 2\>\&1";
- $returnvalue = system($localcall);
+ chmod 0775, $tarfilename;
return ( -s $tarfilename );
}
diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm
index 2af2f3c..0e1b18a 100644
--- a/solenv/bin/modules/installer/epmfile.pm
+++ b/solenv/bin/modules/installer/epmfile.pm
@@ -2875,23 +2875,7 @@ sub create_new_directory_structure
}
# Setting unix rights to "775" for $newdir ("RPMS" or "packages")
-
- my $localcall = "chmod 775 $newdir \>\/dev\/null 2\>\&1";
- my $callreturnvalue = system($localcall);
-
- my $callinfoline = "Systemcall: $localcall\n";
- push( @installer::globals::logfileinfo, $callinfoline);
-
- if ($callreturnvalue)
- {
- $callinfoline = "ERROR: Could not execute \"$localcall\"!\n";
- push( @installer::globals::logfileinfo, $callinfoline);
- }
- else
- {
- $callinfoline = "Success: Executed \"$localcall\" successfully!\n";
- push( @installer::globals::logfileinfo, $callinfoline);
- }
+ chmod 0775, $newdir;
}
######################################################
@@ -3453,8 +3437,7 @@ sub finalize_linux_patch
push( @installer::globals::logfileinfo, $infoline);
# Setting unix rights 755
- my $localcall = "chmod 775 $newscriptfilename \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod 0755, $newscriptfilename;
}
1;
diff --git a/solenv/bin/modules/installer/javainstaller.pm b/solenv/bin/modules/installer/javainstaller.pm
index 57ed700..0420158 100644
--- a/solenv/bin/modules/installer/javainstaller.pm
+++ b/solenv/bin/modules/installer/javainstaller.pm
@@ -1168,8 +1168,7 @@ sub copy_setup_locally
if ($$loadernameref eq "") { installer::exiter::exit_program("ERROR: Could not find Java loader $loadername!", "copy_setup_locally"); }
installer::systemactions::copy_one_file($$loadernameref, $newname);
- my $localcall = "chmod 775 $newname \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod 0775, $newname;
}
@@ -1185,8 +1184,7 @@ sub put_loader_into_installset
installer::systemactions::copy_one_file($filename, $installname);
- my $localcall = "chmod 775 $installname \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod 0775, $installname;
}
#################################################################
diff --git a/solenv/bin/modules/installer/languagepack.pm b/solenv/bin/modules/installer/languagepack.pm
index e46dbc7..509dfac 100644
--- a/solenv/bin/modules/installer/languagepack.pm
+++ b/solenv/bin/modules/installer/languagepack.pm
@@ -466,8 +466,7 @@ sub include_package_into_script
push( @installer::globals::logfileinfo, $infoline);
}
- my $localcall = "chmod 775 $scriptfilename \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod 0775, $scriptfilename;
}
diff --git a/solenv/bin/modules/installer/parameter.pm b/solenv/bin/modules/installer/parameter.pm
index 6e0c05e..b5b20e4 100644
--- a/solenv/bin/modules/installer/parameter.pm
+++ b/solenv/bin/modules/installer/parameter.pm
@@ -449,8 +449,7 @@ sub setglobalvariables
if ( $installer::globals::compiler =~ /^unxmac/ )
{
- my $localcall = "chmod 777 $installer::globals::temppath \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod 0777, $installer::globals::temppath;
}
$installer::globals::temppath = $installer::globals::temppath . $installer::globals::separator . "i";
diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm
index fe89bd0..668146c 100644
--- a/solenv/bin/modules/installer/simplepackage.pm
+++ b/solenv/bin/modules/installer/simplepackage.pm
@@ -500,10 +500,8 @@ sub create_package
replace_variables_in_scriptfile($scriptfilecontent, $volume_name, $allvariables);
installer::files::save_file($scriptfilename, $scriptfilecontent);
- $systemcall = "chmod 775 " . "\"" . $scriptfilename . "\"";
- system($systemcall);
- $systemcall = "chmod 775 " . "\"" . $scripthelperrealfilename . "\"";
- system($systemcall);
+ chmod 0775, $scriptfilename;
+ chmod 0775, $scripthelperrealfilename;
# Copy also Info.plist and icon file
# Finding both files in solver
@@ -717,13 +715,9 @@ sub create_simple_package
if ( ! $installer::globals::iswindowsbuild )
{
# see issue 102274
- my $unixrights = "";
if ( $onefile->{'UnixRights'} )
{
- $unixrights = $onefile->{'UnixRights'};
-
- my $localcall = "$installer::globals::wrapcmd chmod $unixrights \'$destination\' \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod oct($onefile->{'UnixRights'}), $destination;
}
}
}
diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm
index 1bd58b2..6600dbf 100644
--- a/solenv/bin/modules/installer/worker.pm
+++ b/solenv/bin/modules/installer/worker.pm
@@ -107,8 +107,7 @@ sub copy_install_sets_to_ship
if (( ! $installer::globals::iswindowsbuild ) && ( $installer::globals::addjavainstaller ))
{
# Setting Unix rights for Java starter ("setup")
- my $localcall = "chmod 775 $localshipinstalldir/setup \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod 0775, "$localshipinstalldir/setup";
}
# unpacking the tar.gz file for Solaris
@@ -2207,8 +2206,7 @@ sub put_scpactions_into_installset
if ( $onescpaction->{'UnixRights'} )
{
- my $localcall = "chmod $onescpaction->{'UnixRights'} $destfile \>\/dev\/null 2\>\&1";
- system($localcall);
+ chmod oct($onescpaction->{'UnixRights'}), $destfile;
}
}
@@ -3202,8 +3200,7 @@ sub tar_package
push( @installer::globals::logfileinfo, $infoline);
}
- my $localcall = "chmod 775 $tarfilename \>\/dev\/null 2\>\&1";
- $returnvalue = system($localcall);
+ chmod 0775, $tarfilename;
my $fulltarfile = $installdir . $installer::globals::separator . $tarfilename;
my $filesize = ( -s $fulltarfile );
@@ -3240,8 +3237,7 @@ sub untar_package
push( @installer::globals::logfileinfo, $infoline);
}
- my $localcall = "chmod 775 $tarfilename \>\/dev\/null 2\>\&1";
- $returnvalue = system($localcall);
+ chmod 0775, $tarfilename;
}
#########################################################
More information about the Libreoffice-commits
mailing list