From 86080bf006633245c49ee943977e6454d8a332e8073df94fc6c9ebaf9a8fcdd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 25 Feb 2019 12:56:57 +0000 Subject: [PATCH] - Add patches speeding up install: * 0001-Speed-up-languagepack-installation.patch * libreoffice-no-destdircheck.patch OBS-URL: https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice?expand=0&rev=756 --- 0001-Speed-up-languagepack-installation.patch | 147 ++++++++++++++++++ libreoffice-no-destdircheck.patch | 27 ++++ libreoffice.changes | 7 + libreoffice.spec | 5 + 4 files changed, 186 insertions(+) create mode 100644 0001-Speed-up-languagepack-installation.patch create mode 100644 libreoffice-no-destdircheck.patch diff --git a/0001-Speed-up-languagepack-installation.patch b/0001-Speed-up-languagepack-installation.patch new file mode 100644 index 0000000..df91ac8 --- /dev/null +++ b/0001-Speed-up-languagepack-installation.patch @@ -0,0 +1,147 @@ +From d2763829435b7a30baebab939e1e04a94cce722b Mon Sep 17 00:00:00 2001 +From: Michael Schroeder +Date: Mon, 25 Feb 2019 13:28:14 +0100 +Subject: [PATCH] Speed up languagepack installation + +Reorder the order the filelists are initialized per package. +Optimize speed of find_files_for_package: + We can simply check if the modules entry is the same as last time. + The code uses iterators instead of that C-ish for loops. + Create a hash from the packagemodules to speed up the check if + a module is included in the hash. + +Change-Id: I1e8ae394634a527880e08ef8ff333d94d04f49fd +Before: 12s per language/package +After: <1s per language/package +--- + solenv/bin/modules/installer.pm | 26 +++++------ + solenv/bin/modules/installer/packagelist.pm | 52 ++++++++++----------- + 2 files changed, 37 insertions(+), 41 deletions(-) + +diff --git a/solenv/bin/modules/installer.pm b/solenv/bin/modules/installer.pm +index 88ec4e9394f9..f7983673f2e8 100644 +--- a/solenv/bin/modules/installer.pm ++++ b/solenv/bin/modules/installer.pm +@@ -998,14 +998,23 @@ sub run { + $packagerootpath = $installer::globals::rootpath; + } + ++ ################################# ++ # collecting items for package ++ ################################# ++ ++ my $filesinpackage = installer::packagelist::find_files_for_package($filesinproductlanguageresolvedarrayref, $onepackage); ++ my $unixlinksinpackage = installer::packagelist::find_files_for_package($unixlinksinproductlanguageresolvedarrayref, $onepackage); ++ my $linksinpackage = installer::packagelist::find_links_for_package($linksinproductlanguageresolvedarrayref, $onepackage); ++ my $dirsinpackage = installer::packagelist::find_dirs_for_package($directoriesforepmarrayref, $onepackage); ++ + ############################################# + # copying the collectors for each package + ############################################# + +- my $filesinpackage = installer::converter::copy_collector($filesinproductlanguageresolvedarrayref); +- my $linksinpackage = installer::converter::copy_collector($linksinproductlanguageresolvedarrayref); +- my $unixlinksinpackage = installer::converter::copy_collector($unixlinksinproductlanguageresolvedarrayref); +- my $dirsinpackage = installer::converter::copy_collector($directoriesforepmarrayref); ++ $filesinpackage = installer::converter::copy_collector($filesinpackage); ++ $linksinpackage = installer::converter::copy_collector($linksinpackage); ++ $unixlinksinpackage = installer::converter::copy_collector($unixlinksinpackage); ++ $dirsinpackage = installer::converter::copy_collector($dirsinpackage); + + ########################################### + # setting the root path for the packages +@@ -1016,15 +1025,6 @@ sub run { + installer::scriptitems::add_rootpath_to_links($linksinpackage, $packagerootpath); + installer::scriptitems::add_rootpath_to_files($unixlinksinpackage, $packagerootpath); + +- ################################# +- # collecting items for package +- ################################# +- +- $filesinpackage = installer::packagelist::find_files_for_package($filesinpackage, $onepackage); +- $unixlinksinpackage = installer::packagelist::find_files_for_package($unixlinksinpackage, $onepackage); +- $linksinpackage = installer::packagelist::find_links_for_package($linksinpackage, $filesinpackage); +- $dirsinpackage = installer::packagelist::find_dirs_for_package($dirsinpackage, $onepackage); +- + ############################################### + # nothing to do, if $filesinpackage is empty + ############################################### +diff --git a/solenv/bin/modules/installer/packagelist.pm b/solenv/bin/modules/installer/packagelist.pm +index 14daf9907507..a0e1da760b44 100644 +--- a/solenv/bin/modules/installer/packagelist.pm ++++ b/solenv/bin/modules/installer/packagelist.pm +@@ -239,47 +239,43 @@ sub find_files_for_package + { + my ($filelist, $onepackage) = @_; + +- my @newfilelist = (); ++ my @newfilelist; ++ my $lastmodules = ''; ++ my $lastincludefile = 0; + +- for ( my $i = 0; $i <= $#{$filelist}; $i++ ) ++ my %packagemodules = map {$_ => 1} @{$onepackage->{'allmodules'}}; ++ ++ for my $onefile (@$filelist) + { +- my $onefile = ${$filelist}[$i]; + my $modulesstring = $onefile->{'modules'}; # comma separated modules list ++ ++ # check if the modules string is the same as in the last file ++ if ($modulesstring eq $lastmodules) ++ { ++ push(@newfilelist, $onefile) if $lastincludefile; ++ next; ++ } ++ + my $moduleslist = installer::converter::convert_stringlist_into_array(\$modulesstring, ","); + + my $includefile = 0; + + # iterating over all modules of this file +- +- for ( my $j = 0; $j <= $#{$moduleslist}; $j++ ) +- { +- if ( $includefile ) { next; } +- my $filemodule = ${$moduleslist}[$j]; ++ for my $filemodule (@$moduleslist) { + installer::remover::remove_leading_and_ending_whitespaces(\$filemodule); +- +- # iterating over all modules of the package +- +- my $packagemodules = $onepackage->{'allmodules'}; +- +- for ( my $k = 0; $k <= $#{$packagemodules}; $k++ ) +- { +- if ( $includefile ) { next; } +- my $packagemodule = ${$packagemodules}[$k]; +- +- if ( $filemodule eq $packagemodule ) +- { +- $includefile = 1; +- last; +- } ++ if ($packagemodules{$filemodule}) { ++ $includefile = 1; ++ last; + } + } + +- if ( $includefile ) +- { +- push(@newfilelist, $onefile); +- } +- } ++ push(@newfilelist, $onefile) if $includefile; ++ ++ # cache last result for this modules list ++ $lastmodules = $modulesstring; ++ $lastincludefile = $includefile; + ++ } + return \@newfilelist; + } + +-- +2.20.1 + diff --git a/libreoffice-no-destdircheck.patch b/libreoffice-no-destdircheck.patch new file mode 100644 index 0000000..9596aa4 --- /dev/null +++ b/libreoffice-no-destdircheck.patch @@ -0,0 +1,27 @@ +diff --git a/bin/distro-install-clean-up b/bin/distro-install-clean-up +index 701c9ffa0972..0d0fc27246ff 100755 +--- a/bin/distro-install-clean-up ++++ b/bin/distro-install-clean-up +@@ -71,22 +71,3 @@ for dir in $DESTDIR$DOCDIR $DESTDIR$INSTALLDIR/sdk/examples ; do + -name "manifest.mf" \) -exec chmod 644 {} \; + fi + done +- +-if test "z$DESTDIR" != "z" ; then +- echo "Checking for DESTDIR inside installed files..." +- found_destdir= +- for file in `find $DESTDIR -type f` ; do +- grep -q "$DESTDIR" $file && echo "$file: includes the string \"$DESTDIR\"" && found_destdir=1 +- done +- if test "z$found_destdir" != "z" ; then +- echo "!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!" +- echo "The path DESTDIR:$DESTDIR was found inside some" +- echo "installed files. It is probably a bug." +- echo +- echo "Especially, if the DESTDIR is set to \$RPM_BUILD_ROOT" +- echo "when creating RPM packages. Even it could be a security hole" +- echo "if the application searches /var/tmp for binaries or" +- echo "config files because the directory is world-writable." +- echo "!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!" +- fi +-fi diff --git a/libreoffice.changes b/libreoffice.changes index f298baf..b9da8a6 100644 --- a/libreoffice.changes +++ b/libreoffice.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Feb 25 12:55:35 UTC 2019 - Tomáš Chvátal + +- Add patches speeding up install: + * 0001-Speed-up-languagepack-installation.patch + * libreoffice-no-destdircheck.patch + ------------------------------------------------------------------- Fri Feb 22 09:53:08 UTC 2019 - Tomáš Chvátal diff --git a/libreoffice.spec b/libreoffice.spec index a611ed1..f0c94dc 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -99,9 +99,12 @@ Patch1: scp2-user-config-suse.diff # FIXME: the right fix is to compile the help and produce the .db_, .ht_, and other files Patch2: nlpsolver-no-broken-help.diff Patch3: mediawiki-no-broken-help.diff +Patch4: 0001-Speed-up-languagepack-installation.patch Patch5: old-boost.patch # try to save space by using hardlinks Patch990: install-with-hardlinks.diff +# save time by relying on rpm check rather than doing stupid find+grep +Patch991: libreoffice-no-destdircheck.patch BuildRequires: %{name}-share-linker BuildRequires: ant BuildRequires: autoconf @@ -960,7 +963,9 @@ Provides %{langname} translations and additional resources (help files, etc.) fo %endif # Leap 42/SLE-12 %patch2 %patch3 +%patch4 -p1 %patch990 -p1 +%patch991 -p1 # Disable some of the failing tests (some are random) %if 0%{?suse_version} < 1330