2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 package installer
::filelists
;
14 use installer
::globals
;
15 use installer
::logger
;
16 use installer
::pathanalyzer
;
18 sub resolve_filelist_flag
20 my ($files, $links, $outdir) = @_;
23 foreach my $file (@
{$files})
26 my $use_internal_rights = 0;
27 if ($file->{'Styles'})
29 if ($file->{'Styles'} =~ /\bFILELIST\b/)
33 if ($file->{'Styles'} =~ /\bUSE_INTERNAL_RIGHTS\b/ && !$installer::globals
::iswin
)
35 $use_internal_rights = 1;
41 my $filelist_path = $file->{'sourcepath'};
42 my $filelist = read_filelist
($filelist_path);
45 my $destination = $file->{'destination'};
46 installer
::pathanalyzer
::get_path_from_fullqualifiedname
(\
$destination);
48 foreach my $path (@
{$filelist})
52 if ((index $path, $outdir) != 0)
54 installer
::logger
::print_error
("file '$path' is not in '$outdir'");
64 installer
::logger
::print_error
("file '$path' does not exist");
68 my $subpath = substr $path, ((length $outdir) + 1); # drop separator too
72 $newfile{'Name'} = $subpath;
73 $newfile{'sourcepath'} = $path;
74 $newfile{'destination'} = $destination . $subpath;
75 $newfile{'filelistname'} = $file->{'Name'};
76 $newfile{'filelistpath'} = $file->{'sourcepath'};
80 # FIXME: for symlinks destination is mangled later in
81 # get_Destination_Directory_For_Item_From_Directorylist
82 $newfile{'DoNotMessWithSymlinks'} = 1;
83 $newfile{'Target'} = readlink($path);
84 push ( @
{$links}, \
%newfile );
88 if ($use_internal_rights)
91 $newfile{'UnixRights'} = sprintf("%o", $st->mode & 0777);
94 push @newfiles, \
%newfile;
100 installer
::logger
::print_message
("filelist $filelist_path is empty\n");
103 else # not a filelist, just pass the current file over
105 push @newfiles, $file;
109 return (\
@newfiles, $links);
115 my $content = installer
::files
::read_file
($path);
118 foreach my $line (@
{$content})
121 foreach my $file (split /\s+/, $line)
125 push @filelist, $file;
135 # vim: set expandtab shiftwidth=4 tabstop=4: