[msitools: 1/2] handle AllowDowngrades and AllowSameVersionUpgrades in MajorUpgrade




commit dde7dd2f93d3ef7ece7da15931ea53390db09251
Author: Nate Koflanovich <nate koflanovich dayautomation com>
Date:   Wed Sep 15 18:27:53 2021 +0000

    handle AllowDowngrades and AllowSameVersionUpgrades in MajorUpgrade

 tools/wixl/builder.vala | 17 +++++++++++++----
 tools/wixl/wix.vala     |  4 ++++
 2 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index 9e24905..a40a61a 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -1121,15 +1121,24 @@ namespace Wixl {
             var product = major.parent as WixProduct;
 
             var property = "WIX_DOWNGRADE_DETECTED";
-            db.table_upgrade.add (get_uuid (product.UpgradeCode), product.Version, "", 2, property);
-
+            if (major.AllowDowngrades == "yes") {
+                db.table_upgrade.add (get_uuid (product.UpgradeCode), product.Version, "", 
UpgradeAttribute.MIGRATE_FEATURES, property);
+            } else {
+                db.table_upgrade.add (get_uuid (product.UpgradeCode), product.Version, "", 
UpgradeAttribute.ONLY_DETECT, property);
+            }
             secureProperties += property;
 
+            if (major.AllowSameVersionUpgrades == "yes") {
+                property = "WIX_SAME_VERSION_UPGRADE_DETECTED";
+                db.table_upgrade.add (get_uuid (product.UpgradeCode), product.Version, product.Version, 
UpgradeAttribute.MIGRATE_FEATURES | UpgradeAttribute.VERSION_MIN_INCLUSIVE | 
UpgradeAttribute.VERSION_MAX_INCLUSIVE, property);
+                secureProperties += property;
+            }
+
             property = "WIX_UPGRADE_DETECTED";
-            db.table_upgrade.add (get_uuid (product.UpgradeCode), "", product.Version, 1, property);
+            db.table_upgrade.add (get_uuid (product.UpgradeCode), "", product.Version, 
UpgradeAttribute.MIGRATE_FEATURES, property);
             secureProperties += property;
 
-            if (major.DowngradeErrorMessage != null) {
+            if (major.DowngradeErrorMessage != null && major.AllowDowngrades != "yes") {
                 db.table_launch_condition.add ("NOT WIX_DOWNGRADE_DETECTED", major.DowngradeErrorMessage);
             }
 
diff --git a/tools/wixl/wix.vala b/tools/wixl/wix.vala
index 396c93a..09f47cf 100644
--- a/tools/wixl/wix.vala
+++ b/tools/wixl/wix.vala
@@ -956,6 +956,10 @@ namespace Wixl {
 
         public string DowngradeErrorMessage { get; set; }
 
+        public string AllowSameVersionUpgrades { get; set; }
+
+        public string AllowDowngrades { get; set; }
+
         public override void accept (WixNodeVisitor visitor) throws GLib.Error {
             visitor.visit_major_upgrade (this);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]