System.Data.SQLite
Check-in [f737d62e72]
Not logged in

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 | SQL archive
Timelines: family | ancestors | descendants | both | VsInstallerWork
Files: files | file ages | folders
SHA1: f737d62e728f387435e28191c17a44ba27f1dda3
User & Date: mistachkin 2012-01-03 07:57:29
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
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Tests/common.eagle.

   298    298         }
   299    299       }
   300    300   
   301    301       proc tryLoadAssembly { fileName } {
   302    302         set fileName [getBinaryFileName $fileName]
   303    303   
   304    304         if {[catch {set assembly \
   305         -          [object load -loadtype File $fileName]}] == 0} then {
          305  +          [object load -loadtype File -alias $fileName]}] == 0} then {
   306    306           #
   307    307           # NOTE: Now, add the necessary test constraint.
   308    308           #
   309    309           addConstraint [file rootname [file tail $fileName]]
   310    310   
          311  +        #
          312  +        # NOTE: Grab the image runtime version from the assembly because
          313  +        #       several tests rely on it having a certain value.
          314  +        #
          315  +        addConstraint [appendArgs [file tail $fileName] _ \
          316  +            [$assembly ImageRuntimeVersion]]
          317  +
   311    318           #
   312    319           # NOTE: Return the full path of the loaded file.
   313    320           #
   314    321           return $fileName
   315    322         }
   316    323   
   317    324         return ""
................................................................................
   703    710           #
   704    711           checkForSQLite $::test_channel
   705    712   
   706    713           #
   707    714           # NOTE: Report the resource usage prior to running any tests.
   708    715           #
   709    716           reportSQLiteResources $::test_channel
          717  +
          718  +        #
          719  +        # NOTE: Show the active test constraints.
          720  +        #
          721  +        tputs $::test_channel [appendArgs "---- constraints: " \
          722  +            [formatList [lsort [getConstraints]]] \n]
   710    723         }
   711    724       }
   712    725   
   713    726       proc runSQLiteTestEpilogue {} {
   714    727         #
   715    728         # NOTE: Skip running our custom epilogue if the main one has been skipped.
   716    729         #

Changes to Tests/installer.eagle.

    86     86   
    87     87     list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
    88     88         [subst -nobackslashes [readFile $testInstallVs2008LogFile]]] : $error}]
    89     89   } -cleanup {
    90     90     catch {file delete $fileName}
    91     91   
    92     92     unset -nocomplain code output error fileName
    93         -} -constraints \
    94         -{eagle visualStudio2008 file_Installer.exe file_Installer_Test_Vs2008.log} \
    95         --result {0 True}}
           93  +} -constraints {eagle visualStudio2008 System.Data.SQLite.dll_v2.0.50727\
           94  +file_Installer.exe file_Installer_Test_Vs2008.log} -result {0 True}}
    96     95   
    97     96   ###############################################################################
    98     97   
    99     98   runTest {test installer-1.2 {uninstaller tool / Visual Studio 2008} -setup {
   100     99     set fileName [file join [getTemporaryPath] \
   101    100         [file tail $testUninstallVs2008LogFile]]
   102    101   
................................................................................
   118    117   
   119    118     list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
   120    119         [subst -nobackslashes [readFile $testUninstallVs2008LogFile]]] : $error}]
   121    120   } -cleanup {
   122    121     catch {file delete $fileName}
   123    122   
   124    123     unset -nocomplain code output error fileName
   125         -} -constraints \
   126         -{eagle visualStudio2008 file_Installer.exe file_Uninstaller_Test_Vs2008.log} \
   127         --result {0 True}}
          124  +} -constraints {eagle visualStudio2008 System.Data.SQLite.dll_v2.0.50727\
          125  +file_Installer.exe file_Uninstaller_Test_Vs2008.log} -result {0 True}}
   128    126   
   129    127   ###############################################################################
   130    128   
   131    129   runTest {test installer-1.3 {installer tool / Visual Studio 2010} -setup {
   132    130     set fileName [file join [getTemporaryPath] \
   133    131         [file tail $testInstallVs2010LogFile]]
   134    132   
................................................................................
   150    148   
   151    149     list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
   152    150         [subst -nobackslashes [readFile $testInstallVs2010LogFile]]] : $error}]
   153    151   } -cleanup {
   154    152     catch {file delete $fileName}
   155    153   
   156    154     unset -nocomplain code output error fileName
   157         -} -constraints \
   158         -{eagle visualStudio2010 file_Installer.exe file_Installer_Test_Vs2010.log} \
   159         --result {0 True}}
          155  +} -constraints {eagle visualStudio2010 System.Data.SQLite.dll_v4.0.30319\
          156  +file_Installer.exe file_Installer_Test_Vs2010.log} -result {0 True}}
   160    157   
   161    158   ###############################################################################
   162    159   
   163    160   runTest {test installer-1.4 {uninstaller tool / Visual Studio 2010} -setup {
   164    161     set fileName [file join [getTemporaryPath] \
   165    162         [file tail $testUninstallVs2010LogFile]]
   166    163   
................................................................................
   182    179   
   183    180     list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
   184    181         [subst -nobackslashes [readFile $testUninstallVs2010LogFile]]] : $error}]
   185    182   } -cleanup {
   186    183     catch {file delete $fileName}
   187    184   
   188    185     unset -nocomplain code output error fileName
   189         -} -constraints \
   190         -{eagle visualStudio2010 file_Installer.exe file_Uninstaller_Test_Vs2010.log} \
   191         --result {0 True}}
          186  +} -constraints {eagle visualStudio2010 System.Data.SQLite.dll_v4.0.30319\
          187  +file_Installer.exe file_Uninstaller_Test_Vs2010.log} -result {0 True}}
   192    188   
   193    189   ###############################################################################
   194    190   
   195    191   unset -nocomplain testUninstallVs2010LogFile testUninstallVs2008LogFile \
   196    192       testInstallVs2010LogFile testInstallVs2008LogFile installerExeFile \
   197    193       systemDataSQLiteDllFile
   198    194   
   199    195   ###############################################################################
   200    196   
   201    197   runSQLiteTestEpilogue
   202    198   runTestEpilogue

Changes to tools/install/Installer.cs.

  2132   2132                       // NOTE: Show where we are running from and how we were
  2133   2133                       //       invoked.
  2134   2134                       //
  2135   2135                       string location = assembly.Location;
  2136   2136   
  2137   2137                       TraceOps.Trace(
  2138   2138                           TracePriority.Medium, traceCallback, String.Format(
  2139         -                        "Running from: {0}", ForDisplay(location)),
         2139  +                        "Running executable is: {0}", ForDisplay(location)),
  2140   2140                           traceCategory);
  2141   2141   
  2142   2142                       TraceOps.Trace(
  2143   2143                           TracePriority.Medium, traceCallback, String.Format(
  2144   2144                           "Original command line is: {0}",
  2145   2145                           Environment.CommandLine), traceCategory);
  2146   2146   
................................................................................
  2193   2193                   }
  2194   2194   
  2195   2195                   return false;
  2196   2196               }
  2197   2197   
  2198   2198               ///////////////////////////////////////////////////////////////////
  2199   2199   
  2200         -            public static bool CheckImageRuntimeVersion(
         2200  +            public static bool CheckRuntimeVersion(
  2201   2201                   Configuration configuration,
  2202         -                VsList vsList,
  2203   2202                   bool strict,
  2204   2203                   ref string error
  2205   2204                   )
  2206   2205               {
  2207   2206                   try
  2208   2207                   {
  2209   2208                       if (configuration == null)
................................................................................
  2230   2229   
  2231   2230                       //
  2232   2231                       // TODO: Restrict the configuration based on which image
  2233   2232                       //       runtime versions (which more-or-less correspond
  2234   2233                       //       to .NET Framework versions) are supported by the
  2235   2234                       //       versions of Visual Studio that are installed.
  2236   2235                       //
         2236  +                    if (String.IsNullOrEmpty(coreImageRuntimeVersion))
         2237  +                    {
         2238  +                        error = "invalid core file image runtime version";
         2239  +                        return false;
         2240  +                    }
         2241  +                    else if (String.Equals(
         2242  +                            coreImageRuntimeVersion, CLR2ImageRuntimeVersion,
         2243  +                            StringComparison.InvariantCulture))
         2244  +                    {
         2245  +                        //
         2246  +                        // NOTE: For the CLR v2.0 runtime, make sure we disable
         2247  +                        //       any attempt to use it for things that require
         2248  +                        //       an assembly compiled for the CLR v4.0.  It is
         2249  +                        //       uncertain if this is actually a problem in
         2250  +                        //       practice as the CLR v4.0 can load and use an
         2251  +                        //       assembly compiled with the CLR v2.0; however,
         2252  +                        //       since this project offers both configurations,
         2253  +                        //       we currently disallow this mismatch.
         2254  +                        //
         2255  +                        configuration.noNetFx40 = true;
         2256  +                        configuration.noVs2010 = true;
         2257  +
         2258  +                        TraceOps.Trace(
         2259  +                            TracePriority.Medium, traceCallback, String.Format(
         2260  +                            "Assembly is compiled for the .NET Framework {0}, " +
         2261  +                            "support for .NET Framework {1} is now disabled.",
         2262  +                            CLR2ImageRuntimeVersion, CLR4ImageRuntimeVersion),
         2263  +                            traceCategory);
         2264  +                    }
         2265  +                    else if (String.Equals(
         2266  +                            coreImageRuntimeVersion, CLR4ImageRuntimeVersion,
         2267  +                            StringComparison.InvariantCulture))
         2268  +                    {
         2269  +                        //
         2270  +                        // NOTE: For the CLR v4.0 runtime, make sure we disable
         2271  +                        //       any attempt to use it for things that require
         2272  +                        //       an assembly compiled for the CLR v2.0.
         2273  +                        //
         2274  +                        configuration.noNetFx20 = true;
         2275  +                        configuration.noVs2008 = true;
         2276  +
         2277  +                        TraceOps.Trace(
         2278  +                            TracePriority.Medium, traceCallback, String.Format(
         2279  +                            "Assembly is compiled for the .NET Framework {0}, " +
         2280  +                            "support for .NET Framework {1} is now disabled.",
         2281  +                            ForDisplay(CLR4ImageRuntimeVersion),
         2282  +                            ForDisplay(CLR2ImageRuntimeVersion)),
         2283  +                            traceCategory);
         2284  +                    }
         2285  +                    else
         2286  +                    {
         2287  +                        error = String.Format(
         2288  +                            "unsupported core file image runtime version " +
         2289  +                            "{0}, must be {1} or {2}",
         2290  +                            ForDisplay(coreImageRuntimeVersion),
         2291  +                            ForDisplay(CLR2ImageRuntimeVersion),
         2292  +                            ForDisplay(CLR4ImageRuntimeVersion));
         2293  +
         2294  +                        return false;
         2295  +                    }
         2296  +
  2237   2297                       return true;
  2238   2298                   }
  2239   2299                   catch (Exception e)
  2240   2300                   {
  2241   2301                       TraceOps.Trace(
  2242   2302                           TracePriority.Highest, traceCallback, e,
  2243   2303                           traceCategory);
................................................................................
  2675   2735           private const string DesignerFileName = "SQLite.Designer.dll";
  2676   2736           private const string ProviderName = "SQLite Data Provider";
  2677   2737           private const string ProjectName = "System.Data.SQLite";
  2678   2738           private const string LegacyProjectName = "SQLite";
  2679   2739           private const string InvariantName = "System.Data.SQLite";
  2680   2740           private const string FactoryTypeName = "System.Data.SQLite.SQLiteFactory";
  2681   2741           private const string Description = ".NET Framework Data Provider for SQLite";
         2742  +
         2743  +        ///////////////////////////////////////////////////////////////////////
         2744  +
         2745  +        private const string CLR2ImageRuntimeVersion = "v2.0.50727";
         2746  +        private const string CLR4ImageRuntimeVersion = "v4.0.30319";
  2682   2747   
  2683   2748           ///////////////////////////////////////////////////////////////////////
  2684   2749   
  2685   2750           private const string NameAndValueFormat = "{0}: {1}";
  2686   2751           private const string LogFileSuffix = ".log";
  2687   2752   
  2688   2753           ///////////////////////////////////////////////////////////////////////
................................................................................
  4626   4691           ///////////////////////////////////////////////////////////////////////
  4627   4692   
  4628   4693           #region Application Entry Point
  4629   4694           private static int Main(
  4630   4695               string[] args
  4631   4696               )
  4632   4697           {
  4633         -            Package package = null;
  4634         -            FrameworkList frameworkList = null;
  4635         -            VsList vsList = null;
  4636   4698               Configuration configuration = null;
  4637   4699               string error = null;
  4638   4700   
  4639   4701               ///////////////////////////////////////////////////////////////////
  4640   4702   
  4641   4703               #region Command Line Processing
  4642   4704               if (!Configuration.FromArgs(
  4643   4705                       args, true, ref configuration, ref error) ||
  4644   4706                   !Configuration.Process(
  4645         -                    args, configuration, true, ref error))
         4707  +                    args, configuration, true, ref error) ||
         4708  +                !Configuration.CheckRuntimeVersion(
         4709  +                    configuration, true, ref error))
  4646   4710               {
  4647   4711                   TraceOps.ShowMessage(
  4648   4712                       TracePriority.Highest, traceCallback, thisAssembly,
  4649   4713                       error, traceCategory, MessageBoxButtons.OK,
  4650   4714                       MessageBoxIcon.Error);
  4651   4715   
  4652   4716                   return 1; /* FAILURE */
  4653   4717               }
         4718  +            #endregion
         4719  +
         4720  +            ///////////////////////////////////////////////////////////////////
         4721  +
         4722  +            #region .NET Framework / Visual Studio Data
         4723  +            Package package = null;
         4724  +            FrameworkList frameworkList = null;
         4725  +            VsList vsList = null;
  4654   4726   
  4655   4727               ///////////////////////////////////////////////////////////////////
  4656   4728   
  4657   4729               InitializeVsPackage(ref package);
  4658   4730               InitializeFrameworkList(configuration, ref frameworkList);
  4659   4731               InitializeVsList(configuration, ref vsList);
  4660   4732               #endregion
  4661   4733   
  4662         -            ///////////////////////////////////////////////////////////////////
  4663         -
  4664         -#if false
  4665         -            #region Check Installed VS Versions
  4666         -            if (configuration.HasFlags(InstallFlags.All, /* any */ false))
  4667         -            {
  4668         -                if (!ForEachVsVersionRegistry(
  4669         -                        vsList, AddVsVersion, null, vsList,
  4670         -                        configuration.WhatIf, configuration.Verbose,
  4671         -                        ref error))
  4672         -                {
  4673         -                    TraceOps.ShowMessage(
  4674         -                        TracePriority.Highest, traceCallback, null,
  4675         -                        error, traceCategory, MessageBoxButtons.OK,
  4676         -                        MessageBoxIcon.Error);
  4677         -
  4678         -                    return 1; /* FAILURE */
  4679         -                }
  4680         -
  4681         -                if (!Configuration.CheckImageRuntimeVersion(
  4682         -                        configuration, vsList, true, ref error))
  4683         -                {
  4684         -                    TraceOps.ShowMessage(
  4685         -                        TracePriority.Highest, traceCallback, null,
  4686         -                        error, traceCategory, MessageBoxButtons.OK,
  4687         -                        MessageBoxIcon.Error);
  4688         -
  4689         -                    return 1; /* FAILURE */
  4690         -                }
  4691         -            }
  4692         -            #endregion
  4693         -#endif
  4694         -
  4695   4734               ///////////////////////////////////////////////////////////////////
  4696   4735   
  4697   4736               AssemblyName assemblyName = AssemblyName.GetAssemblyName(
  4698   4737                   configuration.CoreFileName); /* throw */
  4699   4738   
  4700   4739               ///////////////////////////////////////////////////////////////////
  4701   4740