scp2/source/ooo/vc_redist.scp                       |    4 +
 solenv/bin/modules/installer/windows/mergemodule.pm |   43 +++++++++++++-------
 2 files changed, 34 insertions(+), 13 deletions(-)

New commits:
commit 0872e8cc87d753e6bdda9fad510a6b71cf96565f
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Mon Aug 10 13:58:57 2020 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Aug 10 15:06:14 2020 +0200

    tdf#135579: Don't uninstall vc_redist: make it permanent
    
    Redist is a system component, that includes a varying set of DLLs,
    and those DLLs are ref-counted. Installing a newer redist - i.e.
    updating and increasing refcount of existing DLLs - may add new
    DLLs (with initial refcount 1) in addition to the updated old DLLs
    that start depending on the newly added ones; at uninstall, the
    newly added DLLs may get removed because their refcount gets 0,
    while other redist DLLs are kept at the updated levels - so their
    dependencies now are not met, and redist gets broken.
    
    Just mark the redist components permanent, which, according to [1],
    "registers an extra system client for the component in the Windows
    Installer registry settings".
    
    A downside is that uninstall doesn't restore the original system
    state ideally.
    
    [1] https://docs.microsoft.com/en-us/windows/win32/msi/component-table
    
    Change-Id: I3fe82bcb5844f826f5b1df622273b4e3a1e3c436
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100426
    Tested-by: Mike Kaganski <mike.kagan...@collabora.com>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/scp2/source/ooo/vc_redist.scp b/scp2/source/ooo/vc_redist.scp
index d32758312766..75ccf2b8d09d 100644
--- a/scp2/source/ooo/vc_redist.scp
+++ b/scp2/source/ooo/vc_redist.scp
@@ -32,22 +32,26 @@
 
 #if defined(WINDOWS_X86_MERGEMODULE)
 
+/* Attributes: msidbComponentAttributesPermanent = 0x10 */
 MergeModule WINDOWS_X86_MERGEMODULE
     Feature = gm_Root;
     Name = WINDOWS_X86_MERGEMODULE_FILE;
     RootDir = "TARGETDIR";
     ComponentCondition = "VC_REDIST=1";
+    Attributes_Add = "0x10";
 End
 
 #endif
 
 #if defined(WINDOWS_X64) && defined(WINDOWS_X64_MERGEMODULE)
 
+/* Attributes: msidbComponentAttributesPermanent = 0x10 */
 MergeModule WINDOWS_X64_MERGEMODULE
     Feature = gm_Root;
     Name = WINDOWS_X64_MERGEMODULE_FILE;
     RootDir = "TARGETDIR";
     ComponentCondition = "VC_REDIST=1";
+    Attributes_Add = "0x10";
 End
 
 #endif
diff --git a/solenv/bin/modules/installer/windows/mergemodule.pm 
b/solenv/bin/modules/installer/windows/mergemodule.pm
index 68bb203f1053..defd59588c95 100644
--- a/solenv/bin/modules/installer/windows/mergemodule.pm
+++ b/solenv/bin/modules/installer/windows/mergemodule.pm
@@ -294,6 +294,7 @@ sub merge_mergemodules_into_msi_database
                 $onemergemodulehash{'filenumber'} = $filecounter;
                 $onemergemodulehash{'componentnames'} = \%componentnames;
                 $onemergemodulehash{'componentcondition'} = 
$mergemodule->{'ComponentCondition'};
+                $onemergemodulehash{'attributes_add'} = 
$mergemodule->{'Attributes_Add'};
                 $onemergemodulehash{'cabfilename'} = $cabfilename;
                 $onemergemodulehash{'feature'} = $mergemodule->{'Feature'};
                 $onemergemodulehash{'rootdir'} = $mergemodule->{'RootDir'};
@@ -405,7 +406,7 @@ sub merge_mergemodules_into_msi_database
             my $workingtables = "File Media Directory FeatureComponents"; # 
required tables
             # Optional tables can be added now
             if ( $mergemodulehash->{'hasmsiassemblies'} ) { $workingtables = 
$workingtables . " MsiAssembly"; }
-            if ( $mergemodulehash->{'componentcondition'} ) { $workingtables = 
$workingtables . " Component"; }
+            if ( ( $mergemodulehash->{'componentcondition'} ) || ( 
$mergemodulehash->{'attributes_add'} ) ) { $workingtables = $workingtables . " 
Component"; }
 
             # Table "Feature" has to be exported, but it is not necessary to 
import it.
             if ( $^O =~ /cygwin/i ) {
@@ -462,7 +463,7 @@ sub merge_mergemodules_into_msi_database
                 change_msiassembly_table($mergemodulehash, $workdir);
             }
 
-            if ( $mergemodulehash->{'componentcondition'} )
+            if ( ( $mergemodulehash->{'componentcondition'} ) || ( 
$mergemodulehash->{'attributes_add'} ) )
             {
                 
installer::logger::include_timestamp_into_logfile("\nPerformance Info: Changing 
Component table");
                 change_component_table($mergemodulehash, $workdir);
@@ -1368,7 +1369,7 @@ sub change_featurecomponent_table
 }
 
 ###############################################################################
-# In the components table, the conditions of merge modules should be updated
+# In the components table, the conditions or attributes of merge modules 
should be updated
 ###############################################################################
 
 sub change_component_table
@@ -1388,25 +1389,41 @@ sub change_component_table
         my $component;
         foreach $component ( keys %{$mergemodulehash->{'componentnames'}} )
         {
-            if ( ${$filecontent}[$i] =~ /^\s*$component/)
+            if ( my ( $comp_, $compid_, $dir_, $attr_, $cond_, $keyp_ ) = 
${$filecontent}[$i] =~ 
/^\s*($component)\t(.*?)\t(.+?)\t(.+?)\t(.*?)\t(.*?)\s*$/)
             {
-                if ( ${$filecontent}[$i] =~ 
/^\s*(.+?)\t(.*?)\t(.+?)\t(.+?)\t(.*?)\t(.*?)\s*$/ )
+                my $newattr_ = ( $attr_ =~ /^\s*0x/ ) ? hex($attr_) : $attr_;
+                if ( $mergemodulehash->{'attributes_add'} )
                 {
-                    $infoline = "Adding condition 
($mergemodulehash->{'componentcondition'}) from scp2 to component $1\n";
+                    $infoline = "Adding attribute(s) 
($mergemodulehash->{'attributes_add'}) from scp2 to component $comp_\n";
                     push( @installer::globals::logfileinfo, $infoline);
-                    if ($5)
+                    if ( $mergemodulehash->{'attributes_add'} =~ /^\s*0x/ )
                     {
-                        $infoline = "Old condition: $5\nNew condition: ($5) 
AND ($mergemodulehash->{'componentcondition'})\n";
-                        push( @installer::globals::logfileinfo, $infoline);
-                        ${$filecontent}[$i] = "$1\t$2\t$3\t$4\t($5) AND 
($mergemodulehash->{'componentcondition'})\t$6\n";
+                        $newattr_ = $newattr_ | 
hex($mergemodulehash->{'attributes_add'});
                     }
                     else
                     {
-                        $infoline = "Old condition: <none>\nNew condition: 
$mergemodulehash->{'componentcondition'}\n";
-                        push( @installer::globals::logfileinfo, $infoline);
-                        ${$filecontent}[$i] = 
"$1\t$2\t$3\t$4\t$mergemodulehash->{'componentcondition'}\t$6\n";
+                        $newattr_ = $newattr_ | 
$mergemodulehash->{'attributes_add'};
                     }
+                    $infoline = "Old attribute(s): $attr_\nNew attribute(s): 
$newattr_\n";
+                    push( @installer::globals::logfileinfo, $infoline);
+                }
+                my $newcond_ = $cond_;
+                if ( $mergemodulehash->{'componentcondition'} )
+                {
+                    $infoline = "Adding condition 
($mergemodulehash->{'componentcondition'}) from scp2 to component $comp_\n";
+                    push( @installer::globals::logfileinfo, $infoline);
+                    if ($cond_)
+                    {
+                        $newcond_ = "($cond_) AND 
($mergemodulehash->{'componentcondition'})";
+                    }
+                    else
+                    {
+                        $newcond_ = "$mergemodulehash->{'componentcondition'}";
+                    }
+                    $infoline = "Old condition: $cond_\nNew condition: 
$newcond_\n";
+                    push( @installer::globals::logfileinfo, $infoline);
                 }
+                ${$filecontent}[$i] = 
"$comp_\t$compid_\t$dir_\t$newattr_\t$newcond_\t$keyp_\n";
             }
         }
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to