file.pm (d1fa6344) | file.pm (f30bf281) |
---|---|
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 --- 363 unchanged lines hidden (view full) --- 372 my $uniquefilename = ""; 373 my $counter = 0; 374 375 if ( $fileref->{'Name'} ) { $uniquefilename = $fileref->{'Name'}; } 376 377 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$uniquefilename); # making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs 378 379 # Reading unique filename with help of "Component_" in File table from old database | 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 --- 363 unchanged lines hidden (view full) --- 372 my $uniquefilename = ""; 373 my $counter = 0; 374 375 if ( $fileref->{'Name'} ) { $uniquefilename = $fileref->{'Name'}; } 376 377 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$uniquefilename); # making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs 378 379 # Reading unique filename with help of "Component_" in File table from old database |
380 if (( $installer::globals::updatedatabase ) && ( exists($uniquefilenamehashref->{"$component/$uniquefilename"}) )) | 380 if (( $installer::globals::prepare_winpatch ) && ( exists($installer::globals::savedmapping{"$component/$uniquefilename"}) )) |
381 { | 381 { |
382 $uniquefilename = $uniquefilenamehashref->{"$component/$uniquefilename"}; # syntax of $value: ($uniquename;$shortname) 383 if ( $uniquefilename =~ /^\s*(.*?)\;\s*(.*?)\s*$/ ) { $uniquefilename = $1; } 384 $lcuniquefilename = lc($uniquefilename); 385 $installer::globals::alluniquefilenames{$uniquefilename} = 1; 386 $installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1; 387 return $uniquefilename; 388 } 389 elsif (( $installer::globals::prepare_winpatch ) && ( exists($installer::globals::savedmapping{"$component/$uniquefilename"}) )) 390 { | |
391 # If we have a FTK mapping for this component/file, use it. 392 $installer::globals::savedmapping{"$component/$uniquefilename"} =~ m/^(.*);/; 393 $uniquefilename = $1; 394 $lcuniquefilename = lc($uniquefilename); 395 $installer::globals::alluniquefilenames{$uniquefilename} = 1; 396 $installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1; 397 return $uniquefilename; 398 } --- 69 unchanged lines hidden (view full) --- 468 469 my $filename = $fileref->{'Name'}; 470 471 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$filename); # making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs 472 473 my $shortstring; 474 475 # Reading short string with help of "FileName" in File table from old database | 382 # If we have a FTK mapping for this component/file, use it. 383 $installer::globals::savedmapping{"$component/$uniquefilename"} =~ m/^(.*);/; 384 $uniquefilename = $1; 385 $lcuniquefilename = lc($uniquefilename); 386 $installer::globals::alluniquefilenames{$uniquefilename} = 1; 387 $installer::globals::alllcuniquefilenames{$lcuniquefilename} = 1; 388 return $uniquefilename; 389 } --- 69 unchanged lines hidden (view full) --- 459 460 my $filename = $fileref->{'Name'}; 461 462 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$filename); # making /registry/schema/org/openoffice/VCL.xcs to VCL.xcs 463 464 my $shortstring; 465 466 # Reading short string with help of "FileName" in File table from old database |
476 if (( $installer::globals::updatedatabase ) && ( exists($uniquefilenamehashref->{"$fileref->{'componentname'}/$filename"}) )) | 467 if (( $installer::globals::prepare_winpatch ) && ( exists($installer::globals::savedmapping{"$fileref->{'componentname'}/$filename"}) )) |
477 { | 468 { |
478 my $value = $uniquefilenamehashref->{"$fileref->{'componentname'}/$filename"}; # syntax of $value: ($uniquename;$shortname) 479 if ( $value =~ /^\s*(.*?)\;\s*(.*?)\s*$/ ) { $shortstring = $2; } # already collected in function "collect_shortnames_from_old_database" 480 else { $shortstring = $filename; } 481 } 482 elsif (( $installer::globals::prepare_winpatch ) && ( exists($installer::globals::savedmapping{"$fileref->{'componentname'}/$filename"}) )) 483 { | |
484 $installer::globals::savedmapping{"$fileref->{'componentname'}/$filename"} =~ m/.*;(.*)/; 485 if ($1 ne '') 486 { 487 $shortstring = $1; 488 } 489 else 490 { 491 $shortstring = installer::windows::idtglobal::make_eight_three_conform_with_hash($filename, "file", $shortnamesref); --- 70 unchanged lines hidden (view full) --- 562 } 563 564 if ( $installer::globals::prepare_winpatch ) { $fileversion = ""; } # Windows patches do not allow this version # -> who says so? 565 566 return $fileversion; 567} 568 569############################################# | 469 $installer::globals::savedmapping{"$fileref->{'componentname'}/$filename"} =~ m/.*;(.*)/; 470 if ($1 ne '') 471 { 472 $shortstring = $1; 473 } 474 else 475 { 476 $shortstring = installer::windows::idtglobal::make_eight_three_conform_with_hash($filename, "file", $shortnamesref); --- 70 unchanged lines hidden (view full) --- 547 } 548 549 if ( $installer::globals::prepare_winpatch ) { $fileversion = ""; } # Windows patches do not allow this version # -> who says so? 550 551 return $fileversion; 552} 553 554############################################# |
570# Returning the sequence for a file 571############################################# 572 573sub get_sequence_for_file 574{ 575 my ($number, $onefile, $fileentry, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref, $allfilecomponents) = @_; 576 577 my $sequence = ""; 578 my $infoline = ""; 579 my $pffcomponentname = $onefile->{'componentname'} . "_pff"; 580 581 if ( $installer::globals::updatedatabase ) 582 { 583 if (( exists($allupdatesequenceshashref->{$onefile->{'uniquename'}}) ) && 584 (( $onefile->{'componentname'} eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} ) || 585 ( $pffcomponentname eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} ))) 586 { 587 # The second condition is necessary to find shifted files, that have same "uniquename", but are now 588 # located in another directory. This can be seen at the component name. 589 $sequence = $allupdatesequenceshashref->{$onefile->{'uniquename'}}; 590 $onefile->{'assignedsequencenumber'} = $sequence; 591 # Collecting all used sequences, to guarantee, that no number is unused 592 $installer::globals::allusedupdatesequences{$sequence} = 1; 593 # Special help for files, that already have a "pff" component name (for example after ServicePack 1) 594 if ( $pffcomponentname eq $allupdatecomponentshashref->{$onefile->{'uniquename'}} ) 595 { 596 $infoline = "Warning: Special handling for component \"$pffcomponentname\". This file was added after the final, but before this ServicePack.\n"; 597 $installer::logger::Lang->print($infoline); 598 $onefile->{'componentname'} = $pffcomponentname; # pff for "post final file" 599 $fileentry->{'Component_'} = $onefile->{'componentname'}; 600 if ( ! exists($allfilecomponents->{$fileentry->{'Component_'}}) ) { $allfilecomponents->{$fileentry->{'Component_'}} = 1; } 601 } 602 } 603 else 604 { 605 $installer::globals::updatesequencecounter++; 606 $sequence = $installer::globals::updatesequencecounter; 607 $onefile->{'assignedsequencenumber'} = $sequence; 608 # $onefile->{'assignedcabinetfile'} = $installer::globals::pffcabfilename; # assigning to cabinet file for "post final files" 609 # Collecting all new files 610 $installer::globals::newupdatefiles{$sequence} = $onefile; 611 # Saving in sequence hash 612 $allupdatefileorderhashref->{$sequence} = $onefile->{'uniquename'}; 613 614 # If the new file is part of an existing component, this must be changed now. All files 615 # of one component have to be included in one cabinet file. But because the order must 616 # not change, all new files have to be added to new components. 617 # $onefile->{'componentname'} = $file{'Component_'}; 618 619 $onefile->{'componentname'} = $onefile->{'componentname'} . "_pff"; # pff for "post final file" 620 $fileentry->{'Component_'} = $onefile->{'componentname'}; 621 if ( ! exists($allfilecomponents->{$fileentry->{'Component_'}}) ) { $allfilecomponents->{$fileentry->{'Component_'}} = 1; } 622 $onefile->{'PostFinalFile'} = 1; 623 # $installer::globals::pfffileexists = 1; 624 # The sequence for this file has changed. It has to be inserted at the end of the files collector. 625 $installer::globals::insert_file_at_end = 1; 626 $installer::globals::newfilescollector{$sequence} = $onefile; # Adding new files to the end of the filescollector 627 $installer::globals::newfilesexist = 1; 628 } 629 } 630 else 631 { 632 $sequence = $number; 633 # my $sequence = $number + 1; 634 635 # Idea: Each component is packed into a cab file. 636 # This requires that all files in one cab file have sequences directly follwing each other, 637 # for instance from 1456 to 1466. Then in the media table the LastSequence for this cab file 638 # is 1466. 639 # Because all files belonging to one component are directly behind each other in the file 640 # collector, it is possible to use simply an increasing number as sequence value. 641 # If files belonging to one component are not directly behind each other in the files collector 642 # this mechanism will no longer work. 643 } 644 645 return $sequence; 646} 647 648############################################# | |
649# Returning the Windows language of a file 650############################################# 651 652sub get_language_for_file 653{ 654 my ($fileref) = @_; 655 656 my $language = ""; --- 27 unchanged lines hidden (view full) --- 684 my $keypath = $onefile->{'Name'}; 685 $keypath =~ s/\.//g; 686 $keypath = lc($keypath); 687 $keypath = "userreg_" . $keypath; 688 689 return $keypath; 690} 691 | 555# Returning the Windows language of a file 556############################################# 557 558sub get_language_for_file 559{ 560 my ($fileref) = @_; 561 562 my $language = ""; --- 27 unchanged lines hidden (view full) --- 590 my $keypath = $onefile->{'Name'}; 591 $keypath =~ s/\.//g; 592 $keypath = lc($keypath); 593 $keypath = "userreg_" . $keypath; 594 595 return $keypath; 596} 597 |
692#################################################################### 693# Check, if in an update process files are missing. No removal 694# of files allowed for Windows Patch creation. 695# Also logging all new files, that have to be included in extra 696# components and cab files. 697#################################################################### 698 699sub check_file_sequences 700{ 701 my ($allupdatefileorderhashref, $allupdatecomponentorderhashref) = @_; 702 703 # All used sequences stored in %installer::globals::allusedupdatesequences 704 # Maximum sequence number of old database stored in $installer::globals::updatelastsequence 705 # All new files stored in %installer::globals::newupdatefiles 706 707 my $infoline = ""; 708 709 my @missing_sequences = (); 710 711 for ( my $i = 1; $i <= $installer::globals::updatelastsequence; $i++ ) 712 { 713 if ( ! exists($installer::globals::allusedupdatesequences{$i}) ) { push(@missing_sequences, $i); } 714 } 715 716 if ( $#missing_sequences > -1 ) 717 { 718 my $errorstring = ""; 719 for ( my $j = 0; $j <= $#missing_sequences; $j++ ) 720 { 721 my $filename = $allupdatefileorderhashref->{$missing_sequences[$j]}; 722 my $comp = $allupdatecomponentorderhashref->{$missing_sequences[$j]}; 723 $errorstring = "$errorstring$filename (Sequence: $missing_sequences[$j], Component: \"$comp\")\n"; 724 } 725 726 $infoline = "ERROR: Files are removed compared with update database.\nThe following files are missing:\n$errorstring"; 727 $installer::logger::Lang->print($infoline); 728 installer::exiter::exit_program($infoline, "check_file_sequences"); 729 } 730 731 # Searching for new files 732 733 my $counter = 0; 734 735 foreach my $key ( keys %installer::globals::newupdatefiles ) 736 { 737 my $onefile = $installer::globals::newupdatefiles{$key}; 738 $counter++; 739 if ( $counter == 1 ) 740 { 741 $installer::logger::Lang->print("\n"); 742 $installer::logger::Lang->print("New files compared to the update database:\n"); 743 } 744 745 $installer::logger::Lang->printf("%s (%s) Sequence: %s\n", 746 $onefile->{'Name'}, 747 $onefile->{'gid'}, 748 $onefile->{'assignedsequencenumber'}); 749 } 750 751 if ( $counter == 0 ) 752 { 753 $infoline = "Info: No new file compared with update database!\n"; 754 $installer::logger::Lang->print($infoline); 755 } 756 757} 758 | |
759################################################################### 760# Collecting further conditions for the component table. 761# This is used by multilayer products, to enable installation 762# of separate layers. 763################################################################### 764 765sub get_tree_condition_for_component 766{ --- 50 unchanged lines hidden (view full) --- 817} 818 819############################################ 820# Creating the file File.idt dynamically 821############################################ 822 823sub create_files_table 824{ | 598################################################################### 599# Collecting further conditions for the component table. 600# This is used by multilayer products, to enable installation 601# of separate layers. 602################################################################### 603 604sub get_tree_condition_for_component 605{ --- 50 unchanged lines hidden (view full) --- 656} 657 658############################################ 659# Creating the file File.idt dynamically 660############################################ 661 662sub create_files_table 663{ |
825 my ($filesref, $allfilecomponentsref, $basedir, $allvariables, $uniquefilenamehashref, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref) = @_; | 664 my ($filesref, $allfilecomponentsref, $basedir, $allvariables, $uniquefilenamehashref) = @_; |
826 827 $installer::logger::Lang->add_timestamp("Performance Info: File Table start"); 828 829 # Structure of the files table: 830 # File Component_ FileName FileSize Version Language Attributes Sequence 831 # In this function, all components are created. 832 # 833 # $allfilecomponentsref is empty at the beginning --- 8 unchanged lines hidden (view full) --- 842 843 if ( $^O =~ /cygwin/i ) { installer::worker::generate_cygwin_pathes($filesref); } 844 845 # The filenames must be collected because of uniqueness 846 # 01-44-~1.DAT, 01-44-~2.DAT, ... 847 # my @shortnames = (); 848 my %shortnames = (); 849 | 665 666 $installer::logger::Lang->add_timestamp("Performance Info: File Table start"); 667 668 # Structure of the files table: 669 # File Component_ FileName FileSize Version Language Attributes Sequence 670 # In this function, all components are created. 671 # 672 # $allfilecomponentsref is empty at the beginning --- 8 unchanged lines hidden (view full) --- 681 682 if ( $^O =~ /cygwin/i ) { installer::worker::generate_cygwin_pathes($filesref); } 683 684 # The filenames must be collected because of uniqueness 685 # 01-44-~1.DAT, 01-44-~2.DAT, ... 686 # my @shortnames = (); 687 my %shortnames = (); 688 |
850 if ( $installer::globals::updatedatabase ) { collect_shortnames_from_old_database($uniquefilenamehashref, \%shortnames); } 851 | |
852 installer::windows::idtglobal::write_idt_header(\@filetable, "file"); 853 installer::windows::idtglobal::write_idt_header(\@filehashtable, "filehash"); 854 855 for ( my $i = 0; $i <= $#{$filesref}; $i++ ) 856 { 857 my %file = (); 858 859 my $onefile = ${$filesref}[$i]; --- 24 unchanged lines hidden (view full) --- 884 if ( $styles =~ /\bDONT_PACK\b/ ) { $file{'Attributes'} = "8192"; } 885 else { $file{'Attributes'} = "16384"; } 886 887 # $file{'Attributes'} = "16384"; # Sourcefile is packed 888 # $file{'Attributes'} = "8192"; # Sourcefile is unpacked 889 890 $installer::globals::insert_file_at_end = 0; 891 $counter++; | 689 installer::windows::idtglobal::write_idt_header(\@filetable, "file"); 690 installer::windows::idtglobal::write_idt_header(\@filehashtable, "filehash"); 691 692 for ( my $i = 0; $i <= $#{$filesref}; $i++ ) 693 { 694 my %file = (); 695 696 my $onefile = ${$filesref}[$i]; --- 24 unchanged lines hidden (view full) --- 721 if ( $styles =~ /\bDONT_PACK\b/ ) { $file{'Attributes'} = "8192"; } 722 else { $file{'Attributes'} = "16384"; } 723 724 # $file{'Attributes'} = "16384"; # Sourcefile is packed 725 # $file{'Attributes'} = "8192"; # Sourcefile is unpacked 726 727 $installer::globals::insert_file_at_end = 0; 728 $counter++; |
892 $file{'Sequence'} = get_sequence_for_file($counter, $onefile, \%file, $allupdatesequenceshashref, $allupdatecomponentshashref, $allupdatefileorderhashref, \%allfilecomponents); | 729 $file{'Sequence'} = $counter; |
893 894 $onefile->{'sequencenumber'} = $file{'Sequence'}; 895 896 my $oneline = $file{'File'} . "\t" . $file{'Component_'} . "\t" . $file{'FileName'} . "\t" 897 . $file{'FileSize'} . "\t" . $file{'Version'} . "\t" . $file{'Language'} . "\t" 898 . $file{'Attributes'} . "\t" . $file{'Sequence'} . "\n"; 899 900 push(@filetable, $oneline); --- 142 unchanged lines hidden --- | 730 731 $onefile->{'sequencenumber'} = $file{'Sequence'}; 732 733 my $oneline = $file{'File'} . "\t" . $file{'Component_'} . "\t" . $file{'FileName'} . "\t" 734 . $file{'FileSize'} . "\t" . $file{'Version'} . "\t" . $file{'Language'} . "\t" 735 . $file{'Attributes'} . "\t" . $file{'Sequence'} . "\n"; 736 737 push(@filetable, $oneline); --- 142 unchanged lines hidden --- |