Author: raja
Date: 2005-04-07 06:36:20 -0400 (Thu, 07 Apr 2005)
New Revision: 42628

Modified:
   
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/AssemblyInstaller.cs
   
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/ChangeLog
   
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs
   
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs
   
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/TransactedInstaller.cs
Log:
2005-04-07  Muthu Kannan  <[EMAIL PROTECTED]>

        * AssemblyInstaller.cs (UseNewContext): Set default path.
        (Install,Commit,Rollback,Uninstall): Log events.
        * Installer.cs (Install, Commit, Rollback,Uninstall): 
        Don't set installer context when invoking subinstallers.
        * InstallContext.cs (ParseCommandLine): Fix handling of '--'
        options.
        * TransactedInstaller.cs (Install): Fix typo.


Modified: 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/AssemblyInstaller.cs
===================================================================
--- 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/AssemblyInstaller.cs
      2005-04-07 09:47:52 UTC (rev 42627)
+++ 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/AssemblyInstaller.cs
      2005-04-07 10:36:20 UTC (rev 42628)
@@ -125,7 +125,7 @@
                        if (value)
                                Context = new InstallContext (Path + 
".InstallLog", null);
                        else
-                               Context = new InstallContext (null, 
CommandLine);
+                               Context = new InstallContext (Path + 
".InstallLog", CommandLine);
                        useNewContext = value;
                }
        }
@@ -149,6 +149,7 @@
 
                foreach (Type t in getInstallersFromAssembly (Assembly)) {
                        Installer i = (Installer) Activator.CreateInstance (t);
+                       i.Context = this.Context;
                        Installers.Add (i);
                }
        }
@@ -172,17 +173,32 @@
                return ret;
        }
 
+       private bool isInstallable ()
+       {
+               try {
+                       CheckIfInstallable (Path);
+               } catch (Exception e) {
+                       Context.LogMessage ("Assembly " + Path + " does not 
have any public installers in it.");
+                       return false;
+               }
+               return true;
+       }
+
        public override void Install (IDictionary state)
        {
                // Make sure that the assembly is installable
-               CheckIfInstallable (Path);
+               if (! isInstallable ())
+                       return;
 
                addSubInstallers ();
 
                state = new Hashtable ();
                string stateFile = System.IO.Path.ChangeExtension (this.Path, 
STATE_FILE_EXT);
                try {
-                       Console.WriteLine ("Starting installation");
+                       string logFilePath = Context.Parameters ["LogFile"];
+                       if (logFilePath != null && logFilePath != "")
+                               Console.WriteLine ("Installation log for 
assembly " + Path + " is found at " + logFilePath);
+                       Context.LogMessage ("Starting installation of assembly: 
" + Path);
                        base.Install (state);
                } finally {
                        // Serialise state
@@ -194,11 +210,15 @@
                                file.Close ();
                        }
                }
-               Console.WriteLine ("Completed installation");
+               Context.LogMessage ("Installation completed");
        }
 
        public override void Commit (IDictionary state)
        {
+               // Make sure that the assembly is installable
+               if (! isInstallable ())
+                       return;
+
                addSubInstallers ();
                string stateFile = System.IO.Path.ChangeExtension (this.Path, 
STATE_FILE_EXT);
                // Read serialised state
@@ -210,11 +230,17 @@
                        file.Close ();
                }
 
+               Context.LogMessage ("Starting commit of assembly: " + Path);
                base.Commit (state);
+               Context.LogMessage ("Commit completed");
        }
 
        public override void Rollback (IDictionary state)
        {
+               // Make sure that the assembly is installable
+               if (! isInstallable ())
+                       return;
+
                addSubInstallers ();
                string stateFile = System.IO.Path.ChangeExtension (this.Path, 
STATE_FILE_EXT);
 
@@ -227,13 +253,19 @@
                        file.Close ();
                }
 
+               Context.LogMessage ("Starting rollback of assembly: " + Path);
                base.Rollback (state);
 
                File.Delete (stateFile);
+               Context.LogMessage ("Rollback completed");
        }
 
        public override void Uninstall (IDictionary state)
        {
+               // Make sure that the assembly is installable
+               if (! isInstallable ())
+                       return;
+
                addSubInstallers ();
                string stateFile = System.IO.Path.ChangeExtension (this.Path, 
STATE_FILE_EXT);
 
@@ -247,9 +279,15 @@
                        state = null;
                }
 
+               string logFilePath = Context.Parameters ["LogFile"];
+               if (logFilePath != null && logFilePath != "")
+                       Console.WriteLine ("Installation log for assembly " + 
Path + " is found at " + logFilePath);
+
+               Context.LogMessage ("Starting uninstallation of assembly: " + 
Path);
                base.Uninstall (state);
 
                File.Delete (stateFile);
+               Context.LogMessage ("Uninstallation completed");
        }
 }
 

Modified: 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/ChangeLog
===================================================================
--- 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/ChangeLog
 2005-04-07 09:47:52 UTC (rev 42627)
+++ 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/ChangeLog
 2005-04-07 10:36:20 UTC (rev 42628)
@@ -1,3 +1,13 @@
+2005-04-07  Muthu Kannan  <[EMAIL PROTECTED]>
+
+       * AssemblyInstaller.cs (UseNewContext): Set default path.
+       (Install,Commit,Rollback,Uninstall): Log events.
+       * Installer.cs (Install, Commit, Rollback,Uninstall): 
+       Don't set installer context when invoking subinstallers.
+       * InstallContext.cs (ParseCommandLine): Fix handling of '--'
+       options.
+       * TransactedInstaller.cs (Install): Fix typo.
+
 2005-03-24  Muthu Kannan  <[EMAIL PROTECTED]>
 
        Near-complete implementation of System.Configuration.Install.

Modified: 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs
===================================================================
--- 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs
 2005-04-07 09:47:52 UTC (rev 42627)
+++ 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/InstallContext.cs
 2005-04-07 10:36:20 UTC (rev 42628)
@@ -116,10 +116,10 @@
                foreach (string a in args) {
                        // Remove leading / or - or --
                        string x = a;   // I am using x instead of a
-                       if (x.StartsWith ("/") || x.StartsWith ("-"))
+                       if (a.StartsWith ("--"))
+                               x = x.Substring (2);
+                       else if (x.StartsWith ("/") || x.StartsWith ("-"))
                                x = x.Substring (1);
-                       else if (a.StartsWith ("--"))
-                               x = x.Substring (2);
 
                        int index;
                        if ((index = x.IndexOf ("=")) == -1) {

Modified: 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs
===================================================================
--- 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs
      2005-04-07 09:47:52 UTC (rev 42627)
+++ 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/Installer.cs
      2005-04-07 10:36:20 UTC (rev 42628)
@@ -141,7 +141,6 @@
                        for (i = 0; i <= maxi; ++i) {
                                IDictionary ht = new Hashtable ();
                                try {
-                                       Installers [i].Context = this.Context;
                                        Installers [i].Install (ht);
                                } finally {
                                        state.Add (STATE_PREFIX + i.ToString(), 
ht);
@@ -181,7 +180,6 @@
 
                for (int i = 0; i <= lastInstaller; ++i) {
                        try {
-                               Installers [i].Context = this.Context;
                                Installers [i].Commit (states [i]);
                        } catch (Exception e) {
                                caught = e;
@@ -222,7 +220,6 @@
 
                for (int i = 0; i <= lastInstaller; ++i) {
                        try {
-                               Installers [i].Context = this.Context;
                                Installers [i].Rollback (states [i]);
                        } catch (Exception e) {
                                caught = e;
@@ -272,7 +269,6 @@
 
                for (int i = 0; i <= lastInstaller; ++i) {
                        try {
-                               Installers [i].Context = this.Context;
                                Installers [i].Uninstall (states [i]);
                        } catch (Exception e) {
                                caught = e;

Modified: 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/TransactedInstaller.cs
===================================================================
--- 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/TransactedInstaller.cs
    2005-04-07 09:47:52 UTC (rev 42627)
+++ 
trunk/mcs/class/System.Configuration.Install/System.Configuration.Install/TransactedInstaller.cs
    2005-04-07 10:36:20 UTC (rev 42628)
@@ -63,7 +63,7 @@
                }
 
                try {
-                       Context.LogMessage ("Installation phasing completed 
successfully -- starting commit.");
+                       Context.LogMessage ("Installation phase completed 
successfully -- starting commit.");
                        Commit (state);
                } catch (Exception e) {
                        Context.LogMessage ("Commit failed.");

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to