System.Data.SQLite

Check-in [f737d62e72]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enforce the image runtime version restrictions when installing and uninstalling the VS designer components.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | VsInstallerWork
Files: files | file ages | folders
SHA1: f737d62e728f387435e28191c17a44ba27f1dda3
User & Date: mistachkin 2012-01-03 07:57:29.889
Context
2012-01-03
08:09
Remove unnecessary local variable. check-in: 7918c37463 user: mistachkin tags: VsInstallerWork
07:57
Enforce the image runtime version restrictions when installing and uninstalling the VS designer components. check-in: f737d62e72 user: mistachkin tags: VsInstallerWork
04:53
Move the InitializeVsPackage method where it should be. check-in: b34bcad2c0 user: mistachkin tags: VsInstallerWork
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to Tests/common.eagle.
298
299
300
301
302
303
304
305

306
307
308
309
310







311
312
313
314
315
316
317
298
299
300
301
302
303
304

305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324







-
+





+
+
+
+
+
+
+







      }
    }

    proc tryLoadAssembly { fileName } {
      set fileName [getBinaryFileName $fileName]

      if {[catch {set assembly \
          [object load -loadtype File $fileName]}] == 0} then {
          [object load -loadtype File -alias $fileName]}] == 0} then {
        #
        # NOTE: Now, add the necessary test constraint.
        #
        addConstraint [file rootname [file tail $fileName]]

        #
        # NOTE: Grab the image runtime version from the assembly because
        #       several tests rely on it having a certain value.
        #
        addConstraint [appendArgs [file tail $fileName] _ \
            [$assembly ImageRuntimeVersion]]

        #
        # NOTE: Return the full path of the loaded file.
        #
        return $fileName
      }

      return ""
703
704
705
706
707
708
709






710
711
712
713
714
715
716
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729







+
+
+
+
+
+







        #
        checkForSQLite $::test_channel

        #
        # NOTE: Report the resource usage prior to running any tests.
        #
        reportSQLiteResources $::test_channel

        #
        # NOTE: Show the active test constraints.
        #
        tputs $::test_channel [appendArgs "---- constraints: " \
            [formatList [lsort [getConstraints]]] \n]
      }
    }

    proc runSQLiteTestEpilogue {} {
      #
      # NOTE: Skip running our custom epilogue if the main one has been skipped.
      #
Changes to Tests/installer.eagle.
86
87
88
89
90
91
92
93
94


95
96
97
98
99
100
101
102
86
87
88
89
90
91
92


93
94

95
96
97
98
99
100
101







-
-
+
+
-








  list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
      [subst -nobackslashes [readFile $testInstallVs2008LogFile]]] : $error}]
} -cleanup {
  catch {file delete $fileName}

  unset -nocomplain code output error fileName
} -constraints \
{eagle visualStudio2008 file_Installer.exe file_Installer_Test_Vs2008.log} \
} -constraints {eagle visualStudio2008 System.Data.SQLite.dll_v2.0.50727\
file_Installer.exe file_Installer_Test_Vs2008.log} -result {0 True}}
-result {0 True}}

###############################################################################

runTest {test installer-1.2 {uninstaller tool / Visual Studio 2008} -setup {
  set fileName [file join [getTemporaryPath] \
      [file tail $testUninstallVs2008LogFile]]

118
119
120
121
122
123
124
125
126


127
128
129
130
131
132
133
134
117
118
119
120
121
122
123


124
125

126
127
128
129
130
131
132







-
-
+
+
-








  list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
      [subst -nobackslashes [readFile $testUninstallVs2008LogFile]]] : $error}]
} -cleanup {
  catch {file delete $fileName}

  unset -nocomplain code output error fileName
} -constraints \
{eagle visualStudio2008 file_Installer.exe file_Uninstaller_Test_Vs2008.log} \
} -constraints {eagle visualStudio2008 System.Data.SQLite.dll_v2.0.50727\
file_Installer.exe file_Uninstaller_Test_Vs2008.log} -result {0 True}}
-result {0 True}}

###############################################################################

runTest {test installer-1.3 {installer tool / Visual Studio 2010} -setup {
  set fileName [file join [getTemporaryPath] \
      [file tail $testInstallVs2010LogFile]]

150
151
152
153
154
155
156
157
158


159
160
161
162
163
164
165
166
148
149
150
151
152
153
154


155
156

157
158
159
160
161
162
163







-
-
+
+
-








  list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
      [subst -nobackslashes [readFile $testInstallVs2010LogFile]]] : $error}]
} -cleanup {
  catch {file delete $fileName}

  unset -nocomplain code output error fileName
} -constraints \
{eagle visualStudio2010 file_Installer.exe file_Installer_Test_Vs2010.log} \
} -constraints {eagle visualStudio2010 System.Data.SQLite.dll_v4.0.30319\
file_Installer.exe file_Installer_Test_Vs2010.log} -result {0 True}}
-result {0 True}}

###############################################################################

runTest {test installer-1.4 {uninstaller tool / Visual Studio 2010} -setup {
  set fileName [file join [getTemporaryPath] \
      [file tail $testUninstallVs2010LogFile]]

182
183
184
185
186
187
188
189
190


191
192
193
194
195
196
197
198
199
200
201
202
179
180
181
182
183
184
185


186
187

188
189
190
191
192
193
194
195
196
197
198







-
-
+
+
-












  list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
      [subst -nobackslashes [readFile $testUninstallVs2010LogFile]]] : $error}]
} -cleanup {
  catch {file delete $fileName}

  unset -nocomplain code output error fileName
} -constraints \
{eagle visualStudio2010 file_Installer.exe file_Uninstaller_Test_Vs2010.log} \
} -constraints {eagle visualStudio2010 System.Data.SQLite.dll_v4.0.30319\
file_Installer.exe file_Uninstaller_Test_Vs2010.log} -result {0 True}}
-result {0 True}}

###############################################################################

unset -nocomplain testUninstallVs2010LogFile testUninstallVs2008LogFile \
    testInstallVs2010LogFile testInstallVs2008LogFile installerExeFile \
    systemDataSQLiteDllFile

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue
Changes to tools/install/Installer.cs.
2132
2133
2134
2135
2136
2137
2138
2139

2140
2141
2142
2143
2144
2145
2146
2132
2133
2134
2135
2136
2137
2138

2139
2140
2141
2142
2143
2144
2145
2146







-
+







                    // NOTE: Show where we are running from and how we were
                    //       invoked.
                    //
                    string location = assembly.Location;

                    TraceOps.Trace(
                        TracePriority.Medium, traceCallback, String.Format(
                        "Running from: {0}", ForDisplay(location)),
                        "Running executable is: {0}", ForDisplay(location)),
                        traceCategory);

                    TraceOps.Trace(
                        TracePriority.Medium, traceCallback, String.Format(
                        "Original command line is: {0}",
                        Environment.CommandLine), traceCategory);

2193
2194
2195
2196
2197
2198
2199
2200

2201
2202
2203
2204
2205
2206
2207
2208
2209
2193
2194
2195
2196
2197
2198
2199

2200
2201

2202
2203
2204
2205
2206
2207
2208







-
+

-







                }

                return false;
            }

            ///////////////////////////////////////////////////////////////////

            public static bool CheckImageRuntimeVersion(
            public static bool CheckRuntimeVersion(
                Configuration configuration,
                VsList vsList,
                bool strict,
                ref string error
                )
            {
                try
                {
                    if (configuration == null)
2230
2231
2232
2233
2234
2235
2236





























































2237
2238
2239
2240
2241
2242
2243
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+








                    //
                    // TODO: Restrict the configuration based on which image
                    //       runtime versions (which more-or-less correspond
                    //       to .NET Framework versions) are supported by the
                    //       versions of Visual Studio that are installed.
                    //
                    if (String.IsNullOrEmpty(coreImageRuntimeVersion))
                    {
                        error = "invalid core file image runtime version";
                        return false;
                    }
                    else if (String.Equals(
                            coreImageRuntimeVersion, CLR2ImageRuntimeVersion,
                            StringComparison.InvariantCulture))
                    {
                        //
                        // NOTE: For the CLR v2.0 runtime, make sure we disable
                        //       any attempt to use it for things that require
                        //       an assembly compiled for the CLR v4.0.  It is
                        //       uncertain if this is actually a problem in
                        //       practice as the CLR v4.0 can load and use an
                        //       assembly compiled with the CLR v2.0; however,
                        //       since this project offers both configurations,
                        //       we currently disallow this mismatch.
                        //
                        configuration.noNetFx40 = true;
                        configuration.noVs2010 = true;

                        TraceOps.Trace(
                            TracePriority.Medium, traceCallback, String.Format(
                            "Assembly is compiled for the .NET Framework {0}, " +
                            "support for .NET Framework {1} is now disabled.",
                            CLR2ImageRuntimeVersion, CLR4ImageRuntimeVersion),
                            traceCategory);
                    }
                    else if (String.Equals(
                            coreImageRuntimeVersion, CLR4ImageRuntimeVersion,
                            StringComparison.InvariantCulture))
                    {
                        //
                        // NOTE: For the CLR v4.0 runtime, make sure we disable
                        //       any attempt to use it for things that require
                        //       an assembly compiled for the CLR v2.0.
                        //
                        configuration.noNetFx20 = true;
                        configuration.noVs2008 = true;

                        TraceOps.Trace(
                            TracePriority.Medium, traceCallback, String.Format(
                            "Assembly is compiled for the .NET Framework {0}, " +
                            "support for .NET Framework {1} is now disabled.",
                            ForDisplay(CLR4ImageRuntimeVersion),
                            ForDisplay(CLR2ImageRuntimeVersion)),
                            traceCategory);
                    }
                    else
                    {
                        error = String.Format(
                            "unsupported core file image runtime version " +
                            "{0}, must be {1} or {2}",
                            ForDisplay(coreImageRuntimeVersion),
                            ForDisplay(CLR2ImageRuntimeVersion),
                            ForDisplay(CLR4ImageRuntimeVersion));

                        return false;
                    }

                    return true;
                }
                catch (Exception e)
                {
                    TraceOps.Trace(
                        TracePriority.Highest, traceCallback, e,
                        traceCategory);
2675
2676
2677
2678
2679
2680
2681





2682
2683
2684
2685
2686
2687
2688
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753







+
+
+
+
+







        private const string DesignerFileName = "SQLite.Designer.dll";
        private const string ProviderName = "SQLite Data Provider";
        private const string ProjectName = "System.Data.SQLite";
        private const string LegacyProjectName = "SQLite";
        private const string InvariantName = "System.Data.SQLite";
        private const string FactoryTypeName = "System.Data.SQLite.SQLiteFactory";
        private const string Description = ".NET Framework Data Provider for SQLite";

        ///////////////////////////////////////////////////////////////////////

        private const string CLR2ImageRuntimeVersion = "v2.0.50727";
        private const string CLR4ImageRuntimeVersion = "v4.0.30319";

        ///////////////////////////////////////////////////////////////////////

        private const string NameAndValueFormat = "{0}: {1}";
        private const string LogFileSuffix = ".log";

        ///////////////////////////////////////////////////////////////////////
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645



4646
4647
4648
4649
4650
4651
4652
4653








4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4691
4692
4693
4694
4695
4696
4697



4698
4699
4700
4701
4702
4703
4704
4705
4706

4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733

































4734
4735
4736
4737
4738
4739
4740







-
-
-









-
+
+
+








+
+
+
+
+
+
+
+








-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







        ///////////////////////////////////////////////////////////////////////

        #region Application Entry Point
        private static int Main(
            string[] args
            )
        {
            Package package = null;
            FrameworkList frameworkList = null;
            VsList vsList = null;
            Configuration configuration = null;
            string error = null;

            ///////////////////////////////////////////////////////////////////

            #region Command Line Processing
            if (!Configuration.FromArgs(
                    args, true, ref configuration, ref error) ||
                !Configuration.Process(
                    args, configuration, true, ref error))
                    args, configuration, true, ref error) ||
                !Configuration.CheckRuntimeVersion(
                    configuration, true, ref error))
            {
                TraceOps.ShowMessage(
                    TracePriority.Highest, traceCallback, thisAssembly,
                    error, traceCategory, MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                return 1; /* FAILURE */
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region .NET Framework / Visual Studio Data
            Package package = null;
            FrameworkList frameworkList = null;
            VsList vsList = null;

            ///////////////////////////////////////////////////////////////////

            InitializeVsPackage(ref package);
            InitializeFrameworkList(configuration, ref frameworkList);
            InitializeVsList(configuration, ref vsList);
            #endregion

            ///////////////////////////////////////////////////////////////////

#if false
            #region Check Installed VS Versions
            if (configuration.HasFlags(InstallFlags.All, /* any */ false))
            {
                if (!ForEachVsVersionRegistry(
                        vsList, AddVsVersion, null, vsList,
                        configuration.WhatIf, configuration.Verbose,
                        ref error))
                {
                    TraceOps.ShowMessage(
                        TracePriority.Highest, traceCallback, null,
                        error, traceCategory, MessageBoxButtons.OK,
                        MessageBoxIcon.Error);

                    return 1; /* FAILURE */
                }

                if (!Configuration.CheckImageRuntimeVersion(
                        configuration, vsList, true, ref error))
                {
                    TraceOps.ShowMessage(
                        TracePriority.Highest, traceCallback, null,
                        error, traceCategory, MessageBoxButtons.OK,
                        MessageBoxIcon.Error);

                    return 1; /* FAILURE */
                }
            }
            #endregion
#endif

            ///////////////////////////////////////////////////////////////////

            AssemblyName assemblyName = AssemblyName.GetAssemblyName(
                configuration.CoreFileName); /* throw */

            ///////////////////////////////////////////////////////////////////