Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-addins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@novell.com>2007-07-03 18:20:51 +0400
committerLluis Sanchez <lluis@novell.com>2007-07-03 18:20:51 +0400
commit88aaf55686b9b781fca81fd5662587b30211bfcd (patch)
treee147662c0f170b35a5e9948b01b000aa8ba27276 /Mono.Addins.Setup
parente112512d5291d35a21efe439a79bbdf59e9efc05 (diff)
* AssemblyInfo.cs, Mono.Addins.Setup.mdp, Makefile.am: Sign the
assembly. * Mono.Addins.Setup/ConsoleAddinInstaller.cs: New IAddinInstaller implementation. svn path=/trunk/mono-addins/; revision=81266
Diffstat (limited to 'Mono.Addins.Setup')
-rw-r--r--Mono.Addins.Setup/AssemblyInfo.cs20
-rw-r--r--Mono.Addins.Setup/ChangeLog7
-rw-r--r--Mono.Addins.Setup/Makefile.am16
-rw-r--r--Mono.Addins.Setup/Mono.Addins.Setup.mdp6
-rw-r--r--Mono.Addins.Setup/Mono.Addins.Setup/ConsoleAddinInstaller.cs123
5 files changed, 168 insertions, 4 deletions
diff --git a/Mono.Addins.Setup/AssemblyInfo.cs b/Mono.Addins.Setup/AssemblyInfo.cs
new file mode 100644
index 0000000..ccd9ef9
--- /dev/null
+++ b/Mono.Addins.Setup/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following
+// attributes.
+//
+// change them to the information which is associated with the assembly
+// you compile.
+
+[assembly: AssemblyTitle("Mono.Addins.Setup")]
+[assembly: AssemblyCopyright("Copyright (C) 2007 Novell, Inc (http://www.novell.com)")]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all values by your own or you can build default build and revision
+// numbers with the '*' character (the default):
+
+[assembly: AssemblyVersion("0.2.0.0")]
diff --git a/Mono.Addins.Setup/ChangeLog b/Mono.Addins.Setup/ChangeLog
index 18aee37..2aab5ba 100644
--- a/Mono.Addins.Setup/ChangeLog
+++ b/Mono.Addins.Setup/ChangeLog
@@ -1,3 +1,10 @@
+2007-07-03 Lluis Sanchez Gual <lluis@novell.com>
+
+ * AssemblyInfo.cs, Mono.Addins.Setup.mdp, Makefile.am: Sign the
+ assembly.
+ * Mono.Addins.Setup/ConsoleAddinInstaller.cs: New IAddinInstaller
+ implementation.
+
2007-07-02 Lluis Sanchez Gual <lluis@novell.com>
* Mono.Addins.Setup.ProgressMonitoring/ConsoleProgressMonitor.cs,
diff --git a/Mono.Addins.Setup/Makefile.am b/Mono.Addins.Setup/Makefile.am
index 6eada86..ec29f3a 100644
--- a/Mono.Addins.Setup/Makefile.am
+++ b/Mono.Addins.Setup/Makefile.am
@@ -1,6 +1,9 @@
+
+KEY_FILE=$(top_srcdir)/mono-addins.snk
ASSEMBLY_COMPILER_COMMAND = mcs
-ASSEMBLY_COMPILER_FLAGS = -langversion:ISO-1 -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG
+ASSEMBLY_COMPILER_FLAGS = -keyfile:$(KEY_FILE) -langversion:ISO-1 -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG
ASSEMBLY = ../bin/Mono.Addins.Setup.dll
+ASSEMBLY_NAME=Mono.Addins.Setup
COMPILE_TARGET = library
PC_FILES_IN = mono-addins-setup.pc.in
PROJECT_REFERENCES = ../bin/Mono.Addins.dll
@@ -10,6 +13,7 @@ BUILD_DIR = ../bin
all: $(ASSEMBLY)
FILES = \
+ AssemblyInfo.cs \
Mono.Addins.Setup.ProgressMonitoring/ConsoleProgressMonitor.cs \
Mono.Addins.Setup.ProgressMonitoring/LogTextWriter.cs \
Mono.Addins.Setup.ProgressMonitoring/NullProgressMonitor.cs \
@@ -23,6 +27,7 @@ FILES = \
Mono.Addins.Setup/AddinSystemConfiguration.cs \
Mono.Addins.Setup/AddinSystemConfigurationReaderWriter.cs \
Mono.Addins.Setup/AddinSystemConfigurationSerializer.cs \
+ Mono.Addins.Setup/ConsoleAddinInstaller.cs \
Mono.Addins.Setup/InstallException.cs \
Mono.Addins.Setup/IProgressMonitor.cs \
Mono.Addins.Setup/Package.cs \
@@ -55,7 +60,14 @@ DLL_REFERENCES =
$(ASSEMBLY) $(ASSEMBLY).mdb: $(build_sources) $(build_resources) $(build_datafiles)
mkdir -p $(dir $(ASSEMBLY))
-
$(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref)
+install-data-local:
+ echo "$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS)"; \
+ $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1;
+
+uninstall-local:
+ echo "$(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \
+ $(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS) || exit 1;
+
include $(top_srcdir)/Makefile.include
diff --git a/Mono.Addins.Setup/Mono.Addins.Setup.mdp b/Mono.Addins.Setup/Mono.Addins.Setup.mdp
index c729803..9ca751c 100644
--- a/Mono.Addins.Setup/Mono.Addins.Setup.mdp
+++ b/Mono.Addins.Setup/Mono.Addins.Setup.mdp
@@ -1,13 +1,13 @@
<Project name="Mono.Addins.Setup" fileversion="2.0" language="C#" clr-version="Net_1_1" ctype="DotNetProject">
<Configurations active="Debug">
<Configuration name="Debug" ctype="DotNetProjectConfiguration">
- <Output directory="../bin" assembly="Mono.Addins.Setup" />
+ <Output directory="../bin" signAssembly="True" assemblyKeyFile="../mono-addins.snk" assembly="Mono.Addins.Setup" />
<Build debugmode="True" target="Library" />
<Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_1_1" />
<CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" mainclass="" generatexmldocumentation="False" win32Icon="./" ctype="CSharpCompilerParameters" />
</Configuration>
<Configuration name="Release" ctype="DotNetProjectConfiguration">
- <Output directory="./bin/Release" assembly="Mono.Addins.Setup" />
+ <Output directory="./bin/Release" signAssembly="False" assembly="Mono.Addins.Setup" />
<Build debugmode="False" target="Library" />
<Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_1_1" />
<CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
@@ -42,6 +42,8 @@
<File name="./Mono.Addins.Setup/RepositoryRegistry.cs" subtype="Code" buildaction="Compile" />
<File name="./Mono.Addins.Setup/SetupService.cs" subtype="Code" buildaction="Compile" />
<File name="./ChangeLog" subtype="Code" buildaction="Nothing" />
+ <File name="./AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
+ <File name="./Mono.Addins.Setup/ConsoleAddinInstaller.cs" subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Gac" localcopy="True" refto="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
diff --git a/Mono.Addins.Setup/Mono.Addins.Setup/ConsoleAddinInstaller.cs b/Mono.Addins.Setup/Mono.Addins.Setup/ConsoleAddinInstaller.cs
new file mode 100644
index 0000000..c03ee57
--- /dev/null
+++ b/Mono.Addins.Setup/Mono.Addins.Setup/ConsoleAddinInstaller.cs
@@ -0,0 +1,123 @@
+//
+// ConsoleAddinInstaller.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections;
+
+namespace Mono.Addins.Setup
+{
+ public class ConsoleAddinInstaller: IAddinInstaller
+ {
+ bool prompt;
+ bool repoUpdated;
+ int logLevel = 1;
+
+ public ConsoleAddinInstaller ()
+ {
+ }
+
+ public bool UserPrompt {
+ get { return prompt; }
+ set {
+ prompt = value;
+ if (prompt && logLevel == 0)
+ logLevel = 1;
+ }
+ }
+
+ public int LogLevel {
+ get { return logLevel; }
+ set { logLevel = value; }
+ }
+
+ void IAddinInstaller.InstallAddins (AddinRegistry reg, string message, string[] addinIds)
+ {
+ if (logLevel > 0) {
+ if (message != null && message.Length > 0) {
+ Console.WriteLine (message);
+ } else {
+ Console.WriteLine ("Additional extensions are required to perform this operation.");
+ }
+ }
+ ArrayList entries = new ArrayList ();
+ SetupService setup = new SetupService (reg);
+ string idNotFound;
+ do {
+ idNotFound = null;
+ foreach (string id in addinIds) {
+ string name = Addin.GetIdName (id);
+ string version = Addin.GetIdVersion (id);
+ AddinRepositoryEntry[] ares = setup.Repositories.GetAvailableAddin (name, version);
+ if (ares.Length == 0) {
+ idNotFound = id;
+ entries.Clear ();
+ break;
+ } else
+ entries.Add (ares[0]);
+ }
+ if (idNotFound != null) {
+ if (repoUpdated)
+ throw new InstallException ("Add-in '" + idNotFound + "' not found in the registered add-in repositories");
+ if (prompt) {
+ Console.WriteLine ("The add-in '" + idNotFound + "' could not be found in the registered repositories.");
+ Console.WriteLine ("The repository indices may be outdated.");
+ if (!Confirm ("Do you wan't to update them now?"))
+ throw new InstallException ("Add-in '" + idNotFound + "' not found in the registered add-in repositories");
+ }
+ setup.Repositories.UpdateAllRepositories (new ConsoleProgressStatus (logLevel));
+ repoUpdated = true;
+ }
+ }
+ while (idNotFound != null);
+
+ if (logLevel > 0) {
+ Console.WriteLine ("The following add-ins will be installed:");
+ foreach (AddinRepositoryEntry addin in entries)
+ Console.WriteLine (" - " + addin.Addin.Name + " v" + addin.Addin.Version);
+
+ if (prompt) {
+ if (!Confirm ("Do you want to continue with the installation?"))
+ throw new InstallException ("Installation cancelled");
+ }
+ }
+ setup.Install (new ConsoleProgressStatus (logLevel), (AddinRepositoryEntry[]) entries.ToArray (typeof(AddinRepositoryEntry)));
+ }
+
+ bool Confirm (string msg)
+ {
+ string res;
+ do {
+ Console.Write (msg + " (Y/n): ");
+ res = Console.ReadLine ();
+ if (res.Length > 0 && res.ToLower()[0] == 'n')
+ return false;
+ } while (res.Length > 0 && res.ToLower()[0] != 'y');
+ return true;
+ }
+ }
+}