From 1e4422a4b4c443c286c90853f50b739a67ce5d1f Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 16 May 2013 21:56:04 +0100 Subject: re-base on ALv2 code. Includes: Patches contributed by Mathias Bauer gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394707 http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1397337 http://svn.apache.org/viewvc?view=revision&revision=1397315 http://svn.apache.org/viewvc?view=revision&revision=1396797 Patches contributed by Andre Fischer Fixed getcsym.awk to handle #-comments that contain special regexp chars. http://svn.apache.org/viewvc?view=revision&revision=1230971 118778: Added ADDITIONAL_REPOSITORIES environment variable and its automatic setup in configure. http://svn.apache.org/viewvc?view=revision&revision=1232004 118160: Added external CoinMP library. http://svn.apache.org/viewvc?view=revision&revision=1233909 Patches contributed by Herbert Duerr #i119168# use generic LICENSE file for langpacks and sdks http://svn.apache.org/viewvc?view=revision&revision=1310178 macosxotoolhelper: need to quote perl regexp if it may contain regexp metachars http://svn.apache.org/viewvc?view=revision&revision=1183367 allow gbuild with empty sysroot on linux http://svn.apache.org/viewvc?view=revision&revision=1179186 Patches contributed by Ingo Schmidt native373: #164472# improvements for msi database http://svn.apache.org/viewvc?view=revision&revision=1167540 http://svn.apache.org/viewvc?view=revision&revision=1167539 Patches contributed by Jurgen Schmidt adapt setup package scripts to handle special DS_Store file for developer snapshot builds http://svn.apache.org/viewvc?view=revision&revision=1232430 imported patch extensions_i117681.patch http://svn.apache.org/viewvc?view=revision&revision=1172102 Patches contributed by Michael Stahl gbuild: RepositoryFixes.mk should be optional http://svn.apache.org/viewvc?view=revision&revision=1166123 xslt filter: remove the FLA horror wordml import filter: replace FLA usage with plain XSLT http://svn.apache.org/viewvc?view=revision&revision=1363727 Patch contributed by Oliver-Rainer Wittmann i#88652: applied patch, remove unicows deps http://svn.apache.org/viewvc?view=revision&revision=1177585 Remove lots of OS2 conditionals, re-extract Rhino Java, unwind cppunit pieces, cleanup Mac image bits, remove coin-mp and re-package lpsolve, Oxygen & Crystal, fixup qstart bits, expand MPLv2 subset checking. Change-Id: Iad5c8a76399620b892671633c0d8c29996db3564 --- solenv/bin/modules/installer/windows/directory.pm | 161 +++++++++++++--------- 1 file changed, 94 insertions(+), 67 deletions(-) (limited to 'solenv/bin/modules/installer/windows/directory.pm') diff --git a/solenv/bin/modules/installer/windows/directory.pm b/solenv/bin/modules/installer/windows/directory.pm index d6e79c7cd1ae..a4884c1b4c0f 100644 --- a/solenv/bin/modules/installer/windows/directory.pm +++ b/solenv/bin/modules/installer/windows/directory.pm @@ -1,29 +1,20 @@ -#************************************************************************* # -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# This file is part of the LibreOffice project. # -# Copyright 2000, 2010 Oracle and/or its affiliates. +# 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/. # -# OpenOffice.org - a multi-platform office productivity suite +# This file incorporates work covered by the following license notice: # -# This file is part of OpenOffice.org. +# 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 . # -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# -# for a copy of the LGPLv3 License. -# -#************************************************************************* package installer::windows::directory; @@ -32,6 +23,7 @@ use installer::files; use installer::globals; use installer::pathanalyzer; use installer::windows::idtglobal; +use installer::windows::msiglobal; ############################################################## # Collecting all directory trees in global hash @@ -83,9 +75,12 @@ sub overwrite_programfilesfolder sub make_short_dir_version { - my ($longstring, $length, $displayname) = @_; + my ($longstring) = @_; my $shortstring = ""; + my $cutlength = 60; + my $length = 5; # So the directory can still be recognized + my $longstring_save = $longstring; # Splitting the string at each "underline" and allowing only # $length characters per directory name. @@ -121,12 +116,17 @@ sub make_short_dir_version $shortstring =~ s/^\s*\_//; - if ( length($shortstring) > 72 ) - { - my $shortlength = length($shortstring); - my $infoline = "WARNING: Failed to create unique directory name with less than 72 characters: \"$displayname\" ($shortstring ($shortlength)).\n"; - push(@installer::globals::logfileinfo, $infoline); - } + # Setting unique ID to each directory + # No counter allowed, process must be absolute reproducable due to patch creation process. + + # chomp(my $id = `echo $longstring_save | md5sum | sed -e "s/ .*//g"`); # Very, very slow + # my $subid = substr($id, 0, 9); # taking only the first 9 digits + + my $subid = installer::windows::msiglobal::calculate_id($longstring_save, 9); # taking only the first 9 digits + + if ( length($shortstring) > $cutlength ) { $shortstring = substr($shortstring, 0, $cutlength); } + + $shortstring = $shortstring . "_" . $subid; return $shortstring; } @@ -141,20 +141,19 @@ sub create_unique_directorynames { my ($directoryref, $allvariables) = @_; - my %conversionhash = (); + my %completedirhashstep1 = (); + my %shortdirhash = (); + my %shortdirhashreverse = (); my $infoline = ""; my $errorcount = 0; for ( my $i = 0; $i <= $#{$directoryref}; $i++ ) { my $onedir = ${$directoryref}[$i]; - my $hostname = $onedir->{'HostName'}; + my $uniquename = $onedir->{'HostName'}; - my $uniquename = $hostname; my $styles = ""; if ( $onedir->{'Styles'} ) { $styles = $onedir->{'Styles'}; } - # get_path_from_fullqualifiedname(\$uniqueparentname); - # making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs $uniquename =~ s/^\s*//g; # removing beginning white spaces $uniquename =~ s/\s*$//g; # removing ending white spaces @@ -172,61 +171,94 @@ sub create_unique_directorynames $uniquename =~ s/_chart/_crt/g; $uniquename =~ s/_plat-linux/_plx/g; - my $startlength = 5; + # The names after this small changes must still be unique! + if ( exists($completedirhashstep1{$uniquename}) ) { installer::exiter::exit_program("ERROR: Error in packaging process. Unallowed modification of directory name, not unique (step 1): \"$uniquename\".", "create_unique_directorynames"); } + $completedirhashstep1{$uniquename} = 1; - if ( ! $allvariables->{'NOSHORTDIRECTORYNAMES'} ) - { - # This process does not work for SDK, because of its long and similar paths - $uniquename = make_short_dir_version($uniquename, $startlength, $hostname); # taking care of underlines! - } + # Starting to make unique name for the parent and its directory + my $originaluniquename = $uniquename; - if ( !$already_checked_the_frigging_directories_for_uniqueness && - exists($installer::globals::alluniquedirectorynames{$uniquename}) ) - { - # This is an error, that must stop the packaging process - $errorcount++; - - $infoline = "$errorcount: Already existing unique directory: $uniquename\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "$errorcount: First full directory: $conversionhash{$uniquename}\n"; - push( @installer::globals::logfileinfo, $infoline); - $infoline = "$errorcount: Current full directory: $hostname\n"; - push( @installer::globals::logfileinfo, $infoline); - } + $uniquename = make_short_dir_version($uniquename); - $conversionhash{$uniquename} = $hostname; + # Checking if the same directory already exists, but has another short version. + if (( exists($shortdirhash{$originaluniquename}) ) && ( $shortdirhash{$originaluniquename} ne $uniquename )) { installer::exiter::exit_program("ERROR: Error in packaging process. Unallowed modification of directory name, not unique (step 2A): \"$uniquename\".", "create_unique_directorynames"); } - $installer::globals::alluniquedirectorynames{$uniquename} = 1; + # Also checking vice versa + # Checking if the same short directory already exists, but has another long version. + if (( exists($shortdirhashreverse{$uniquename}) ) && ( $shortdirhashreverse{$uniquename} ne $originaluniquename )) { installer::exiter::exit_program("ERROR: Error in packaging process. Unallowed modification of directory name, not unique (step 2B): \"$uniquename\".", "create_unique_directorynames"); } - # Important: The unique parent is generated from the string $uniquename. Therefore counters - # like adding "_1" is not allowed to achive uniqueness, because this depends from other directories - # and does not deliver always the same result. + # Creating assignment from long to short directory names + $shortdirhash{$originaluniquename} = $uniquename; + $shortdirhashreverse{$uniquename} = $originaluniquename; - my $uniqueparentname = $uniquename; + # Important: The unique parent is generated from the string $originaluniquename (with the use of underlines). + + my $uniqueparentname = $originaluniquename; + my $keepparent = 1; if ( $uniqueparentname =~ /^\s*(.*)\_(.*?)\s*$/ ) # the underline is now the separator { $uniqueparentname = $1; + $keepparent = 0; } else { $uniqueparentname = $installer::globals::programfilesfolder; + $keepparent = 1; } - if ( $styles =~ /\bPROGRAMFILESFOLDER\b/ ) { $uniqueparentname = $installer::globals::programfilesfolder; } - if ( $styles =~ /\bCOMMONFILESFOLDER\b/ ) { $uniqueparentname = $installer::globals::commonfilesfolder; } - if ( $styles =~ /\bCOMMONAPPDATAFOLDER\b/ ) { $uniqueparentname = $installer::globals::commonappdatafolder; } - if ( $styles =~ /\bLOCALAPPDATAFOLDER\b/ ) { $uniqueparentname = $installer::globals::localappdatafolder; } + if ( $styles =~ /\bPROGRAMFILESFOLDER\b/ ) + { + $uniqueparentname = $installer::globals::programfilesfolder; + $keepparent = 1; + } + if ( $styles =~ /\bCOMMONFILESFOLDER\b/ ) + { + $uniqueparentname = $installer::globals::commonfilesfolder; + $keepparent = 1; + } + if ( $styles =~ /\bCOMMONAPPDATAFOLDER\b/ ) + { + $uniqueparentname = $installer::globals::commonappdatafolder; + $keepparent = 1; + } + if ( $styles =~ /\bLOCALAPPDATAFOLDER\b/ ) + { + $uniqueparentname = $installer::globals::localappdatafolder; + $keepparent = 1; + } if ( $styles =~ /\bSHAREPOINTPATH\b/ ) { $uniqueparentname = "SHAREPOINTPATH"; $installer::globals::usesharepointpath = 1; + $keepparent = 1; } + # also setting short directory name for the parent + + my $originaluniqueparentname = $uniqueparentname; + + if ( ! $keepparent ) + { + $uniqueparentname = make_short_dir_version($uniqueparentname); + } + + # Again checking if the same directory already exists, but has another short version. + if (( exists($shortdirhash{$originaluniqueparentname}) ) && ( $shortdirhash{$originaluniqueparentname} ne $uniqueparentname )) { installer::exiter::exit_program("ERROR: Error in packaging process. Unallowed modification of directory name, not unique (step 3A): \"$uniqueparentname\".", "create_unique_directorynames"); } + + # Also checking vice versa + # Checking if the same short directory already exists, but has another long version. + if (( exists($shortdirhashreverse{$uniqueparentname}) ) && ( $shortdirhashreverse{$uniqueparentname} ne $originaluniqueparentname )) { installer::exiter::exit_program("ERROR: Error in packaging process. Unallowed modification of directory name, not unique (step 3B): \"$uniqueparentname\".", "create_unique_directorynames"); } + + $shortdirhash{$originaluniqueparentname} = $uniqueparentname; + $shortdirhashreverse{$uniqueparentname} = $originaluniqueparentname; + + # Hyphen not allowed in database $uniquename =~ s/\-/\_/g; # making "-" to "_" $uniqueparentname =~ s/\-/\_/g; # making "-" to "_" + # And finally setting the values for the directories $onedir->{'uniquename'} = $uniquename; $onedir->{'uniqueparentname'} = $uniqueparentname; @@ -238,11 +270,6 @@ sub create_unique_directorynames $installer::globals::installlocationdirectoryset = 1; } } - - if ( $errorcount > 0 ) - { - installer::exiter::exit_program("ERROR: Failed to create unique directory names.", "create_unique_directorynames"); - } } ##################################################### -- cgit