[Pkg-cli-libs-commits] [SCM] db4o branch, master, updated. debian/7.4.121.14026+dfsg-3-22-g8e3de09

Jo Shields directhex at apebox.org
Sun Aug 14 19:04:40 UTC 2011


The following commit has been merged in the master branch:
commit 188d11cd25ebf952f83432eeb8e5b7a7249a8315
Author: Jo Shields <directhex at apebox.org>
Date:   Sun Aug 14 17:31:27 2011 +0100

    Port the Db4oTool options parsing code from the dead Mono.GetOptions library
    to the rather less dead Mono.Options library. This is largely based on a patch
    by Carlos Martín Nieto <carlos at cmartin.tk>.

diff --git a/debian/patches/port_options_code_to_Mono.Options.patch b/debian/patches/port_options_code_to_Mono.Options.patch
new file mode 100644
index 0000000..6eb4a75
--- /dev/null
+++ b/debian/patches/port_options_code_to_Mono.Options.patch
@@ -0,0 +1,326 @@
+Index: db4o/src/Db4oTool/Db4oTool/ProgramOptions.cs
+===================================================================
+--- db4o.orig/src/Db4oTool/Db4oTool/ProgramOptions.cs	2011-08-14 17:29:05.000000000 +0100
++++ db4o/src/Db4oTool/Db4oTool/ProgramOptions.cs	2011-08-14 17:30:09.000000000 +0100
+@@ -13,152 +13,98 @@
+ 
+ You should have received a copy of the GNU General Public License along
+ with this program.  If not, see http://www.gnu.org/licenses/. */
+-using System;
+-using System.Collections.Generic;
+-using Db4oTool.Core;
+-using Mono.GetOptions;
+-
+-namespace Db4oTool
+-{
+-	public delegate ITypeFilter TypeFilterFactory();
+-
+-	public class ProgramOptions : Options
+-	{
+-		private bool _prettyVerbose;
+-
+-		[Option("Preserve debugging information", "debug")]
+-		public bool Debug;
+-
+-		[Option("Implement Transparent Persistence Support", "tp")]
+-		public bool TransparentPersistence;
+-		
+-		[Option("Instrument native collections for transparent activation/persistence", "collections")]
+-		public bool Collections;
+-
+-		[Option("Case sensitive queries", "case-sensitive")]
+-		public bool CaseSensitive;
+-        
+-        [Option("Verbose operation mode", 'v', "verbose")]
+-		public bool Verbose;
+-
+-		[Option("Optimize all native queries", "nq")]
+-		public bool NQ;
+-
+-		[Option("Pretty verbose operation mode", "vv")]
+-		public bool PrettyVerbose
+-		{
+-			get { return _prettyVerbose; }
+-
+-			set { Verbose = _prettyVerbose = value; }
+-		}
+-
+-		[Option("Fake operation mode, assembly won't be written", "fake")]
+-		public bool Fake;
+-
+-        public List<string> StatisticsFileNames = new List<string>();
+-
+-        [Option("Print statistics for database file PARAM", "statistics")]
+-        public WhatToDoNext StatisticsFileName(string fileName)
+-        {
+-            StatisticsFileNames.Add(fileName);
+-            return WhatToDoNext.GoAhead;
+-        }
+-
+-	    [Option("Run consistency checks on target database.", "check")] 
+-        public bool CheckDatabase;
+-
+-        [Option("Displays file usage statistics for target database.", "fileusage")]
+-        public bool ShowFileUsageStats;
+-
+-		[Option("Installs the db4o performance counter category", "install-performance-counters")]
+-		public bool InstallPerformanceCounters;
+-
+-		public List<string> CustomInstrumentations = new List<string>();
+-
+-		[Option("Custom instrumentation type", "instrumentation", MaxOccurs = -1)]
+-		public WhatToDoNext CustomInstrumentation(string instrumentation)
+-		{
+-			CustomInstrumentations.Add(instrumentation);
+-			return WhatToDoNext.GoAhead;
+-		}
+-
+-		public readonly List<TypeFilterFactory> Filters = new List<TypeFilterFactory>();
+-
+-	    [Option("Filter types to be instrumented by attribute", "by-attribute", MaxOccurs = -1)]
+-		public WhatToDoNext ByAttribute(string attribute)
+-		{
+-			Filters.Add(delegate { return new ByAttributeFilter(attribute); });
+-			return WhatToDoNext.GoAhead;
+-		}
+-
+-		[Option("Custom type filter", "by-filter", MaxOccurs = -1)]
+-		public WhatToDoNext ByFilter(string filterType)
+-		{
+-			Filters.Add(delegate { return Factory.Instantiate<ITypeFilter>(filterType); });
+-			return WhatToDoNext.GoAhead;
+-		}
+-
+-		[Option("Filter types by name (with regular expression syntax)", "by-name", MaxOccurs = -1)]
+-		public WhatToDoNext ByName(string name)
+-		{
+-			Filters.Add(delegate { return new ByNameFilter(name); });
+-			return WhatToDoNext.GoAhead;
+-		}
+-
+-		[Option("Negates the last filter.", "not", MaxOccurs = -1)]
+-		public WhatToDoNext Not()
+-		{
+-			if (Filters.Count == 0) throw new InvalidOperationException("'not' must be specified after a filter");
+-
+-			int lastIndex = Filters.Count - 1;
+-			TypeFilterFactory lastFilter = Filters[lastIndex];
+-			Filters[lastIndex] = delegate { return new NotFilter(lastFilter()); };
+-			return WhatToDoNext.GoAhead;
+-		}
+-
+-		[Option("Same as 'tp'", "ta")]
+-		public WhatToDoNext TA()
+-		{
+-			TransparentPersistence = true;
+-			return WhatToDoNext.GoAhead;
+-		}
+-
+-		public string Target
+-		{
+-			get
+-			{
+-				if (RemainingArguments == null) return null;
+-				if (RemainingArguments.Length != 1) return null;
+-				return RemainingArguments[0];
+-			}
+-
+-			set
+-			{
+-				RemainingArguments = new string[] { value };
+-			}
+-		}
+-
+-		public bool IsValid
+-		{
+-			get
+-			{
+-			    bool databaseTarget = CheckDatabase || ShowFileUsageStats;
+-			    bool enhancementTarget = NQ || TransparentPersistence || CustomInstrumentations.Count > 0;
+-
+-                if (databaseTarget && enhancementTarget)
+-                {
+-                    return false;
+-                }
+-
+-				return StatisticsFileNames.Count > 0 || InstallPerformanceCounters ||
+-                    (Target != null
+-					   && (databaseTarget || enhancementTarget));
+-			}
+-		}
+-
+-		public ProgramOptions()
+-		{
+-			DontSplitOnCommas = true;
+-		}
+-	}
+-}
+\ No newline at end of file
++using System;
++using System.Collections.Generic;
++using Db4oTool.Core;
++using Mono.Options;
++
++namespace Db4oTool
++{
++	public delegate ITypeFilter TypeFilterFactory();
++
++	public class ProgramOptions
++	{
++		public bool Debug;
++		public bool TransparentPersistence;
++		public bool CaseSensitive;
++		public bool Verbose;
++		public bool NQ;
++		public bool PrettyVerbose;
++		public bool Fake;
++		public bool Collections;
++		public bool CheckDatabase;
++		public bool InstallPerformanceCounters;
++		public bool ShowFileUsageStats;
++		public List<string> StatisticsFileNames = new List<string>();
++		public List<string> CustomInstrumentations = new List<string>();
++		public readonly List<TypeFilterFactory> Filters = new List<TypeFilterFactory>();
++
++		private void Not()
++		{
++			if (Filters.Count == 0) throw new InvalidOperationException("'not' must be specified after a filter");
++
++			int lastIndex = Filters.Count - 1;
++			TypeFilterFactory lastFilter = Filters[lastIndex];
++			Filters[lastIndex] = delegate { return new NotFilter(lastFilter()); };
++		}
++
++		private OptionSet options;
++
++		public bool IsValid
++		{
++			get
++			{
++			    bool databaseTarget = CheckDatabase || ShowFileUsageStats;
++			    bool enhancementTarget = NQ || TransparentPersistence || CustomInstrumentations.Count > 0;
++
++                if (databaseTarget && enhancementTarget)
++                {
++                    return false;
++                }
++
++				return StatisticsFileNames.Count > 0 || InstallPerformanceCounters ||
++                    (Target != null
++					   && (databaseTarget || enhancementTarget));
++			}
++		}
++
++		public ProgramOptions()
++		{
++			options = new OptionSet()
++			.Add("debug", "Preserve debugging information", option => Debug = option != null)
++			.Add("tp", "Implement Transparent Persistence Support", option => TransparentPersistence = option != null)
++			.Add("collections", "Instrument native collections for transparent activation/persistence", option => Collections = option != null)
++			.Add("case-sensitive", "Case sensitive queries", option => CaseSensitive = option != null)
++			.Add("v|verbose", "Verbose operation mode", option => Verbose = option != null)
++			.Add("nq", "Optimize all native queries", option => NQ = option != null)
++			.Add ("vv", "Pretty verbose operation mode", option => Verbose = PrettyVerbose = option != null)
++			.Add("fake", "Fake operation mode, assembly won't be written", option => Fake = option != null)
++			.Add("statistics=", "Print statistics for database file VALUE", option => StatisticsFileNames.Add(option))
++			.Add("check", "Run consistency checks on target database", option => CheckDatabase = option != null)
++			.Add("fileusage", "Displays file usage statistics for target database", option => ShowFileUsageStats = option != null)
++			.Add("install-performance-counters", "Installs the db4o performance counter category", option => InstallPerformanceCounters = option != null)
++			.Add("instrumentation=", "Custom instrumentation type", option => CustomInstrumentations.Add(option))
++			.Add("by-attribute=", "Filter types to be instrumented by attribute", option => Filters.Add(delegate { return new ByAttributeFilter(option); }))
++			.Add("by-filter=", "Custom type filter", option => Filters.Add(delegate { return Factory.Instantiate<ITypeFilter>(option); }))
++			.Add("by-name=", "Filter types by name (with regular expression syntax)", option => Filters.Add(delegate { return new ByNameFilter(option); }))
++			.Add("not", "Negates the last filter", option => Not())
++			.Add("ta", "Same as 'tp'", option => TransparentPersistence = true)
++		;
++		}
++
++		public string Target = null;
++
++		public void ProcessArgs(string[] args)
++		{
++			List<string> extra = options.Parse(args);
++			if (extra.Count > 0)
++				Target = extra[0];
++		}
++
++		public void DoHelp()
++		{
++			options.WriteOptionDescriptions(Console.Error);
++ 		}
++
++	}
++}
+Index: db4o/src/Db4oTool/Db4oTool/Properties/AssemblyInfo.cs
+===================================================================
+--- db4o.orig/src/Db4oTool/Db4oTool/Properties/AssemblyInfo.cs	2011-08-14 17:29:05.000000000 +0100
++++ db4o/src/Db4oTool/Db4oTool/Properties/AssemblyInfo.cs	2011-08-14 17:30:09.000000000 +0100
+@@ -15,7 +15,7 @@
+ with this program.  If not, see http://www.gnu.org/licenses/. */
+ using System.Reflection;
+ using System.Runtime.InteropServices;
+-using System.Security;
++using System.Security;
+ 
+ [assembly: AssemblyTitle("Db4oTool")]
+ [assembly: AssemblyDescription("Db4oTool 8.0.184.15484 (.NET)")]
+@@ -30,16 +30,8 @@
+ 
+ [assembly: AssemblyVersion("8.0.184.15484")]
+ 
+-[assembly: Mono.Author("Jean Baptiste Evain")]
+-[assembly: Mono.Author("Rodrigo B. de Oliveira")]
+-[assembly: Mono.Author("Klaus Wuestefeld")]
+-[assembly: Mono.Author("Patrick Roemer")]
+-
+-[assembly: Mono.About("")]
+-[assembly: Mono.UsageComplement("<target>")]
+-
+-[assembly: AllowPartiallyTrustedCallers]
++[assembly: AllowPartiallyTrustedCallers]
+ 
+ #if NET_4_0
+ [assembly: SecurityRules(SecurityRuleSet.Level1)]
+-#endif
++#endif
+Index: db4o/src/Db4oTool/Db4oTool/Db4oTool-2010.csproj
+===================================================================
+--- db4o.orig/src/Db4oTool/Db4oTool/Db4oTool-2010.csproj	2011-08-14 17:30:27.000000000 +0100
++++ db4o/src/Db4oTool/Db4oTool/Db4oTool-2010.csproj	2011-08-14 17:31:03.000000000 +0100
+@@ -88,10 +88,6 @@
+       <SpecificVersion>False</SpecificVersion>
+       <HintPath>..\..\Libs\net-2.0\Mono.Cecil.Pdb.dll</HintPath>
+     </Reference>
+-    <Reference Include="Mono.GetOptions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
+-      <SpecificVersion>False</SpecificVersion>
+-      <HintPath>..\..\Libs\net-2.0\Mono.GetOptions.dll</HintPath>
+-    </Reference>
+     <Reference Include="System"/>
+     <Reference Include="System.Core">
+       <RequiredTargetFramework>3.5</RequiredTargetFramework>
+@@ -100,6 +96,7 @@
+     <Reference Include="System.Xml"/>
+   </ItemGroup>
+   <ItemGroup>
++    <Compile Include="/usr/lib/mono-source-libs/Options.cs"/>
+     <Compile Include="Core\AbstractAssemblyInstrumentation.cs"/>
+     <Compile Include="Core\ByAttributeFilter.cs"/>
+     <Compile Include="Core\ByNameFilter.cs"/>
+@@ -189,11 +186,11 @@
+     </ProjectReference>
+   </ItemGroup>
+   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets"/>
+-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+-       Other similar extension points exist, see Microsoft.Common.targets.
+-  <Target Name="BeforeBuild">
+-  </Target>
+-  <Target Name="AfterBuild">
+-  </Target>
++  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
++       Other similar extension points exist, see Microsoft.Common.targets.
++  <Target Name="BeforeBuild">
++  </Target>
++  <Target Name="AfterBuild">
++  </Target>
+   -->
+ </Project>
diff --git a/debian/patches/series b/debian/patches/series
index 9709111..ba44dd9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
+port_options_code_to_Mono.Options.patch
 dont_build_test_assemblies.patch
 use_cecil_0.9.5_api.patch

-- 
db4o



More information about the Pkg-cli-libs-commits mailing list