msiglobal.pm (dca4887f) msiglobal.pm (1ba1fd99)
1#**************************************************************
2#
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance

--- 23 unchanged lines hidden (view full) ---

32use installer::logger;
33use installer::pathanalyzer;
34use installer::remover;
35use installer::scriptitems;
36use installer::systemactions;
37use installer::worker;
38use installer::windows::idtglobal;
39use installer::windows::language;
1#**************************************************************
2#
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance

--- 23 unchanged lines hidden (view full) ---

32use installer::logger;
33use installer::pathanalyzer;
34use installer::remover;
35use installer::scriptitems;
36use installer::systemactions;
37use installer::worker;
38use installer::windows::idtglobal;
39use installer::windows::language;
40use strict;
40
41###########################################################################
42# Generating the header of the ddf file.
43# The usage of ddf files is needed, because makecab.exe can only include
44# one sourcefile into a cab file
45###########################################################################
46
47sub write_ddf_file_header

--- 279 unchanged lines hidden (view full) ---

327 }
328 }
329
330 if ( ! $found_sequence ) { installer::exiter::exit_program("ERROR: No sequence found for $uniquefilename !", "get_file_sequence"); }
331
332 return $sequence;
333}
334
41
42###########################################################################
43# Generating the header of the ddf file.
44# The usage of ddf files is needed, because makecab.exe can only include
45# one sourcefile into a cab file
46###########################################################################
47
48sub write_ddf_file_header

--- 279 unchanged lines hidden (view full) ---

328 }
329 }
330
331 if ( ! $found_sequence ) { installer::exiter::exit_program("ERROR: No sequence found for $uniquefilename !", "get_file_sequence"); }
332
333 return $sequence;
334}
335
335########################################################################
336# For update and patch reasons the pack order needs to be saved.
337# The pack order is saved in the ddf files; the names and locations
338# of the ddf files are saved in @installer::globals::allddffiles.
339# The outputfile "packorder.txt" can be saved in
340# $installer::globals::infodirectory .
341########################################################################
342
336
343sub save_packorder
344{
345 installer::logger::include_header_into_logfile("Saving pack order");
346
347 $installer::logger::Lang->add_timestamp("Performance Info: saving pack order start");
348
349 my $packorderfilename = "packorder.txt";
350 $packorderfilename = $installer::globals::infodirectory . $installer::globals::separator . $packorderfilename;
351
352 my @packorder = ();
353
354 my $headerline = "\# Syntax\: Filetable_Sequence Cabinetfilename Physical_FileName Unique_FileName\n\n";
355 push(@packorder, $headerline);
356
357 for ( my $i = 0; $i <= $#installer::globals::allddffiles; $i++ )
358 {
359 my $ddffilename = $installer::globals::allddffiles[$i];
360 my $ddffile = installer::files::read_file($ddffilename);
361 my $cabinetfile = "";
362
363 for ( my $j = 0; $j <= $#{$ddffile}; $j++ )
364 {
365 my $oneline = ${$ddffile}[$j];
366
367 # Getting the Cabinet file name
368
369 if ( $oneline =~ /^\s*\.Set\s+CabinetName.*\=(.*?)\s*$/ ) { $cabinetfile = $1; }
370 if ( $oneline =~ /^\s*\.Set\s+/ ) { next; }
371
372 if ( $oneline =~ /^\s*\"(.*?)\"\s+(.*?)\s*$/ )
373 {
374 my $sourcefile = $1;
375 my $uniquefilename = $2;
376
377 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$sourcefile);
378
379 # Using the hash created in create_files_table for performance reasons to get the sequence number
380 my $filesequence = "";
381 if ( exists($installer::globals::uniquefilenamesequence{$uniquefilename}) ) { $filesequence = $installer::globals::uniquefilenamesequence{$uniquefilename}; }
382 else { installer::exiter::exit_program("ERROR: No sequence number value for $uniquefilename !", "save_packorder"); }
383
384 my $line = $filesequence . "\t" . $cabinetfile . "\t" . $sourcefile . "\t" . $uniquefilename . "\n";
385 push(@packorder, $line);
386 }
387 }
388 }
389
390 installer::files::save_file($packorderfilename ,\@packorder);
391
392 $installer::logger::Lang->add_timestamp("Performance Info: saving pack order end");
393}
394
395#################################################################
396# Returning the name of the msi database
397#################################################################
398
399sub get_msidatabasename
400{
401 my ($allvariableshashref, $language) = @_;
402

--- 679 unchanged lines hidden (view full) ---

1082
1083 if ( $installer::globals::iswin && $installer::globals::plat =~ /cygwin/i) # Windows line ends only for Cygwin
1084 {
1085 include_windows_lineends($setupinifile);
1086 }
1087
1088 installer::files::save_file($setupinifilename, $setupinifile);
1089
337#################################################################
338# Returning the name of the msi database
339#################################################################
340
341sub get_msidatabasename
342{
343 my ($allvariableshashref, $language) = @_;
344

--- 679 unchanged lines hidden (view full) ---

1024
1025 if ( $installer::globals::iswin && $installer::globals::plat =~ /cygwin/i) # Windows line ends only for Cygwin
1026 {
1027 include_windows_lineends($setupinifile);
1028 }
1029
1030 installer::files::save_file($setupinifilename, $setupinifile);
1031
1090 $infoline = "Generated file $setupinifilename !\n";
1091 $installer::logger::Lang->print($infoline);
1032 $installer::logger::Lang->printf("Generated file %s\n", $setupinifilename);
1092}
1093
1094#################################################################
1095# Copying the files defined as ScpActions into the
1096# installation set.
1097#################################################################
1098
1099sub copy_scpactions_into_installset

--- 28 unchanged lines hidden (view full) ---

1128#################################################################
1129
1130sub copy_windows_installer_files_into_installset
1131{
1132 my ($installdir, $includepatharrayref, $allvariables) = @_;
1133
1134 installer::logger::include_header_into_logfile("Copying Windows installer files into installation set");
1135
1033}
1034
1035#################################################################
1036# Copying the files defined as ScpActions into the
1037# installation set.
1038#################################################################
1039
1040sub copy_scpactions_into_installset

--- 28 unchanged lines hidden (view full) ---

1069#################################################################
1070
1071sub copy_windows_installer_files_into_installset
1072{
1073 my ($installdir, $includepatharrayref, $allvariables) = @_;
1074
1075 installer::logger::include_header_into_logfile("Copying Windows installer files into installation set");
1076
1136 @copyfile = ();
1077 my @copyfile = ();
1137 push(@copyfile, "loader2.exe");
1138
1139 if ( $allvariables->{'NOLOADERREQUIRED'} ) { @copyfile = (); }
1140
1141 for ( my $i = 0; $i <= $#copyfile; $i++ )
1142 {
1143 my $filename = $copyfile[$i];
1144 my $sourcefileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 1);

--- 339 unchanged lines hidden (view full) ---

1484
1485 foreach my $onefile ( @versionnt_files )
1486 {
1487 my $fullfilename = $basedir . $installer::globals::separator . $onefile;
1488
1489 if ( -f $fullfilename )
1490 {
1491 my $saving_required = 0;
1078 push(@copyfile, "loader2.exe");
1079
1080 if ( $allvariables->{'NOLOADERREQUIRED'} ) { @copyfile = (); }
1081
1082 for ( my $i = 0; $i <= $#copyfile; $i++ )
1083 {
1084 my $filename = $copyfile[$i];
1085 my $sourcefileref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$filename, $includepatharrayref, 1);

--- 339 unchanged lines hidden (view full) ---

1425
1426 foreach my $onefile ( @versionnt_files )
1427 {
1428 my $fullfilename = $basedir . $installer::globals::separator . $onefile;
1429
1430 if ( -f $fullfilename )
1431 {
1432 my $saving_required = 0;
1492 $filecontent = installer::files::read_file($fullfilename);
1433 my $filecontent = installer::files::read_file($fullfilename);
1493
1494 for ( my $i = 3; $i <= $#{$filecontent}; $i++ ) # ignoring the first three lines
1495 {
1496 my $oneline = ${$filecontent}[$i];
1497
1498 if ( $oneline =~ /\bVersionNT\b/ )
1499 {
1500 ${$filecontent}[$i] =~ s/\bVersionNT\b/VersionNT64/g;

--- 260 unchanged lines hidden (view full) ---

1761 {
1762 if ( $allvariableshashref->{'PATCHUPGRADECODE'} ) { $installer::globals::upgradecode = $allvariableshashref->{'PATCHUPGRADECODE'}; }
1763 else { installer::exiter::exit_program("ERROR: PATCHUPGRADECODE not defined in list file!", "set_global_code_variables"); }
1764 }
1765 else
1766 {
1767 # UpgradeCode can take english as default, if not defined in specified language
1768
1434
1435 for ( my $i = 3; $i <= $#{$filecontent}; $i++ ) # ignoring the first three lines
1436 {
1437 my $oneline = ${$filecontent}[$i];
1438
1439 if ( $oneline =~ /\bVersionNT\b/ )
1440 {
1441 ${$filecontent}[$i] =~ s/\bVersionNT\b/VersionNT64/g;

--- 260 unchanged lines hidden (view full) ---

1702 {
1703 if ( $allvariableshashref->{'PATCHUPGRADECODE'} ) { $installer::globals::upgradecode = $allvariableshashref->{'PATCHUPGRADECODE'}; }
1704 else { installer::exiter::exit_program("ERROR: PATCHUPGRADECODE not defined in list file!", "set_global_code_variables"); }
1705 }
1706 else
1707 {
1708 # UpgradeCode can take english as default, if not defined in specified language
1709
1769 $searchstring = "UPGRADECODE"; # searching in the codes.txt file
1770 $codeblock = installer::windows::idtglobal::get_language_block_from_language_file($searchstring, $codefile);
1710 my $searchstring = "UPGRADECODE"; # searching in the codes.txt file
1711 my $codeblock = installer::windows::idtglobal::get_language_block_from_language_file($searchstring, $codefile);
1771 $installer::globals::upgradecode = installer::windows::idtglobal::get_language_string_from_language_block($codeblock, $onelanguage, "");
1772 }
1773
1774 # if (( $installer::globals::productcode eq "" ) && ( ! $isopensource )) { installer::exiter::exit_program("ERROR: ProductCode for language $onelanguage not defined in $installer::globals::codefilename !", "set_global_code_variables"); }
1775 if ( $installer::globals::upgradecode eq "" ) { installer::exiter::exit_program("ERROR: UpgradeCode not defined in $installer::globals::codefilename !", "set_global_code_variables"); }
1776
1777 $infoline = "Setting ProductCode to: $installer::globals::productcode \n";
1778 $installer::logger::Lang->print($infoline);

--- 164 unchanged lines hidden (view full) ---

1943
1944 # Saving the file
1945 installer::files::save_file($removeregistryfilename ,$removeregistryfile);
1946 my $infoline = "Updated idt file: $removeregistryfilename \n";
1947 $installer::logger::Lang->print($infoline);
1948 }
1949}
1950
1712 $installer::globals::upgradecode = installer::windows::idtglobal::get_language_string_from_language_block($codeblock, $onelanguage, "");
1713 }
1714
1715 # if (( $installer::globals::productcode eq "" ) && ( ! $isopensource )) { installer::exiter::exit_program("ERROR: ProductCode for language $onelanguage not defined in $installer::globals::codefilename !", "set_global_code_variables"); }
1716 if ( $installer::globals::upgradecode eq "" ) { installer::exiter::exit_program("ERROR: UpgradeCode not defined in $installer::globals::codefilename !", "set_global_code_variables"); }
1717
1718 $infoline = "Setting ProductCode to: $installer::globals::productcode \n";
1719 $installer::logger::Lang->print($infoline);

--- 164 unchanged lines hidden (view full) ---

1884
1885 # Saving the file
1886 installer::files::save_file($removeregistryfilename ,$removeregistryfile);
1887 my $infoline = "Updated idt file: $removeregistryfilename \n";
1888 $installer::logger::Lang->print($infoline);
1889 }
1890}
1891
1951##########################################################################
1952# Reading saved mappings in Files.idt and Director.idt.
1953# This is required, if installation sets shall be created,
1954# that can be used for creation of msp files.
1955##########################################################################
1956
1892
1957sub read_saved_mappings
1958{
1959 installer::logger::include_header_into_logfile("Reading saved mappings from older installation sets:");
1960
1961 $installer::logger::Lang->add_timestamp("Performance Info: Reading saved mappings start");
1962
1963 if ( $installer::globals::previous_idt_dir )
1964 {
1965 my @errorlines = ();
1966 my $errorstring = "";
1967 my $error_occured = 0;
1968 my $file_error_occured = 0;
1969 my $dir_error = 0;
1970
1971 my $idtdir = $installer::globals::previous_idt_dir;
1972 $idtdir =~ s/\Q$installer::globals::separator\E\s*$//;
1973
1974 # Reading File.idt
1975
1976 my $idtfile = $idtdir . $installer::globals::separator . "File.idt";
1977 $installer::logger::Global->print("\n");
1978 $installer::logger::Global->printf("Analyzing file: %s\n", $idtfile);
1979 if ( ! -f $idtfile )
1980 {
1981 $installer::logger::Global->printf("Warning: File %s does not exist!\n", $idtfile);
1982 }
1983
1984 my $n = 0;
1985 open (F, "<$idtfile") || installer::exiter::exit_program("ERROR: Cannot open file $idtfile for reading", "read_saved_mappings");
1986 <F>; <F>; <F>;
1987 while (<F>)
1988 {
1989 m/^([^\t]+)\t([^\t]+)\t((.*)\|)?([^\t]*)/;
1990 print "OUT1: \$1: $1, \$2: $2, \$3: $3, \$4: $4, \$5: $5\n";
1991 next if ("$1" eq "$5") && (!defined($3));
1992 my $lc1 = lc($1);
1993
1994 if ( exists($installer::globals::savedmapping{"$2/$5"}))
1995 {
1996 if ( ! $file_error_occured )
1997 {
1998 $errorstring = "\nErrors in $idtfile: \n";
1999 push(@errorlines, $errorstring);
2000 }
2001 $errorstring = "Duplicate savedmapping{" . "$2/$5}\n";
2002 push(@errorlines, $errorstring);
2003 $error_occured = 1;
2004 $file_error_occured = 1;
2005 }
2006
2007 if ( exists($installer::globals::savedrevmapping{$lc1}))
2008 {
2009 if ( ! $file_error_occured )
2010 {
2011 $errorstring = "\nErrors in $idtfile: \n";
2012 push(@errorlines, $errorstring);
2013 }
2014 $errorstring = "Duplicate savedrevmapping{" . "$lc1}\n";
2015 push(@errorlines, $errorstring);
2016 $error_occured = 1;
2017 $file_error_occured = 1;
2018 }
2019
2020 my $shortname = $4 || '';
2021
2022 # Don't reuse illegal 8.3 mappings that we used to generate in 2.0.4
2023 if (index($shortname, '.') > 8 ||
2024 (index($shortname, '.') == -1 && length($shortname) > 8))
2025 {
2026 $shortname = '';
2027 }
2028
2029 if (( $shortname ne '' ) && ( index($shortname, '~') > 0 ) && ( exists($installer::globals::savedrev83mapping{$shortname}) ))
2030 {
2031 if ( ! $file_error_occured )
2032 {
2033 $errorstring = "\nErrors in $idtfile: \n";
2034 push(@errorlines, $errorstring);
2035 }
2036 $errorstring = "Duplicate savedrev83mapping{" . "$shortname}\n";
2037 push(@errorlines, $errorstring);
2038 $error_occured = 1;
2039 $file_error_occured = 1;
2040 }
2041
2042 $installer::globals::savedmapping{"$2/$5"} = "$1;$shortname";
2043 $installer::globals::savedrevmapping{lc($1)} = "$2/$5";
2044 $installer::globals::savedrev83mapping{$shortname} = "$2/$5" if $shortname ne '';
2045 $n++;
2046 }
2047
2048 close (F);
2049
2050 $installer::logger::Global->printf("Read %s old file table key or 8.3 name mappings from %s\n",
2051 $n, $idtfile);
2052
2053 # Reading Director.idt
2054
2055 $idtfile = $idtdir . $installer::globals::separator . "Director.idt";
2056 $installer::logger::Global->print("\n");
2057 $installer::logger::Global->printf("Analyzing file %s\n", $idtfile);
2058 if ( ! -f $idtfile )
2059 {
2060 $installer::logger::Global->printf("Warning: File %s does not exist!\n", $idtfile);
2061 }
2062
2063 $n = 0;
2064 open (F, "<$idtfile") || installer::exiter::exit_program("ERROR: Cannot open file $idtfile for reading", "read_saved_mappings");
2065 <F>; <F>; <F>;
2066 while (<F>)
2067 {
2068 m/^([^\t]+)\t([^\t]+)\t(([^~]+~\d.*)\|)?([^\t]*)/;
2069 next if (!defined($3));
2070 my $lc1 = lc($1);
2071
2072 print "OUT2: \$1: $1, \$2: $2, \$3: $3\n";
2073
2074 if ( exists($installer::globals::saved83dirmapping{$1}) )
2075 {
2076 if ( ! $dir_error_occured )
2077 {
2078 $errorstring = "\nErrors in $idtfile: \n";
2079 push(@errorlines, $errorstring);
2080 }
2081 $errorstring = "Duplicate saved83dirmapping{" . "$1}\n";
2082 push(@errorlines, $errorstring);
2083 $error_occured = 1;
2084 $dir_error_occured = 1;
2085 }
2086
2087 $installer::globals::saved83dirmapping{$1} = $4;
2088 $n++;
2089 }
2090 close (F);
2091
2092 $installer::logger::Global->printf("Read %s old directory 8.3 name mappings from %s\n",
2093 $n, $idtfile);
2094
2095 # Analyzing errors
2096
2097 if ( $error_occured )
2098 {
2099 for my $line (@errorlines)
2100 {
2101 $installer::logger::Info->print($line);
2102 $installer::logger::Global->print($line);
2103 }
2104 installer::exiter::exit_program("ERROR: Duplicate entries in saved mappings!", "read_saved_mappings");
2105 }
2106 } else {
2107 installer::exiter::exit_program("ERROR: Windows patch shall be prepared, but environment variable PREVIOUS_IDT_DIR is not set!", "read_saved_mappings");
2108 }
2109
2110 $installer::logger::Lang->add_timestamp("Performance Info: Reading saved mappings end");
2111}
2112
21131;
2114
18931;
1894