summaryrefslogtreecommitdiff
path: root/solenv/bin
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-04-01 09:40:27 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-04-05 23:34:13 +0000
commite9b947a6665170f96ba4182d81a630da74ea96a2 (patch)
treed433e4bb2acfed635b22bfb4ad6cc41c1658bcf4 /solenv/bin
parentbba6e9ebeb67235ee77e723af354474d5a3e9b85 (diff)
allow to put files listed in file into installation
With this in place, we can replace most of our Zips by Packages. Extensions and Dictionaries are on the radar as well. To move an installed file from zip to filelist, do: 1. Convert the Zip_foo.mk to Package_foo.mk : - change destination paths of all files to the same ones they have in the installation (you can find that in scp2) - use gb_Package_set_outdir to place the files under $INSTDIR, where they are expected. 2. Change the scp2 record: - change filename to <package-name>.filelist - replace ARCHIVE by FILELIST in Styles - change Dir to FILELIST_DIR. Change-Id: Ie17d0765406081b03dcd44a6a23cf517f2067dd3 Reviewed-on: https://gerrit.libreoffice.org/3149 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'solenv/bin')
-rw-r--r--solenv/bin/modules/installer.pm9
-rw-r--r--solenv/bin/modules/installer/control.pm1
-rw-r--r--solenv/bin/modules/installer/environment.pm3
-rw-r--r--solenv/bin/modules/installer/filelists.pm95
4 files changed, 108 insertions, 0 deletions
diff --git a/solenv/bin/modules/installer.pm b/solenv/bin/modules/installer.pm
index c731d9e116fc..df0727f2af1f 100644
--- a/solenv/bin/modules/installer.pm
+++ b/solenv/bin/modules/installer.pm
@@ -41,6 +41,7 @@ use installer::download;
use installer::environment;
use installer::epmfile;
use installer::files;
+use installer::filelists;
use installer::globals;
use installer::helppack;
use installer::languagepack;
@@ -617,6 +618,14 @@ sub run {
installer::scriptitems::quoting_illegal_filenames($filesinproductlanguageresolvedarrayref);
}
+ ######################################################################################
+ # Processing files with flag FILELIST and putting listed files into the file list
+ ######################################################################################
+
+ installer::logger::print_message( "... analyzing files with flag FILELIST ...\n" );
+
+ $filesinproductlanguageresolvedarrayref = installer::filelists::resolve_filelist_flag($filesinproductlanguageresolvedarrayref, $ENV{'INSTDIR'});
+
#####################################
# Files with flag SUBST_FILENAME
#####################################
diff --git a/solenv/bin/modules/installer/control.pm b/solenv/bin/modules/installer/control.pm
index 26ab41aa4724..87b961548e82 100644
--- a/solenv/bin/modules/installer/control.pm
+++ b/solenv/bin/modules/installer/control.pm
@@ -280,6 +280,7 @@ sub check_system_environment
OUTPATH
LOCAL_OUT
LOCAL_COMMON_OUT
+ WORKDIR
);
for my $key ( @environmentvariables )
diff --git a/solenv/bin/modules/installer/environment.pm b/solenv/bin/modules/installer/environment.pm
index 646bf1649e00..cfc8fdf084c4 100644
--- a/solenv/bin/modules/installer/environment.pm
+++ b/solenv/bin/modules/installer/environment.pm
@@ -67,6 +67,9 @@ sub create_pathvariables
my $platformname = $environment->{'OUTPATH'};
$variables{'platformname'} = $platformname;
+ my $filelistpath = $environment->{'WORKDIR'} . $installer::globals::separator . 'Package';
+ $variables{'filelistpath'} = $filelistpath;
+
return \%variables;
}
diff --git a/solenv/bin/modules/installer/filelists.pm b/solenv/bin/modules/installer/filelists.pm
new file mode 100644
index 000000000000..d3447be79163
--- /dev/null
+++ b/solenv/bin/modules/installer/filelists.pm
@@ -0,0 +1,95 @@
+#
+# 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/.
+#
+
+package installer::filelists;
+
+use installer::files;
+use installer::globals;
+use installer::logger;
+use installer::pathanalyzer;
+
+sub resolve_filelist_flag
+{
+ my ($files, $outdir) = @_;
+ my @newfiles = ();
+
+ foreach my $file (@{$files})
+ {
+ my $is_filelist = 0;
+ if ($file->{'Styles'})
+ {
+ if ($file->{'Styles'} =~ /\bFILELIST\b/)
+ {
+ $is_filelist = 1;
+ }
+ }
+
+ if ($is_filelist)
+ {
+ my $filelist_path = $file->{'sourcepath'};
+ my $filelist = read_filelist($filelist_path);
+ if (@{$filelist})
+ {
+ my $destination = $file->{'destination'};
+ installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination);
+
+ foreach my $path (@{$filelist})
+ {
+ # TODO: check that the file is really under $outdir
+ # TODO: check existence of the file
+ my $subpath = substr $path, ((length $outdir) + 1); # drop separator too
+
+ my %newfile = ();
+ %newfile = %{$file};
+ $newfile{'Name'} = $subpath;
+ $newfile{'sourcepath'} = $path;
+ $newfile{'destination'} = $destination . $subpath;
+ $newfile{'filelistname'} = $file->{'Name'};
+ $newfile{'filelistpath'} = $file->{'sourcepath'};
+
+ push @newfiles, \%newfile;
+ }
+ }
+ else
+ {
+ installer::logger::print_message("filelist $filelist_path is empty\n");
+ }
+ }
+ else # not a filelist, just pass the current file over
+ {
+ push @newfiles, $file;
+ }
+ }
+
+ return \@newfiles;
+}
+
+sub read_filelist
+{
+ my ($path) = @_;
+ my $content = installer::files::read_file($path);
+ my @filelist = ();
+
+ foreach my $line (@{$content})
+ {
+ chomp $line;
+ foreach my $file (split /\s+/, $line)
+ {
+ if ($file ne "")
+ {
+ push @filelist, $file;
+ }
+ }
+ }
+
+ return \@filelist;
+}
+
+1;
+
+# vim: set expandtab shiftwidth=4 tabstop=4: