[msitools] wixl: Start basic MajorUpgrade element



commit 12f5b505af3a28ec59f1e253544502367564afe8
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Thu Jul 11 18:18:45 2013 +0200

    wixl: Start basic MajorUpgrade element

 tools/wixl/builder.vala |   31 +++++++++++++++++++++++++++++--
 tools/wixl/wix.vala     |   14 ++++++++++++++
 2 files changed, 43 insertions(+), 2 deletions(-)
---
diff --git a/tools/wixl/builder.vala b/tools/wixl/builder.vala
index 0ed8abc..65c97bd 100644
--- a/tools/wixl/builder.vala
+++ b/tools/wixl/builder.vala
@@ -144,8 +144,10 @@ namespace Wixl {
             add (MSIDefault.Action.PublishFeatures);
             add (MSIDefault.Action.PublishProduct);
             add (MSIDefault.Action.InstallFinalize);
-            if (db.table_upgrade.records.length () > 0)
+            if (db.table_upgrade.records.length () > 0) {
                 add (MSIDefault.Action.FindRelatedProducts);
+                add (MSIDefault.Action.MigrateFeatureStates);
+            }
             if (db.table_launch_condition.records.length () > 0)
                 add (MSIDefault.Action.LaunchConditions);
             if (db.table_registry.records.length () > 0) {
@@ -178,8 +180,10 @@ namespace Wixl {
             add (MSIDefault.Action.FileCost);
             add (MSIDefault.Action.CostFinalize);
             add (MSIDefault.Action.ExecuteAction);
-            if (db.table_upgrade.records.length () > 0)
+            if (db.table_upgrade.records.length () > 0) {
                 add (MSIDefault.Action.FindRelatedProducts);
+                add (MSIDefault.Action.MigrateFeatureStates);
+            }
             if (db.table_launch_condition.records.length () > 0)
                 add (MSIDefault.Action.LaunchConditions);
             table.add_sorted_actions ();
@@ -1054,6 +1058,29 @@ namespace Wixl {
             binary.file = find_file (binary.SourceFile, out info);
             db.table_binary.add (binary.Id, binary.file.get_path ());
         }
+
+        public override void visit_major_upgrade (WixMajorUpgrade major) throws GLib.Error {
+            var product = major.parent as WixProduct;
+
+            var property = "WIX_DOWNGRADE_DETECTED";
+            db.table_upgrade.add (get_uuid (product.UpgradeCode), product.Version, "", 2, property);
+
+            secureProperties += property;
+
+            property = "WIX_UPGRADE_DETECTED";
+            db.table_upgrade.add (get_uuid (product.UpgradeCode), "", product.Version, 1, property);
+            secureProperties += property;
+
+            if (major.DowngradeErrorMessage != null) {
+                db.table_launch_condition.add ("NOT WIX_DOWNGRADE_DETECTED", major.DowngradeErrorMessage);
+            }
+
+            var table = db.table_install_execute_sequence;
+            var node = table.get_action ("RemoveExistingProducts");
+            warn_if_fail (node.action == null);
+            node.add_dep (table.get_action ("InstallValidate"));
+        }
+
     }
 
 } // Wixl
diff --git a/tools/wixl/wix.vala b/tools/wixl/wix.vala
index 1419090..93ff935 100644
--- a/tools/wixl/wix.vala
+++ b/tools/wixl/wix.vala
@@ -64,6 +64,7 @@ namespace Wixl {
         public abstract void visit_registry_search (WixRegistrySearch search) throws GLib.Error;
         public abstract void visit_custom_action (WixCustomAction action) throws GLib.Error;
         public abstract void visit_binary (WixBinary binary) throws GLib.Error;
+        public abstract void visit_major_upgrade (WixMajorUpgrade major) throws GLib.Error;
     }
 
     public abstract class WixNode: Object {
@@ -937,6 +938,18 @@ namespace Wixl {
         }
     }
 
+    public class WixMajorUpgrade: WixElement {
+        static construct {
+            name = "MajorUpgrade";
+        }
+
+        public string DowngradeErrorMessage { get; set; }
+
+        public override void accept (WixNodeVisitor visitor) throws GLib.Error {
+            visitor.visit_major_upgrade (this);
+        }
+    }
+
     public class WixProduct: WixElement {
         static construct {
             name = "Product";
@@ -958,6 +971,7 @@ namespace Wixl {
                 typeof (WixUpgrade),
                 typeof (WixCustomAction),
                 typeof (WixBinary),
+                typeof (WixMajorUpgrade),
             });
         }
 


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