file.pm (9f91b7e3) file.pm (677600b0)
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

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

630 }
631}
632
633
634
635
636sub create_items_for_missing_files ($$$)
637{
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

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

630 }
631}
632
633
634
635
636sub create_items_for_missing_files ($$$)
637{
638 my ($missing_items, $msi, $directory_list) = @_;
638 my ($missing_items, $source_msi, $directory_list) = @_;
639
640 # For creation of the FeatureComponent table (in a later step) we
641 # have to provide references from the file to component and
642 # modules (ie features). Note that Each file belongs to exactly
643 # one component but one component can belong to multiple features.
639
640 # For creation of the FeatureComponent table (in a later step) we
641 # have to provide references from the file to component and
642 # modules (ie features). Note that Each file belongs to exactly
643 # one component but one component can belong to multiple features.
644 my $component_to_features_map = create_feature_component_map($msi);
644 my $component_to_features_map = create_feature_component_map($source_msi);
645
646 my @new_files = ();
647 foreach my $row (@$missing_items)
648 {
649 $installer::logger::Info->printf("creating new file item for '%s'\n", $row->GetValue('File'));
645
646 my @new_files = ();
647 foreach my $row (@$missing_items)
648 {
649 $installer::logger::Info->printf("creating new file item for '%s'\n", $row->GetValue('File'));
650 my $file_item = create_script_item_for_deleted_file($row, $msi, $component_to_features_map);
650 my $file_item = create_script_item_for_deleted_file($row, $source_msi, $component_to_features_map);
651 push @new_files, $file_item;
652 }
653
654 return @new_files;
655}
656
657
658
659
651 push @new_files, $file_item;
652 }
653
654 return @new_files;
655}
656
657
658
659
660=head2 create_script_item_for_deleted_file (($file_row, $source_msi, $component_to_features_map)
661
662 Create a new script item for a file that was present in the
663 previous release but isn't anymore. Most of the necessary
664 information is taken from the 'File' table of the source release.
665
666 The values of 'sourcepath' and 'cyg_sourcepath' will point to the
667 respective file in the unpacked source release. An alternative
668 would be to let them point to an empty file. That, however, might
669 make the patch bigger (diff between identical file contents is
670 (almost) empty, diff between file and empty file is the 'inverse'
671 of the file).
672
673=cut
674
675my $use_source_files_for_missing_files = 1;
676
660sub create_script_item_for_deleted_file ($$$)
661{
677sub create_script_item_for_deleted_file ($$$)
678{
662 my ($file_row, $msi, $component_to_features_map) = @_;
679 my ($file_row, $source_msi, $component_to_features_map) = @_;
663
664 my $uniquename = $file_row->GetValue('File');
665
680
681 my $uniquename = $file_row->GetValue('File');
682
666 my $file_map = $msi->GetFileMap();
683 my $file_map = $source_msi->GetFileMap();
667
684
668 my $directory_item = $file_map->{$uniquename}->{'directory'};
685 my $file_item = $file_map->{$uniquename};
686 my $directory_item = $file_item->{'directory'};
669 my $source_path = $directory_item->{'full_source_long_name'};
670 my $target_path = $directory_item->{'full_target_long_name'};
687 my $source_path = $directory_item->{'full_source_long_name'};
688 my $target_path = $directory_item->{'full_target_long_name'};
671 my $full_source_name = File::Spec->catfile(
672 installer::patch::InstallationSet::GetUnpackedCabPath(
673 $msi->{'version'},
674 $msi->{'is_current_version'},
675 $msi->{'language'},
676 $msi->{'package_format'},
677 $msi->{'product_name'}),
678 $source_path,
679 $uniquename);
689 my $full_source_name = undef;
690 if ($use_source_files_for_missing_files)
691 {
692 $full_source_name = File::Spec->catfile(
693 installer::patch::InstallationSet::GetUnpackedCabPath(
694 $source_msi->{'version'},
695 $source_msi->{'is_current_version'},
696 $source_msi->{'language'},
697 $source_msi->{'package_format'},
698 $source_msi->{'product_name'}),
699 $source_path,
700 $file_item->{'long_name'});
701 }
702 else
703 {
704 $full_source_name = "/c/tmp/missing/".$uniquename;
705 installer::patch::Tools::touch($full_source_name);
706 }
680 my ($long_name, undef) = installer::patch::Msi::SplitLongShortName($file_row->GetValue("FileName"));
681 my $target_name = File::Spec->catfile($target_path, $long_name);
682 if ( ! -f $full_source_name)
683 {
684 installer::logger::PrintError("can not find file '%s' in previous version (tried '%s')\n",
685 $uniquename,
686 $full_source_name);
687 return undef;

--- 501 unchanged lines hidden ---
707 my ($long_name, undef) = installer::patch::Msi::SplitLongShortName($file_row->GetValue("FileName"));
708 my $target_name = File::Spec->catfile($target_path, $long_name);
709 if ( ! -f $full_source_name)
710 {
711 installer::logger::PrintError("can not find file '%s' in previous version (tried '%s')\n",
712 $uniquename,
713 $full_source_name);
714 return undef;

--- 501 unchanged lines hidden ---