[Libreoffice-commits] .: Branch 'libreoffice-3-6' - solenv/bin
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Aug 29 12:30:39 PDT 2012
solenv/bin/modules/installer/simplepackage.pm | 18 +++++++++
solenv/bin/modules/installer/systemactions.pm | 47 ++++++++++++++++++++++++++
2 files changed, 65 insertions(+)
New commits:
commit 872d81eabe8712256c4ff3466a126cdade6d1b2a
Author: Michael Stahl <mstahl at redhat.com>
Date: Thu Aug 23 14:25:38 2012 +0200
installer: remove empty directories again:
An "archive" installer contains one empty share/extensions/dict-XY/
directory for every dictionary (except the 3 default ones), causing
numerous assertions about missing META-INF/manifest.xml and an extension
manager cluttered; this is due to overzealous removal of extension
"prereg" code. (regression from
6dcb3d4ef46312729bb6f16c473b433474863f68, partially revert that)
(cherry picked from commit 8098a03d025a0c8fee90322e3835079edb45ade3)
Conflicts:
solenv/bin/modules/installer/simplepackage.pm
...plus cherry-pick of follow-up 7b4394f35b3557ffe61c8e9b0f0b630b31ca0977
"...but remove obsolete prereg-specific code again."
Change-Id: I3a063ebfed1012aeb27ec3076cdd5ca545f918a2
Reviewed-on: https://gerrit.libreoffice.org/464
Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm
index d15ad28..a7d1b23 100755
--- a/solenv/bin/modules/installer/simplepackage.pm
+++ b/solenv/bin/modules/installer/simplepackage.pm
@@ -60,6 +60,21 @@ sub check_simple_packager_project
}
}
+####################################################
+# Detecting the directory with extensions
+####################################################
+
+sub get_extensions_dir
+{
+ my ( $subfolderdir ) = @_;
+
+ my $extensiondir = $subfolderdir . $installer::globals::separator;
+ if ( $installer::globals::officedirhostname ne "" ) { $extensiondir = $extensiondir . $installer::globals::officedirhostname . $installer::globals::separator; }
+ my $extensionsdir = $extensiondir . "share" . $installer::globals::separator . "extensions";
+
+ return $extensionsdir;
+}
+
########################################################################
# Getting the translation file for the Mac Language Pack installer
########################################################################
@@ -671,6 +686,9 @@ sub create_simple_package
installer::logger::print_message( "... removing superfluous directories ...\n" );
installer::logger::include_header_into_logfile("Removing superfluous directories:");
+ my $extensionfolder = get_extensions_dir($subfolderdir);
+ installer::systemactions::remove_empty_dirs_in_folder($extensionfolder);
+
if ( $installer::globals::compiler =~ /^unxmacx/ )
{
installer::worker::put_scpactions_into_installset("$installdir/$packagename");
diff --git a/solenv/bin/modules/installer/systemactions.pm b/solenv/bin/modules/installer/systemactions.pm
index c83d9b6..899ad24 100644
--- a/solenv/bin/modules/installer/systemactions.pm
+++ b/solenv/bin/modules/installer/systemactions.pm
@@ -1578,4 +1578,51 @@ sub read_full_directory {
return
}
+##############################################################
+# Removing all empty directories below a specified directory
+##############################################################
+
+sub remove_empty_dirs_in_folder
+{
+ my ( $dir ) = @_;
+
+ my @content = ();
+ my $infoline = "";
+
+ $dir =~ s/\Q$installer::globals::separator\E\s*$//;
+
+ if ( -d $dir )
+ {
+ opendir(DIR, $dir);
+ @content = readdir(DIR);
+ closedir(DIR);
+
+ my $oneitem;
+
+ foreach $oneitem (@content)
+ {
+ if ((!($oneitem eq ".")) && (!($oneitem eq "..")))
+ {
+ my $item = $dir . $installer::globals::separator . $oneitem;
+
+ if ( -d $item ) # recursive
+ {
+ remove_empty_dirs_in_folder($item);
+ }
+ }
+ }
+
+ # try to remove empty directory
+ my $returnvalue = rmdir $dir;
+
+ if ( $returnvalue )
+ {
+ $infoline = "Successfully removed empty dir $dir\n";
+ push(@installer::globals::logfileinfo, $infoline);
+ }
+
+ }
+
+}
+
1;
More information about the Libreoffice-commits
mailing list