]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/build/build.py
Sync BaseTools Trunk (version r2518) to EDKII main trunk.
[mirror_edk2.git] / BaseTools / Source / Python / build / build.py
index ef52162ea15162ae2fb0ba028b32946b6a7247e8..a463c527be130c6745716d93d28ed893b6d55c49 100644 (file)
@@ -59,6 +59,9 @@ gBuildConfiguration = "Conf/target.txt"
 gBuildCacheDir = "Conf/.cache"\r
 gToolsDefinition = "Conf/tools_def.txt"\r
 \r
+TemporaryTablePattern = re.compile(r'^_\d+_\d+_[a-fA-F0-9]+$')\r
+TmpTableDict = {}\r
+\r
 ## Check environment PATH variable to make sure the specified tool is found\r
 #\r
 #   If the tool is found in the PATH, then True is returned\r
@@ -1448,6 +1451,14 @@ class Build():
                     if BuildTask.HasError():\r
                         EdkLogger.error("build", BUILD_ERROR, "Failed to build module", ExtraData=GlobalData.gBuildingModule)\r
 \r
+                #\r
+                # Save temp tables to a TmpTableDict.\r
+                #\r
+                for Key in Wa.BuildDatabase._CACHE_:\r
+                    if Wa.BuildDatabase._CACHE_[Key]._RawData and Wa.BuildDatabase._CACHE_[Key]._RawData._Table and Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Table:\r
+                        if TemporaryTablePattern.match(Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Table):\r
+                            TmpTableDict[Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Table] = Wa.BuildDatabase._CACHE_[Key]._RawData._Table.Cur\r
+                #\r
                 #\r
                 # All modules have been put in build tasks queue. Tell task scheduler\r
                 # to exit if all tasks are completed\r
@@ -1651,8 +1662,8 @@ def MyOptionParser():
         help="Build the platform specified by the DSC file name argument, overriding target.txt's ACTIVE_PLATFORM definition.")\r
     Parser.add_option("-m", "--module", action="callback", type="string", dest="ModuleFile", callback=SingleCheckCallback,\r
         help="Build the module specified by the INF file name argument.")\r
-    Parser.add_option("-b", "--buildtarget", action="append", type="choice", choices=['DEBUG','RELEASE','NOOPT'], dest="BuildTarget",\r
-        help="BuildTarget is one of list: DEBUG, RELEASE, NOOPT, which overrides target.txt's TARGET definition. To specify more TARGET, please repeat this option.")\r
+    Parser.add_option("-b", "--buildtarget", type="string", dest="BuildTarget", help="Using the TARGET to build the platform, overriding target.txt's TARGET definition.",\r
+                      action="append")\r
     Parser.add_option("-t", "--tagname", action="append", type="string", dest="ToolChain",\r
         help="Using the Tool Chain Tagname to build the platform, overriding target.txt's TOOL_CHAIN_TAG definition.")\r
     Parser.add_option("-x", "--sku-id", action="callback", type="string", dest="SkuId", callback=SingleCheckCallback,\r
@@ -1809,7 +1820,12 @@ def Main():
             EdkLogger.error("build", OPTION_VALUE_INVALID, "UNI flag must be one of -c or -s")\r
 \r
         MyBuild = Build(Target, Workspace, Option)\r
+        GlobalData.gCommandLineDefines['ARCH'] = ' '.join(MyBuild.ArchList)\r
         MyBuild.Launch()\r
+        # Drop temp tables to avoid database locked.\r
+        for TmpTableName in TmpTableDict:\r
+            SqlCommand = """drop table IF EXISTS %s""" % TmpTableName\r
+            TmpTableDict[TmpTableName].execute(SqlCommand)\r
         #MyBuild.DumpBuildData()\r
     except FatalError, X:\r
         if MyBuild != None:\r