コード例 #1
0
ファイル: TableInf.py プロジェクト: binsys/VisualUefi
 def Query(self, Model):
     SqlCommand = """select ID, Value1, Value2, Value3, Arch, BelongsToItem, BelongsToFile, StartLine from %s
                     where Model = %s
                     and Enabled > -1""" % (self.Table, Model)
     EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
     self.Cur.execute(SqlCommand)
     return self.Cur.fetchall()
コード例 #2
0
ファイル: VpdInfoFile.py プロジェクト: lersek/edk2
def CallExtenalBPDGTool(ToolPath, VpdFileName):
    assert ToolPath is not None, "Invalid parameter ToolPath"
    assert VpdFileName is not None and os.path.exists(VpdFileName), "Invalid parameter VpdFileName"

    OutputDir = os.path.dirname(VpdFileName)
    FileName = os.path.basename(VpdFileName)
    BaseName, ext = os.path.splitext(FileName)
    OutputMapFileName = os.path.join(OutputDir, "%s.map" % BaseName)
    OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName)

    try:
        PopenObject = subprocess.Popen(' '.join([ToolPath,
                                        '-o', OutputBinFileName,
                                        '-m', OutputMapFileName,
                                        '-q',
                                        '-f',
                                        VpdFileName]),
                                        stdout=subprocess.PIPE,
                                        stderr= subprocess.PIPE,
                                        shell=True)
    except Exception as X:
        EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData=str(X))
    (out, error) = PopenObject.communicate()
    print(out.decode(encoding='utf-8', errors='ignore'))
    while PopenObject.returncode is None :
        PopenObject.wait()

    if PopenObject.returncode != 0:
        EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", str(error))
        EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail to execute BPDG tool with exit code: %d, the error message is: \n %s" % \
                            (PopenObject.returncode, str(error)))

    return PopenObject.returncode
コード例 #3
0
ファイル: MetaDataTable.py プロジェクト: etiago/vbox
 def Insert(self, *Args):
     self.ID = self.ID + self._ID_STEP_
     if self.ID >= (self.IdBase + self._ID_MAX_):
         self.ID = self.IdBase + self._ID_STEP_
     Values = ", ".join([str(Arg) for Arg in Args])
     SqlCommand = "insert into %s values(%s, %s)" % (self.Table, self.ID, Values)
     EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand)
     self.Cur.execute(SqlCommand)
     return self.ID
コード例 #4
0
    def ReToken(self):
        #
        # Search each string to find if it is defined for each language
        # Use secondary language value to replace if missing in any one language
        #
        for IndexI in range(0, len(self.LanguageDef)):
            LangKey = self.LanguageDef[IndexI][0]
            for Item in self.OrderedStringList[LangKey]:
                Name = Item.StringName
                Value = Item.StringValue[0:-1]
                Referenced = Item.Referenced
                Index = self.OrderedStringList[LangKey].index(Item)
                for IndexJ in range(0, len(self.LanguageDef)):
                    LangFind = self.LanguageDef[IndexJ][0]
                    if self.FindStringValue(Name, LangFind) == None:
                        EdkLogger.debug(EdkLogger.DEBUG_5, Name)
                        Token = len(self.OrderedStringList[LangFind])
                        self.AddStringToList(Name, LangFind, Value, Token, Referenced, LangKey, Index)
        #
        # Retoken
        #
        # First re-token the first language
        LangName = self.LanguageDef[0][0]
        ReferencedStringList = []
        NotReferencedStringList = []
        Token = 0

        #
        # Order UNI token by their String Name
        #
        StringNameList = []
        for Item in self.OrderedStringList[LangName]:
            StringNameList.append (Item.StringName)
        StringNameList.sort()

        for Name in StringNameList:
            Item = self.FindStringValue (Name, LangName)
            if Item.Referenced == True:
                Item.Token = Token
                ReferencedStringList.append(Item)
                Token = Token + 1
            else:
                NotReferencedStringList.append(Item)
        self.OrderedStringList[LangName] = ReferencedStringList
        for Index in range(len(NotReferencedStringList)):
            NotReferencedStringList[Index].Token = Token + Index
            self.OrderedStringList[LangName].append(NotReferencedStringList[Index])

        #
        # Adjust the orders of other languages
        #
        for IndexOfLanguage in range(1, len(self.LanguageDef)):
            for OrderedString in self.OrderedStringList[LangName]:
                for UnOrderedString in self.OrderedStringList[self.LanguageDef[IndexOfLanguage][0]]:
                    if OrderedString.StringName == UnOrderedString.StringName:
                        UnOrderedString.Token = OrderedString.Token
                        break
コード例 #5
0
ファイル: MetaDataTable.py プロジェクト: etiago/vbox
    def Create(self, NewTable=True):
        if NewTable:
            self.Drop()

        if self.Temporary:
            SqlCommand = """create temp table IF NOT EXISTS %s (%s)""" % (self.Table, self._COLUMN_)
        else:
            SqlCommand = """create table IF NOT EXISTS %s (%s)""" % (self.Table, self._COLUMN_)
        EdkLogger.debug(EdkLogger.DEBUG_8, SqlCommand)
        self.Cur.execute(SqlCommand)
        self.ID = self.GetId()
コード例 #6
0
ファイル: IdfClassObject.py プロジェクト: kraxel/edk2
def SearchImageID(ImageFileObject, FileList):
    if FileList == []:
        return ImageFileObject

    for File in FileList:
        if os.path.isfile(File):
            Lines = open(File, 'r')
            for Line in Lines:
                ImageIdList = IMAGE_TOKEN.findall(Line)
                for ID in ImageIdList:
                    EdkLogger.debug(EdkLogger.DEBUG_5, "Found ImageID identifier: " + ID)
                    ImageFileObject.SetImageIDReferenced(ID)
コード例 #7
0
ファイル: MetaFileTable.py プロジェクト: AshleyDeSimone/edk2
    def IsIntegrity(self):
        try:
            Result = self.Cur.execute("select ID from %s where ID<0" % (self.Table)).fetchall()
            if not Result:
                return False

            TimeStamp = self.MetaFile.TimeStamp
            if TimeStamp != self._FileIndexTable.GetFileTimeStamp(self.IdBase):
                # update the timestamp in database
                self._FileIndexTable.SetFileTimeStamp(self.IdBase, TimeStamp)
                return False
        except Exception, Exc:
            EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc))
            return False
コード例 #8
0
ファイル: StrGather.py プロジェクト: b-man/edk2
def SearchString(UniObjectClass, FileList, IsCompatibleMode):
    if FileList == []:
        return UniObjectClass

    for File in FileList:
        if os.path.isfile(File):
            Lines = open(File, 'r')
            for Line in Lines:
                for StrName in STRING_TOKEN.findall(Line):
                    EdkLogger.debug(EdkLogger.DEBUG_5, "Found string identifier: " + StrName)
                    UniObjectClass.SetStringReferenced(StrName)

    UniObjectClass.ReToken()

    return UniObjectClass
コード例 #9
0
ファイル: GenDepex.py プロジェクト: MattDevo/edk2
    def __init__(self, Expression, ModuleType, Optimize=False):
        self.ModuleType = ModuleType
        self.Phase = gType2Phase[ModuleType]
        if isinstance(Expression, type([])):
            self.ExpressionString = " ".join(Expression)
            self.TokenList = Expression
        else:
            self.ExpressionString = Expression
            self.GetExpressionTokenList()

        self.PostfixNotation = []
        self.OpcodeList = []

        self.GetPostfixNotation()
        self.ValidateOpcode()

        EdkLogger.debug(EdkLogger.DEBUG_8, repr(self))
        if Optimize:
            self.Optimize()
            EdkLogger.debug(EdkLogger.DEBUG_8, "\n    Optimized: " + repr(self))
コード例 #10
0
ファイル: MetaFileTable.py プロジェクト: lersek/edk2
    def IsIntegrity(self):
        try:
            TimeStamp = self.MetaFile.TimeStamp
            if not self.CurrentContent:
                Result = False
            else:
                Result = self.CurrentContent[-1][0] < 0
            if not Result:
                # update the timestamp in database
                self.DB.SetFileTimeStamp(self.FileId, TimeStamp)
                return False

            if TimeStamp != self.DB.GetFileTimeStamp(self.FileId):
                # update the timestamp in database
                self.DB.SetFileTimeStamp(self.FileId, TimeStamp)
                return False
        except Exception as Exc:
            EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc))
            return False
        return True
コード例 #11
0
ファイル: VpdInfoFile.py プロジェクト: 0xDEC0DE8/STM
    
    OutputDir = os.path.dirname(VpdFileName)
    FileName = os.path.basename(VpdFileName)
    BaseName, ext = os.path.splitext(FileName)
    OutputMapFileName = os.path.join(OutputDir, "%s.map" % BaseName)
    OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName)
          
    try:
        PopenObject = subprocess.Popen([ToolPath,
                                        '-o', OutputBinFileName, 
                                        '-m', OutputMapFileName,
                                        '-q',
                                        '-f',
                                        VpdFileName],
                                        stdout=subprocess.PIPE, 
                                        stderr= subprocess.PIPE)
    except Exception, X:
        EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData="%s" % (str(X)))
    (out, error) = PopenObject.communicate()
    print out
    while PopenObject.returncode == None :
        PopenObject.wait()
    
    if PopenObject.returncode != 0:
        if PopenObject.returncode != 0:
            EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", str(error))
            EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail to execute BPDG tool with exit code: %d, the error message is: \n %s" % \
                            (PopenObject.returncode, str(error)))
        
    return PopenObject.returncode
コード例 #12
0
 def DebugLogger (Level, msg):
     EdkLogger.debug(Level, msg)
コード例 #13
0
ファイル: Database.py プロジェクト: b-man/edk2
    def UpdateIdentifierBelongsToFunction_disabled(self):
        EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers started ...")

        SqlCommand = """select ID, BelongsToFile, StartLine, EndLine, Model from Identifier"""
        EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
        self.Cur.execute(SqlCommand)
        Records = self.Cur.fetchall()
        for Record in Records:
            IdentifierID = Record[0]
            BelongsToFile = Record[1]
            StartLine = Record[2]
            EndLine = Record[3]
            Model = Record[4]

            #
            # Check whether an identifier belongs to a function
            #
            EdkLogger.debug(4, "For common identifiers ... ")
            SqlCommand = """select ID from Function
                        where StartLine < %s and EndLine > %s
                        and BelongsToFile = %s""" % (StartLine, EndLine, BelongsToFile)
            EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
            self.Cur.execute(SqlCommand)
            IDs = self.Cur.fetchall()
            for ID in IDs:
                SqlCommand = """Update Identifier set BelongsToFunction = %s where ID = %s""" % (ID[0], IdentifierID)
                EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
                self.Cur.execute(SqlCommand)

            #
            # Check whether the identifier is a function header
            #
            EdkLogger.debug(4, "For function headers ... ")
            if Model == DataClass.MODEL_IDENTIFIER_COMMENT:
                SqlCommand = """select ID from Function
                        where StartLine = %s + 1
                        and BelongsToFile = %s""" % (EndLine, BelongsToFile)
                EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
                self.Cur.execute(SqlCommand)
                IDs = self.Cur.fetchall()
                for ID in IDs:
                    SqlCommand = """Update Identifier set BelongsToFunction = %s, Model = %s where ID = %s""" % (ID[0], DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER, IdentifierID)
                    EdkLogger.debug(4, "SqlCommand: %s" %SqlCommand)
                    self.Cur.execute(SqlCommand)

        EdkLogger.verbose("Update 'BelongsToFunction' for Identifiers ... DONE")
コード例 #14
0
    def run(self):
        try:
            taskname = "Init"
            with self.file_lock:
                try:
                    self.data_pipe = MemoryDataPipe()
                    self.data_pipe.load(self.data_pipe_file_path)
                except:
                    self.feedback_q.put(taskname + ":" +
                                        "load data pipe %s failed." %
                                        self.data_pipe_file_path)
            EdkLogger.LogClientInitialize(self.log_q)
            loglevel = self.data_pipe.Get("LogLevel")
            if not loglevel:
                loglevel = EdkLogger.INFO
            EdkLogger.SetLevel(loglevel)
            target = self.data_pipe.Get("P_Info").get("Target")
            toolchain = self.data_pipe.Get("P_Info").get("ToolChain")
            archlist = self.data_pipe.Get("P_Info").get("ArchList")

            active_p = self.data_pipe.Get("P_Info").get("ActivePlatform")
            workspacedir = self.data_pipe.Get("P_Info").get("WorkspaceDir")
            PackagesPath = os.getenv("PACKAGES_PATH")
            mws.setWs(workspacedir, PackagesPath)
            self.Wa = WorkSpaceInfo(workspacedir, active_p, target, toolchain,
                                    archlist)
            self.Wa._SrcTimeStamp = self.data_pipe.Get("Workspace_timestamp")
            GlobalData.gGlobalDefines = self.data_pipe.Get("G_defines")
            GlobalData.gCommandLineDefines = self.data_pipe.Get("CL_defines")
            GlobalData.gCommandMaxLength = self.data_pipe.Get(
                'gCommandMaxLength')
            os.environ._data = self.data_pipe.Get("Env_Var")
            GlobalData.gWorkspace = workspacedir
            GlobalData.gDisableIncludePathCheck = False
            GlobalData.gFdfParser = self.data_pipe.Get("FdfParser")
            GlobalData.gDatabasePath = self.data_pipe.Get("DatabasePath")

            GlobalData.gUseHashCache = self.data_pipe.Get("UseHashCache")
            GlobalData.gBinCacheSource = self.data_pipe.Get("BinCacheSource")
            GlobalData.gBinCacheDest = self.data_pipe.Get("BinCacheDest")
            GlobalData.gPlatformHashFile = self.data_pipe.Get(
                "PlatformHashFile")
            GlobalData.gModulePreMakeCacheStatus = dict()
            GlobalData.gModuleMakeCacheStatus = dict()
            GlobalData.gHashChainStatus = dict()
            GlobalData.gCMakeHashFile = dict()
            GlobalData.gModuleHashFile = dict()
            GlobalData.gFileHashDict = dict()
            GlobalData.gEnableGenfdsMultiThread = self.data_pipe.Get(
                "EnableGenfdsMultiThread")
            GlobalData.gPlatformFinalPcds = self.data_pipe.Get(
                "gPlatformFinalPcds")
            GlobalData.file_lock = self.file_lock
            CommandTarget = self.data_pipe.Get("CommandTarget")
            pcd_from_build_option = []
            for pcd_tuple in self.data_pipe.Get("BuildOptPcd"):
                pcd_id = ".".join((pcd_tuple[0], pcd_tuple[1]))
                if pcd_tuple[2].strip():
                    pcd_id = ".".join((pcd_id, pcd_tuple[2]))
                pcd_from_build_option.append("=".join((pcd_id, pcd_tuple[3])))
            GlobalData.BuildOptionPcd = pcd_from_build_option
            module_count = 0
            FfsCmd = self.data_pipe.Get("FfsCommand")
            if FfsCmd is None:
                FfsCmd = {}
            GlobalData.FfsCmd = FfsCmd
            PlatformMetaFile = self.GetPlatformMetaFile(
                self.data_pipe.Get("P_Info").get("ActivePlatform"),
                self.data_pipe.Get("P_Info").get("WorkspaceDir"))
            while True:
                if self.error_event.is_set():
                    break
                module_count += 1
                try:
                    module_file, module_root, module_path, module_basename, module_originalpath, module_arch, IsLib = self.module_queue.get_nowait(
                    )
                except Empty:
                    EdkLogger.debug(
                        EdkLogger.DEBUG_9,
                        "Worker %s: %s" % (os.getpid(), "Fake Empty."))
                    time.sleep(0.01)
                    continue
                if module_file is None:
                    EdkLogger.debug(
                        EdkLogger.DEBUG_9, "Worker %s: %s" %
                        (os.getpid(),
                         "Worker get the last item in the queue."))
                    self.feedback_q.put("QueueEmpty")
                    time.sleep(0.01)
                    continue

                modulefullpath = os.path.join(module_root, module_file)
                taskname = " : ".join((modulefullpath, module_arch))
                module_metafile = PathClass(module_file, module_root)
                if module_path:
                    module_metafile.Path = module_path
                if module_basename:
                    module_metafile.BaseName = module_basename
                if module_originalpath:
                    module_metafile.OriginalPath = PathClass(
                        module_originalpath, module_root)
                arch = module_arch
                target = self.data_pipe.Get("P_Info").get("Target")
                toolchain = self.data_pipe.Get("P_Info").get("ToolChain")
                Ma = ModuleAutoGen(self.Wa, module_metafile, target, toolchain,
                                   arch, PlatformMetaFile, self.data_pipe)
                Ma.IsLibrary = IsLib
                # SourceFileList calling sequence impact the makefile string sequence.
                # Create cached SourceFileList here to unify its calling sequence for both
                # CanSkipbyPreMakeCache and CreateCodeFile/CreateMakeFile.
                RetVal = Ma.SourceFileList
                if GlobalData.gUseHashCache and not GlobalData.gBinCacheDest and CommandTarget in [
                        None, "", "all"
                ]:
                    try:
                        CacheResult = Ma.CanSkipbyPreMakeCache()
                    except:
                        CacheResult = False
                        self.feedback_q.put(taskname)

                    if CacheResult:
                        self.cache_q.put(
                            (Ma.MetaFile.Path, Ma.Arch, "PreMakeCache", True))
                        continue
                    else:
                        self.cache_q.put(
                            (Ma.MetaFile.Path, Ma.Arch, "PreMakeCache", False))

                Ma.CreateCodeFile(False)
                Ma.CreateMakeFile(False,
                                  GenFfsList=FfsCmd.get(
                                      (Ma.MetaFile.Path, Ma.Arch), []))
                Ma.CreateAsBuiltInf()
                if GlobalData.gBinCacheSource and CommandTarget in [
                        None, "", "all"
                ]:
                    try:
                        CacheResult = Ma.CanSkipbyMakeCache()
                    except:
                        CacheResult = False
                        self.feedback_q.put(taskname)

                    if CacheResult:
                        self.cache_q.put(
                            (Ma.MetaFile.Path, Ma.Arch, "MakeCache", True))
                        continue
                    else:
                        self.cache_q.put(
                            (Ma.MetaFile.Path, Ma.Arch, "MakeCache", False))

        except Exception as e:
            EdkLogger.debug(EdkLogger.DEBUG_9,
                            "Worker %s: %s" % (os.getpid(), str(e)))
            self.feedback_q.put(taskname)
        finally:
            EdkLogger.debug(EdkLogger.DEBUG_9,
                            "Worker %s: %s" % (os.getpid(), "Done"))
            self.feedback_q.put("Done")
            self.cache_q.put("CacheDone")
コード例 #15
0
ファイル: MetaDataTable.py プロジェクト: MattDevo/edk2
 def Exec(self, SqlCommand):
     EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand)
     self.Db.execute(SqlCommand)
     RecordSet = self.Db.fetchall()
     return RecordSet
コード例 #16
0
ファイル: Table.py プロジェクト: Itomyl/loongson-uefi
 def Exec(self, SqlCommand):
     EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
     self.Cur.execute(SqlCommand)
     RecordSet = self.Cur.fetchall()
     EdkLogger.debug(4, "RecordSet: %s" % RecordSet)
     return RecordSet
コード例 #17
0
    OutputDir = os.path.dirname(VpdFileName)
    FileName = os.path.basename(VpdFileName)
    BaseName, ext = os.path.splitext(FileName)
    OutputMapFileName = os.path.join(OutputDir, "%s.map" % BaseName)
    OutputBinFileName = os.path.join(OutputDir, "%s.bin" % BaseName)
          
    try:
        PopenObject = subprocess.Popen(' '.join([ToolPath,
                                        '-o', OutputBinFileName, 
                                        '-m', OutputMapFileName,
                                        '-q',
                                        '-f',
                                        VpdFileName]),
                                        stdout=subprocess.PIPE, 
                                        stderr= subprocess.PIPE,
                                        shell=True)
    except Exception, X:
        EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData="%s" % (str(X)))
    (out, error) = PopenObject.communicate()
    print out
    while PopenObject.returncode == None :
        PopenObject.wait()
    
    if PopenObject.returncode != 0:
        if PopenObject.returncode != 0:
            EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", str(error))
            EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail to execute BPDG tool with exit code: %d, the error message is: \n %s" % \
                            (PopenObject.returncode, str(error)))
        
    return PopenObject.returncode
コード例 #18
0
    def _OverridePcd(self, ToPcd, FromPcd, Module="", Msg="", Library=""):
        #
        # in case there's PCDs coming from FDF file, which have no type given.
        # at this point, ToPcd.Type has the type found from dependent
        # package
        #
        TokenCName = ToPcd.TokenCName
        for PcdItem in self.MixedPcd:
            if (ToPcd.TokenCName,
                    ToPcd.TokenSpaceGuidCName) in self.MixedPcd[PcdItem]:
                TokenCName = PcdItem[0]
                break
        if FromPcd is not None:
            if ToPcd.Pending and FromPcd.Type:
                ToPcd.Type = FromPcd.Type
            elif ToPcd.Type and FromPcd.Type\
                and ToPcd.Type != FromPcd.Type and ToPcd.Type in FromPcd.Type:
                if ToPcd.Type.strip() == TAB_PCDS_DYNAMIC_EX:
                    ToPcd.Type = FromPcd.Type
            elif ToPcd.Type and FromPcd.Type \
                and ToPcd.Type != FromPcd.Type:
                if Library:
                    Module = str(Module) + " 's library file (" + str(
                        Library) + ")"
                EdkLogger.error("build", OPTION_CONFLICT, "Mismatched PCD type",
                                ExtraData="%s.%s is used as [%s] in module %s, but as [%s] in %s."\
                                          % (ToPcd.TokenSpaceGuidCName, TokenCName,
                                             ToPcd.Type, Module, FromPcd.Type, Msg),
                                          File=self.MetaFile)

            if FromPcd.MaxDatumSize:
                ToPcd.MaxDatumSize = FromPcd.MaxDatumSize
                ToPcd.MaxSizeUserSet = FromPcd.MaxDatumSize
            if FromPcd.DefaultValue:
                ToPcd.DefaultValue = FromPcd.DefaultValue
            if FromPcd.TokenValue:
                ToPcd.TokenValue = FromPcd.TokenValue
            if FromPcd.DatumType:
                ToPcd.DatumType = FromPcd.DatumType
            if FromPcd.SkuInfoList:
                ToPcd.SkuInfoList = FromPcd.SkuInfoList
            if FromPcd.UserDefinedDefaultStoresFlag:
                ToPcd.UserDefinedDefaultStoresFlag = FromPcd.UserDefinedDefaultStoresFlag
            # Add Flexible PCD format parse
            if ToPcd.DefaultValue:
                try:
                    ToPcd.DefaultValue = ValueExpressionEx(
                        ToPcd.DefaultValue, ToPcd.DatumType,
                        self._GuidDict)(True)
                except BadExpression as Value:
                    EdkLogger.error(
                        'Parser',
                        FORMAT_INVALID,
                        'PCD [%s.%s] Value "%s", %s' %
                        (ToPcd.TokenSpaceGuidCName, ToPcd.TokenCName,
                         ToPcd.DefaultValue, Value),
                        File=self.MetaFile)

            # check the validation of datum
            IsValid, Cause = CheckPcdDatum(ToPcd.DatumType, ToPcd.DefaultValue)
            if not IsValid:
                EdkLogger.error('build',
                                FORMAT_INVALID,
                                Cause,
                                File=self.MetaFile,
                                ExtraData="%s.%s" %
                                (ToPcd.TokenSpaceGuidCName, TokenCName))
            ToPcd.validateranges = FromPcd.validateranges
            ToPcd.validlists = FromPcd.validlists
            ToPcd.expressions = FromPcd.expressions
            ToPcd.CustomAttribute = FromPcd.CustomAttribute

        if FromPcd is not None and ToPcd.DatumType == TAB_VOID and not ToPcd.MaxDatumSize:
            EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \
                            % (ToPcd.TokenSpaceGuidCName, TokenCName))
            Value = ToPcd.DefaultValue
            if not Value:
                ToPcd.MaxDatumSize = '1'
            elif Value[0] == 'L':
                ToPcd.MaxDatumSize = str((len(Value) - 2) * 2)
            elif Value[0] == '{':
                ToPcd.MaxDatumSize = str(len(Value.split(',')))
            else:
                ToPcd.MaxDatumSize = str(len(Value) - 1)

        # apply default SKU for dynamic PCDS if specified one is not available
        if (ToPcd.Type in PCD_DYNAMIC_TYPE_SET or ToPcd.Type in PCD_DYNAMIC_EX_TYPE_SET) \
            and not ToPcd.SkuInfoList:
            if self.Platform.SkuName in self.Platform.SkuIds:
                SkuName = self.Platform.SkuName
            else:
                SkuName = TAB_DEFAULT
            ToPcd.SkuInfoList = {
                SkuName:
                SkuInfoClass(SkuName, self.Platform.SkuIds[SkuName][0], '', '',
                             '', '', '', ToPcd.DefaultValue)
            }
コード例 #19
0
 def Exec(self, SqlCommand):
     EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand)
     self.Cur.execute(SqlCommand)
     RecordSet = self.Cur.fetchall()
     return RecordSet
コード例 #20
0
ファイル: Table.py プロジェクト: lersek/edk2
 def Exec(self, SqlCommand):
     EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
     self.Cur.execute(SqlCommand)
     RecordSet = self.Cur.fetchall()
     EdkLogger.debug(4, "RecordSet: %s" % RecordSet)
     return RecordSet
コード例 #21
0
ファイル: Database.py プロジェクト: Perry31/mu_basecore
    def UpdateIdentifierBelongsToFunction_disabled(self):
        EdkLogger.verbose(
            "Update 'BelongsToFunction' for Identifiers started ...")

        SqlCommand = """select ID, BelongsToFile, StartLine, EndLine, Model from Identifier"""
        EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
        self.Cur.execute(SqlCommand)
        Records = self.Cur.fetchall()
        for Record in Records:
            IdentifierID = Record[0]
            BelongsToFile = Record[1]
            StartLine = Record[2]
            EndLine = Record[3]
            Model = Record[4]

            #
            # Check whether an identifier belongs to a function
            #
            EdkLogger.debug(4, "For common identifiers ... ")
            SqlCommand = """select ID from Function
                        where StartLine < %s and EndLine > %s
                        and BelongsToFile = %s""" % (StartLine, EndLine,
                                                     BelongsToFile)
            EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
            self.Cur.execute(SqlCommand)
            IDs = self.Cur.fetchall()
            for ID in IDs:
                SqlCommand = """Update Identifier set BelongsToFunction = %s where ID = %s""" % (
                    ID[0], IdentifierID)
                EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
                self.Cur.execute(SqlCommand)

            #
            # Check whether the identifier is a function header
            #
            EdkLogger.debug(4, "For function headers ... ")
            if Model == DataClass.MODEL_IDENTIFIER_COMMENT:
                SqlCommand = """select ID from Function
                        where StartLine = %s + 1
                        and BelongsToFile = %s""" % (EndLine, BelongsToFile)
                EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
                self.Cur.execute(SqlCommand)
                IDs = self.Cur.fetchall()
                for ID in IDs:
                    SqlCommand = """Update Identifier set BelongsToFunction = %s, Model = %s where ID = %s""" % (
                        ID[0], DataClass.MODEL_IDENTIFIER_FUNCTION_HEADER,
                        IdentifierID)
                    EdkLogger.debug(4, "SqlCommand: %s" % SqlCommand)
                    self.Cur.execute(SqlCommand)

        EdkLogger.verbose(
            "Update 'BelongsToFunction' for Identifiers ... DONE")
コード例 #22
0
 def DebugLogger (Level, msg):
     EdkLogger.debug(Level, msg)