Uninstall previous versions as a feature

Contributes to CURA-9157
This commit is contained in:
Jelle Spijker 2023-01-12 17:14:27 +01:00
parent 37725db5e3
commit dc2a8ffc60
3 changed files with 8 additions and 86 deletions

View file

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="CustomizeCuraDlg" Width="370" Height="270" Title="!(loc.CustomizeDlg_Title)" TrackDiskSpace="yes">
<Control Id="Tree" Type="SelectionTree" X="25" Y="85" Width="175" Height="95" Property="_BrowseProperty" Sunken="yes" TabSkip="no" Text="!(loc.CustomizeDlgTree)" />
<Control Id="Browse" Type="PushButton" X="294" Y="210" Width="66" Height="17" Text="!(loc.CustomizeDlgBrowse)">
<Publish Event="SelectionBrowse" Value="BrowseDlg">1</Publish>
<Condition Action="hide">Installed</Condition>
<Condition Action="disable">Installed</Condition>
</Control>
<Control Id="Reset" Type="PushButton" X="10" Y="243" Width="81" Height="17" Text="!(loc.CustomizeDlgReset)">
<Publish Event="Reset" Value="0">1</Publish>
<Subscribe Event="SelectionNoItems" Attribute="Enabled" />
</Control>
<Control Id="DiskCost" Type="PushButton" X="91" Y="243" Width="80" Height="17" Text="!(loc.CustomizeDlgDiskCost)">
<Publish Event="SpawnDialog" Value="DiskCostDlg">1</Publish>
<Subscribe Event="SelectionNoItems" Attribute="Enabled" />
</Control>
<Control Id="Back" Type="PushButton" X="192" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="248" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
<Subscribe Event="SelectionNoItems" Attribute="Enabled" />
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.CustomizeDlgBannerBitmap)" />
<Control Id="Text" Type="Text" X="25" Y="55" Width="320" Height="20" Text="!(loc.CustomizeDlgText)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.CustomizeDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="210" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.CustomizeDlgTitle)" />
<Control Id="Box" Type="GroupBox" X="210" Y="81" Width="150" Height="88" />
<Control Id="ItemDescription" Type="Text" X="215" Y="90" Width="131" Height="30" Text="!(loc.CustomizeDlgItemDescription)">
<Subscribe Event="SelectionDescription" Attribute="Text" />
</Control>
<Control Id="ItemSize" Type="Text" X="215" Y="140" Width="131" Height="50" Text="!(loc.CustomizeDlgItemSize)">
<Subscribe Event="SelectionSize" Attribute="Text" />
</Control>
<Control Id="UninstallPreviousCheckBox" Type="CheckBox" X="25" Y="190" Width="290" Height="17" Property="PREVIOUS_VERSIONS_INSTALLED" CheckBoxValue="0" Text="Uninstall previous Cura versions." />
<Control Id="Location" Type="Text" X="90" Y="210" Width="200" Height="20" Text="!(loc.CustomizeDlgLocation)">
<Subscribe Event="SelectionPath" Attribute="Text" />
<Subscribe Event="SelectionPathOn" Attribute="Visible" />
<Condition Action="hide">Installed</Condition>
</Control>
<Control Id="LocationLabel" Type="Text" X="25" Y="210" Width="65" Height="10" Text="!(loc.CustomizeDlgLocationLabel)">
<Subscribe Event="SelectionPathOn" Attribute="Visible" />
<Condition Action="hide">Installed</Condition>
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>

View file

@ -19,10 +19,12 @@
Comments="Copyright (c) {{ year }} {{ company }}" />
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
<RemoveExistingProducts After="InstallFinalize">
<![CDATA[&UninstallOlderVersionFeature=3]]>
</RemoveExistingProducts>
</InstallExecuteSequence>
<Property Id="PREVIOUS_VERSIONS_INSTALLED" Secure="yes" Value="{{ 1 if "Enterprise" in app_name else 0 }}" />
<Property Id="PREVIOUS_VERSIONS_INSTALLED" Secure="yes" />
<Upgrade Id="{{ upgrade_code }}">
<UpgradeVersion
Minimum="4.13.2" Maximum="{{ version_major }}.{{ version_minor }}.{{ version_patch }}"
@ -36,7 +38,7 @@
<Upgrade Id="53C603BB-2B17-4206-A609-29C2E0D0B0AE">
<UpgradeVersion
Minimum="1.0.0" Maximum="4.13.2"
Property="PREVIOUS_413_INSTALLED"
Property="PREVIOUS_VERSIONS_INSTALLED"
IncludeMinimum="yes" IncludeMaximum="yes"
/>
</Upgrade>
@ -48,23 +50,7 @@
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Mondo" />
<DialogRef Id="CustomizeCuraDlg" />
<Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeCuraDlg">1</Publish>
<Publish Dialog="CustomizeCuraDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish>
<Publish Dialog="CustomizeCuraDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
<Publish Dialog="CustomizeCuraDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeCuraDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeCuraDlg" Order="3">WixUI_InstallMode = "Change"</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeCuraDlg">1</Publish>
</UI>
<UIRef Id="WixUI_ErrorProgressText" />
<UIRef Id="WixUI_Mondo" />
<WixVariable Id="WixUILicenseRtf" Value="{{ cura_license_file }}" />
<WixVariable Id="WixUIDialogBmp" Value="{{ cura_banner_side }}" />
@ -164,5 +150,6 @@
<ComponentGroupRef Id="NewFilesGroup" />
<ComponentRef Id="CMP_Shortcuts" />
</Feature>
<Feature Id="UninstallOlderVersionFeature" Title="Uninstall previous versions" Level="{{ 1 if "Enterprise" in app_name else 0 }}" Description="..."/>
</Product>
</Wix>

View file

@ -51,12 +51,6 @@ def generate_wxs(source_path: Path, dist_path: Path, filename: Path, app_name: s
with open(work_loc.joinpath("UltiMaker-Cura.wxs"), "w") as f:
f.write(wxs_content)
try:
shutil.copy(source_loc.joinpath("packaging", "msi", "CustomizeCuraDlg.wxs"),
work_loc.joinpath("CustomizeCuraDlg.wxs"))
except shutil.SameFileError:
pass
try:
shutil.copy(source_loc.joinpath("packaging", "msi", "ExcludeComponents.xslt"),
work_loc.joinpath("ExcludeComponents.xslt"))
@ -79,7 +73,6 @@ def build(dist_path: Path, filename: Path):
wxs_loc = work_loc.joinpath("UltiMaker-Cura.wxs")
heat_loc = work_loc.joinpath("HeatFile.wxs")
exclude_components_loc = work_loc.joinpath("ExcludeComponents.xslt")
manageoldcuradlg_loc = work_loc.joinpath("CustomizeCuraDlg.wxs")
build_loc = work_loc.joinpath("build_msi")
heat_command = ["heat",
@ -102,14 +95,12 @@ def build(dist_path: Path, filename: Path):
"-ext", "WixFirewallExtension",
"-out", f"{build_loc.as_posix()}\\",
f"{wxs_loc.as_posix()}",
f"{heat_loc.as_posix()}",
f"{manageoldcuradlg_loc.as_posix()}"]
f"{heat_loc.as_posix()}"]
subprocess.call(build_command)
link_command = ["light",
f"{build_loc.joinpath(wxs_loc.name).with_suffix('.wixobj')}",
f"{build_loc.joinpath(heat_loc.name).with_suffix('.wixobj')}",
f"{build_loc.joinpath(manageoldcuradlg_loc.name).with_suffix('.wixobj')}",
"-sw1076", # Don't pollute logs with warnings from auto generated content
"-dcl:high", # Use high compression ratio
"-sval", # Disable ICE validation otherwise the CI complains