]>
Commit | Line | Data |
---|---|---|
30fdf114 LG |
1 | ## @file\r |
2 | # This file is used to define common parser functions for meta-data\r | |
3 | #\r | |
4 | # Copyright (c) 2008, Intel Corporation\r | |
5 | # All rights reserved. This program and the accompanying materials\r | |
6 | # are licensed and made available under the terms and conditions of the BSD License\r | |
7 | # which accompanies this distribution. The full text of the license may be found at\r | |
8 | # http://opensource.org/licenses/bsd-license.php\r | |
9 | #\r | |
10 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | #\r | |
13 | \r | |
14 | import os\r | |
15 | from CommonDataClass.DataClass import *\r | |
16 | \r | |
17 | \r | |
18 | ## Get the inlcude path list for a source file\r | |
19 | #\r | |
20 | # 1. Find the source file belongs to which inf file\r | |
21 | # 2. Find the inf's package\r | |
22 | # 3. Return the include path list of the package\r | |
23 | #\r | |
24 | def GetIncludeListOfFile(WorkSpace, Filepath, Db):\r | |
25 | IncludeList = []\r | |
26 | Filepath = os.path.normpath(Filepath)\r | |
27 | SqlCommand = """\r | |
28 | select Value1, FullPath from Inf, File where Inf.Model = %s and Inf.BelongsToFile in(\r | |
29 | select distinct B.BelongsToFile from File as A left join Inf as B \r | |
30 | where A.ID = B.BelongsToFile and B.Model = %s and (A.Path || '%s' || B.Value1) = '%s')\r | |
31 | and Inf.BelongsToFile = File.ID""" \\r | |
32 | % (MODEL_META_DATA_PACKAGE, MODEL_EFI_SOURCE_FILE, '\\', Filepath)\r | |
33 | RecordSet = Db.TblFile.Exec(SqlCommand)\r | |
34 | for Record in RecordSet:\r | |
35 | DecFullPath = os.path.normpath(os.path.join(WorkSpace, Record[0]))\r | |
36 | InfFullPath = os.path.normpath(os.path.join(WorkSpace, Record[1]))\r | |
37 | (DecPath, DecName) = os.path.split(DecFullPath)\r | |
38 | (InfPath, InfName) = os.path.split(InfFullPath)\r | |
39 | SqlCommand = """select Value1 from Dec where BelongsToFile = \r | |
40 | (select ID from File where FullPath = '%s') and Model = %s""" \\r | |
41 | % (DecFullPath, MODEL_EFI_INCLUDE)\r | |
42 | NewRecordSet = Db.TblDec.Exec(SqlCommand)\r | |
43 | if InfPath not in IncludeList:\r | |
44 | IncludeList.append(InfPath)\r | |
45 | for NewRecord in NewRecordSet:\r | |
46 | IncludePath = os.path.normpath(os.path.join(DecPath, NewRecord[0]))\r | |
47 | if IncludePath not in IncludeList:\r | |
48 | IncludeList.append(IncludePath)\r | |
49 | \r | |
50 | return IncludeList\r | |
51 | \r | |
52 | ## Get the table list\r | |
53 | #\r | |
54 | # Search table file and find all small tables\r | |
55 | #\r | |
56 | def GetTableList(FileModelList, Table, Db):\r | |
57 | TableList = []\r | |
58 | SqlCommand = """select ID from File where Model in %s""" % str(FileModelList)\r | |
59 | RecordSet = Db.TblFile.Exec(SqlCommand)\r | |
60 | for Record in RecordSet:\r | |
61 | TableName = Table + str(Record[0])\r | |
62 | TableList.append(TableName)\r | |
63 | \r | |
64 | return TableList\r | |
65 | \r |