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/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package installer
::windows
::upgrade
;
24 use installer
::exiter
;
26 use installer
::globals
;
27 use installer
::windows
::idtglobal
;
29 ####################################################################################
30 # Creating the file Upgrade.idt dynamically
32 # UpgradeCode VersionMin VersionMax Language Attributes Remove ActionProperty
33 ####################################################################################
35 sub create_upgrade_table
37 my ($basedir, $allvariableshashref) = @_;
39 my @upgradetable = ();
41 installer
::windows
::idtglobal
::write_idt_header
(\
@upgradetable, "upgrade");
43 # Setting all products, that must be removed.
44 my $newline = $installer::globals
::upgradecode
. "\t" . "\t" . $installer::globals
::msiproductversion
. "\t" . "\t" . "513" . "\t" . "\t" . "OLDPRODUCTS" . "\n";
45 push(@upgradetable, $newline);
47 # preventing downgrading
48 $newline = $installer::globals
::upgradecode
. "\t" . $installer::globals
::msiproductversion
. "\t" . "\t" . "\t" . "2" . "\t" . "\t" . "NEWPRODUCTS" . "\n";
49 push(@upgradetable, $newline);
53 my $upgradetablename = $basedir . $installer::globals
::separator
. "Upgrade.idt";
54 installer
::files
::save_file
($upgradetablename ,\
@upgradetable);
55 my $infoline = "Created idt file: $upgradetablename\n";
56 push(@installer::globals
::logfileinfo
, $infoline);
59 ##############################################################
60 # Reading the file with UpgradeCodes of old products,
61 # that can be removed, if the user wants to remove them.
62 ##############################################################
64 sub analyze_file_for_upgrade_table
66 my ($filecontent) = @_;
70 for ( my $i = 0; $i <= $#{$filecontent}; $i++ )
72 my $line = ${$filecontent}[$i];
73 if ( $line =~ /^\s*$/ ) { next; } # empty lines can be ignored
74 if ( $line =~ /^\s*\#/ ) { next; } # comment lines starting with a hash
76 if ( $line =~ /^(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)$/ ) { push(@allnewlines, $line); }
77 else { installer
::exiter
::exit_program
("ERROR: Wrong syntax in file for upgrade table", "analyze_file_for_upgrade_table"); }