[Libreoffice-commits] core.git: pyuno/GeneratedPackage_python-core.mk pyuno/Module_pyuno.mk scp2/source solenv/bin
David Tardon
dtardon at redhat.com
Wed Jun 1 12:56:13 UTC 2016
pyuno/GeneratedPackage_python-core.mk | 20 +
pyuno/Module_pyuno.mk | 7
scp2/source/python/file_python.scp | 6
solenv/bin/modules/installer.pm | 11
solenv/bin/modules/installer/archivefiles.pm | 467 ---------------------------
5 files changed, 26 insertions(+), 485 deletions(-)
New commits:
commit 9b01428b1f448e6b7d5a72f18c1a7d86e11ba4f9
Author: David Tardon <dtardon at redhat.com>
Date: Wed Jun 1 14:46:38 2016 +0200
final solution of the ARCHIVE question
Change-Id: I70da65e08c75cd732000597a09ed113b3075c5a8
diff --git a/pyuno/GeneratedPackage_python-core.mk b/pyuno/GeneratedPackage_python-core.mk
new file mode 100644
index 0000000..88cd9b9
--- /dev/null
+++ b/pyuno/GeneratedPackage_python-core.mk
@@ -0,0 +1,20 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_GeneratedPackage_GeneratedPackage,python-core,$(MINGW_SYSROOT)/lib))
+
+# NOTE: The original code excluded *.pyc, *.py~, *.orig and *_failed . I
+# assume it was just a size optimization. If their presence actually
+# causes a problem, an extension of GeneratedPackage is is left as an
+# excercise for the poor misguided person who wants to cross-compile
+# with mingw and system python and actually use the results for
+# something.
+$(eval $(call gb_GeneratedPackage_add_dir,python-core,$(INSTDIR)/program/python-core-$(PYTHON_VERSION)/lib,python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR)))
+
+# vim: set noet sw=4 ts=4:
diff --git a/pyuno/Module_pyuno.mk b/pyuno/Module_pyuno.mk
index 4179a73..9d38455 100644
--- a/pyuno/Module_pyuno.mk
+++ b/pyuno/Module_pyuno.mk
@@ -32,7 +32,7 @@ endif
# that why it makes sense to handle the next 3 targets
# with SYSTEM_PYTHON=TRUE and SYSTEM_PYTHON=
-# zipcore: pyuno/python.exe on Windows
+# python-core: pyuno/python.exe on Windows
ifeq ($(OS),WNT)
$(eval $(call gb_Module_add_targets,pyuno,\
Executable_python \
@@ -41,7 +41,7 @@ endif
ifeq ($(SYSTEM_PYTHON),)
-# zipcore: python.sh on Unix
+# python-core: python.sh on Unix
ifneq ($(OS),WNT)
$(eval $(call gb_Module_add_targets,pyuno,\
CustomTarget_python_shell \
@@ -55,8 +55,7 @@ else # SYSTEM_PYTHON
# FIXME remove this
ifeq ($(OS)$(COM),WNTGCC)
$(eval $(call gb_Module_add_targets,pyuno,\
- CustomTarget_zipcore \
- Package_zipcore \
+ GeneratedPackage_python-core \
))
endif
diff --git a/scp2/source/python/file_python.scp b/scp2/source/python/file_python.scp
index 10599cc..0f2c994 100644
--- a/scp2/source/python/file_python.scp
+++ b/scp2/source/python/file_python.scp
@@ -81,9 +81,9 @@ End
File gid_File_Py_Python_Core
TXT_FILE_BODY;
- Dir = gid_Dir_Py_PythonCore_Lib;
- Name = STRING(CONCAT3(python-core-,PYVERSION,.zip));
- Styles = (ARCHIVE);
+ Dir = FILELIST_DIR;
+ Name = "python-core.filelist";
+ Styles = (FILELIST);
End
Directory gid_Dir_Py_PythonCore_Bin
diff --git a/solenv/bin/modules/installer.pm b/solenv/bin/modules/installer.pm
index 605aec2..485a508 100644
--- a/solenv/bin/modules/installer.pm
+++ b/solenv/bin/modules/installer.pm
@@ -24,7 +24,6 @@ use Cwd;
use Data::Dumper;
use File::Copy;
use List::Util qw(shuffle);
-use installer::archivefiles;
use installer::control;
use installer::converter;
use installer::copyproject;
@@ -605,16 +604,6 @@ sub run {
installer::scriptitems::make_filename_language_specific($filesinproductlanguageresolvedarrayref);
######################################################################################
- # Unzipping files with flag ARCHIVE and putting all included files into the file list
- ######################################################################################
-
- installer::logger::print_message( "... analyzing files with flag ARCHIVE ...\n" );
-
- my @additional_paths_from_zipfiles = ();
-
- $filesinproductlanguageresolvedarrayref = installer::archivefiles::resolving_archive_flag($filesinproductlanguageresolvedarrayref, \@additional_paths_from_zipfiles, $languagestringref, $loggingdir);
-
- ######################################################################################
# Processing files with flag FILELIST and putting listed files into the file list
######################################################################################
diff --git a/solenv/bin/modules/installer/archivefiles.pm b/solenv/bin/modules/installer/archivefiles.pm
deleted file mode 100644
index 17a6a5f4..0000000
--- a/solenv/bin/modules/installer/archivefiles.pm
+++ /dev/null
@@ -1,467 +0,0 @@
-#
-# 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/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-package installer::archivefiles;
-
-use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
-use installer::files;
-use installer::globals;
-use installer::logger;
-use installer::pathanalyzer;
-use installer::systemactions;
-use Cwd;
-
-#################################################################
-# Changing the name for files with flag RENAME_TO_LANGUAGE
-#################################################################
-
-sub put_language_into_name
-{
- my ( $oldname, $onelanguage ) = @_;
-
- my $newname = "";
-
- my $filename = "";
- my $extension = "";
-
- if ( $oldname =~ /en-US/ ) # files, that contain the language in the file name
- {
- $newname = $oldname;
- $newname =~ s/en-US/$onelanguage/;
- }
- else # files, that do not contain the language in the file name
- {
- if ( $oldname =~ /^\s*(.*)(\..*?)\s*$/ ) # files with extension
- {
- $filename = $1;
- $extension = $2;
- }
- else
- {
- $filename = $oldname;
- $extension = "";
- }
-
- $newname = $1 . "_" . $onelanguage . $2;
- }
-
- return $newname;
-}
-
-#################################################################
-# Converting patchfiles string into array
-#################################################################
-
-sub get_patch_file_list
-{
- my ( $patchfilestring ) = @_;
-
- $patchfilestring =~ s/^\s*\(?//;
- $patchfilestring =~ s/\)?\s*$//;
- $patchfilestring =~ s/^\s*\///;
- $patchfilestring =~ s/^\s*\\//;
-
- my @patchfilesarray = split /,\s*/, $patchfilestring;
-
- return \@patchfilesarray;
-}
-
-#################################################################
-# Reading all executables in the "manifest.xml"
-#################################################################
-
-sub get_all_executables_from_manifest
-{
- my ($unzipdir, $manifestfile, $executable_files_in_extensions) = @_;
-
- my $is_executable = 0;
-
- for ( my $i = 0; $i <= $#{$manifestfile}; $i++ )
- {
- my $line = ${$manifestfile}[$i];
-
- if ( $line =~ /\"application\/vnd\.sun\.star\.executable\"/ ) { $is_executable = 1; }
-
- if (( $line =~ /manifest\:full\-path=\"(.*?)\"/ ) && ( $is_executable ))
- {
- my $filename = $unzipdir . $installer::globals::separator . $1;
- # making only slashes for comparison reasons
- $filename =~ s/\\/\//g;
- $executable_files_in_extensions->{$filename} = 1;
- }
-
- if ( $line =~ /\/\>/ ) { $is_executable = 0; }
- }
-}
-
-#################################################################
-# Reading the "manifest.xml" in extensions and determine, if
-# there are executable files
-#################################################################
-
-sub collect_all_executable_files_in_extensions
-{
- my ($unzipdir, $executable_files_in_extensions) = @_;
-
- $unzipdir =~ s/\Q$installer::globals::separator\E\s*$//;
-
- my $manifestfilename = $unzipdir . $installer::globals::separator . "META-INF" . $installer::globals::separator . "manifest.xml";
-
- if ( -f $manifestfilename )
- {
- my $manifestfile = installer::files::read_file($manifestfilename);
- get_all_executables_from_manifest($unzipdir, $manifestfile, $executable_files_in_extensions);
- }
-}
-
-#################################################################
-# Analyzing files with flag ARCHIVE
-#################################################################
-
-sub resolving_archive_flag
-{
- my ($filesarrayref, $additionalpathsref, $languagestringref, $loggingdir) = @_;
-
- my @newallfilesarray = ();
-
- my ($systemcall, $returnvalue, $infoline);
-
- my $platformunzipdirbase = installer::systemactions::create_directories("zip", $languagestringref);
- push(@installer::globals::removedirs, $platformunzipdirbase);
-
- installer::logger::include_header_into_logfile("Files with flag ARCHIVE:");
-
- my $repeat_unzip = 0;
- my $maxcounter = 0;
-
- for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ )
- {
- if ( $repeat_unzip ) { $i--; } # decreasing the counter
-
- my $onefile = ${$filesarrayref}[$i];
- my $styles = "";
-
- if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; }
-
- if ( $styles =~ /\bARCHIVE\b/ ) # copying, unzipping and changing the file list
- {
- my $sourcepath = $onefile->{'sourcepath'};
-
- my $use_internal_rights = 0;
- if ( $styles =~ /\bUSE_INTERNAL_RIGHTS\b/ ) { $use_internal_rights = 1; } # using the rights used inside the zip file
-
- my $rename_to_language = 0;
- if ( $styles =~ /\bRENAME_TO_LANGUAGE\b/ ) { $rename_to_language = 1; } # special handling for renamed files (scriptitems.pm)
-
- my %executable_files_in_extensions = ();
- my $set_executable_privileges = 0; # setting privileges for exectables is required for oxt files
- if ( $onefile->{'Name'} =~ /\.oxt\s*$/ ) { $set_executable_privileges = 1; }
-
- # mechanism to select files from an archive files
- my $select_files = 0;
- my $selectlistfiles = "";
- my @keptfiles = ();
- if ( $onefile->{'Selectfiles'} )
- {
- $select_files = 1;
- $selectlistfiles = get_patch_file_list( $onefile->{'Selectfiles'} );
- $infoline = "Selected file list defined at file: $onefile->{'Name'} :\n";
- push( @installer::globals::logfileinfo, $infoline);
- for ( my $k = 0; $k <= $#{$selectlistfiles}; $k++ )
- {
- $infoline = "\"${$selectlistfiles}[$k]\"\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
- }
-
- if ( $onefile->{'Selectfiles'} ) { $onefile->{'Selectfiles'} = ""; } # Selected files list no longer required
-
- # creating directories
-
- my $onelanguage = $onefile->{'specificlanguage'};
-
- # files without language into directory "00"
-
- if ($onelanguage eq "") { $onelanguage = "00"; }
-
- my $unzipdir;
-
- $unzipdir = $platformunzipdirbase . $installer::globals::separator . $onelanguage . $installer::globals::separator;
-
- installer::systemactions::create_directory($unzipdir); # creating language specific subdirectories
-
- my $onefilename = $onefile->{'Name'};
- $onefilename =~ s/\./\_/g; # creating new directory name
- $onefilename =~ s/\//\_/g; # only because of /letter/fontunxpsprint.zip, the only zip file with path
- $unzipdir = $unzipdir . $onefilename . $installer::globals::separator;
-
- if ( $installer::globals::dounzip ) { installer::systemactions::create_directory($unzipdir); } # creating subdirectories with the names of the zipfiles
-
- my $zip = Archive::Zip->new();
- if ( $zip->read($sourcepath) != AZ_OK )
- {
- $infoline = "ERROR: Could not unzip $sourcepath\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
-
- my $counter = 0;
- my $contains_dll = 0;
- my @dllList = ();
- my @dirs = ();
- foreach my $member ( $zip->memberNames() )
- {
- $counter++;
- if ( $member =~ /.dll\s*$/i ) { $contains_dll = 1; push(@dllList, $member); }
- if ( $member =~ m/\/$/ ) { push(@dirs, $member); }
- }
-
- if (! ( $counter > 0 )) # the zipfile is empty
- {
- $infoline = "ERROR: Could not unzip $sourcepath\n";
- push( @installer::globals::logfileinfo, $infoline);
-
- }
- else
- {
- if ( $installer::globals::dounzip ) # really unpacking the files
- {
- if ( $zip->extractTree("", $unzipdir) != AZ_OK ) { die "Could not unzip: $!"; }
-
- if (( $^O =~ /cygwin/i ) && ( $contains_dll ))
- {
- my $dir = getcwd();
- chdir($unzipdir);
- my $changed = chmod(0775, @dllList);
- $infoline = "Changed mode of $changed files (of ".scalar(@dllList).")\n";
- push( @installer::globals::logfileinfo, $infoline);
- chdir($dir);
-
- if ($changed != scalar(@dllList))
- {
- $infoline = "ERROR: Could not chmod all files!\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
- }
-
- if ( ! $installer::globals::iswindowsbuild && scalar(@dirs) > 0 )
- {
- my $dir = getcwd();
- chdir($unzipdir);
- # Setting unix rights to "775" for all created directories inside the package
- my $changed = chmod(0775, @dirs);
- $infoline = "Changed mode of : $changed; should be: ".scalar(@dirs)."\n";
- chdir($dir);
-
- push( @installer::globals::logfileinfo, $infoline);
-
- if ($changed != scalar(@dirs))
- {
- $infoline = "ERROR: Could not chmod all files!\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
- }
-
- # Selecting names of executable files in extensions
- if ( $set_executable_privileges )
- {
- collect_all_executable_files_in_extensions($unzipdir, \%executable_files_in_extensions);
- }
- }
-
- my $unziperror = 0;
-
- foreach my $zipname ( $zip->memberNames() )
- {
- # Format from Archive:::Zip :
- # dir1/
- # dir1/so7drawing.desktop
-
- # some directories and files (from the help) start with "./simpress.idx"
-
- $zipname =~ s/^\s*\.\///;
-
- if ($installer::globals::iswin and $^O =~ /MSWin/i) { $zipname =~ s/\//\\/g; }
-
- if ( $zipname =~ /\Q$installer::globals::separator\E\s*$/ ) # slash or backslash at the end characterizes a directory
- {
- $zipname = $zipname . "\n";
- push(@{$additionalpathsref}, $zipname);
-
- # Also needed here:
- # Name
- # Language
- # ismultilingual
- # Basedirectory
-
- # This is not needed, because the list of all directories for the
- # epm list file is generated from the destination directories of the
- # files included in the product!
- }
- else
- {
- my %newfile = ();
- %newfile = %{$onefile};
- $newfile{'Name'} = $zipname;
- my $destination = $onefile->{'destination'};
- installer::pathanalyzer::get_path_from_fullqualifiedname(\$destination);
- $newfile{'destination'} = $destination . $zipname;
- $newfile{'sourcepath'} = $unzipdir . $zipname;
- $newfile{'zipfilename'} = $onefile->{'Name'};
- $newfile{'zipfilesource'} = $onefile->{'sourcepath'};
- $newfile{'zipfiledestination'} = $onefile->{'destination'};
-
- if (( $use_internal_rights ) && ( ! $installer::globals::iswin ))
- {
- $newfile{'UnixRights'} = sprintf("%o", ($zip->memberNamed($zipname)->unixFileAttributes() & 07777));
- $infoline = "Setting unix rights for \"$newfile{'sourcepath'}\" to \"$newfile{'UnixRights'}\"\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
-
- if ( $set_executable_privileges )
- {
- # All paths to executables are saved in the hash %executable_files_in_extensions
- my $compare_path = $newfile{'sourcepath'};
- $compare_path =~ s/\\/\//g; # contains only slashes for comparison reasons
- if ( exists($executable_files_in_extensions{$compare_path}) )
- {
- $newfile{'UnixRights'} = "775";
- $infoline = "Executable in Extension: Setting unix rights for \"$newfile{'sourcepath'}\" to \"$newfile{'UnixRights'}\"\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
- }
-
- if ( $select_files )
- {
- if ( ! grep {$_ eq $zipname} @{$selectlistfiles} )
- {
- $infoline = "Removing from ARCHIVE file $onefilename: $zipname\n";
- push( @installer::globals::logfileinfo, $infoline);
- next; # ignoring files, that are not included in $selectlistfiles
- }
- else
- {
- $infoline = "Keeping from ARCHIVE file $onefilename: $zipname\n";
- push( @installer::globals::logfileinfo, $infoline);
- push( @keptfiles, $zipname); # collecting all kept files
- }
- }
-
- if ( $rename_to_language )
- {
- my $newzipname = put_language_into_name($zipname, $onelanguage);
- my $oldfilename = $unzipdir . $zipname;
- my $newfilename = $unzipdir . $newzipname;
-
- installer::systemactions::copy_one_file($oldfilename, $newfilename);
-
- $newfile{'Name'} = $newzipname;
- $newfile{'destination'} = $destination . $newzipname;
- $newfile{'sourcepath'} = $unzipdir . $newzipname;
-
- $infoline = "RENAME_TO_LANGUAGE: Using $newzipname instead of $zipname!\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
-
- my $sourcefiletest = $unzipdir . $zipname;
- if ( ! -f $sourcefiletest )
- {
- $infoline = "ATTENTION: Unzip failed for $sourcefiletest!\n";
- push( @installer::globals::logfileinfo, $infoline);
- $unziperror = 1;
- }
-
- # only adding the new line into the files array, if not in repeat modus
-
- if ( ! $repeat_unzip ) { push(@newallfilesarray, \%newfile); }
- }
- }
-
- # Comparing the content of @keptfiles and $selectlistfiles
- # Do all files from the list of selected files are stored in @keptfiles ?
- # @keptfiles contains only files included in $selectlistfiles. But are all
- # files from $selectlistfiles included in @keptfiles?
-
- if ( $select_files )
- {
- my $number = $#{$selectlistfiles} + 1;
- $infoline = "SELECTLIST: Number of files in file selection list: $number\n";
- push( @installer::globals::logfileinfo, $infoline);
- $number = $#keptfiles + 1;
- $infoline = "SELECTLIST: Number of kept files: $number\n";
- push( @installer::globals::logfileinfo, $infoline);
-
- for ( my $k = 0; $k <= $#keptfiles; $k++ )
- {
- $infoline = "KEPT FILES: $keptfiles[$k]\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
-
- my @warningfiles = ();
-
- for ( my $k = 0; $k <= $#{$selectlistfiles}; $k++ )
- {
- if ( ! grep {$_ eq ${$selectlistfiles}[$k]} @keptfiles )
- {
- push(@warningfiles, ${$selectlistfiles}[$k]);
- }
- }
-
- for ( my $k = 0; $k <= $#warningfiles; $k++ )
- {
- $infoline = "WARNING: $warningfiles[$k] not included in install set (does not exist in zip file)!\n";
- push( @installer::globals::logfileinfo, $infoline);
- }
-
- }
-
- if ( $unziperror )
- {
- installer::logger::print_warning( "Repeating to unpack $sourcepath! \n" );
- $infoline = "ATTENTION: Repeating to unpack $sourcepath !\n";
- push( @installer::globals::logfileinfo, $infoline);
- $repeat_unzip = 1;
- $maxcounter++;
-
- if ( $maxcounter == 5 ) # exiting the program
- {
- die "Failed to unzip $sourcepath !";
- }
- }
- else
- {
- $infoline = "Info: $sourcepath unpacked without problems !\n";
- push( @installer::globals::logfileinfo, $infoline);
- $repeat_unzip = 0;
- $maxcounter = 0;
- }
- }
- }
- else # nothing to do here, no zipped file (no ARCHIVE flag)
- {
- push(@newallfilesarray, $onefile);
- }
- }
-
- $infoline = "\n";
- push( @installer::globals::logfileinfo, $infoline);
-
- return \@newallfilesarray;
-}
-
-
-1;
More information about the Libreoffice-commits
mailing list