summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python/AutoGen')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py25
-rw-r--r--BaseTools/Source/Python/AutoGen/GenC.py5
-rw-r--r--BaseTools/Source/Python/AutoGen/GenMake.py8
-rw-r--r--BaseTools/Source/Python/AutoGen/GenPcdDb.py4
4 files changed, 24 insertions, 18 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 2b3f93c3bc..46e94d47e4 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -295,7 +295,7 @@ class WorkspaceAutoGen(AutoGen):
SkippedArchList = set(self.ArchList).symmetric_difference(set(self.Platform.SupArchList))
EdkLogger.verbose("\nArch [%s] is ignored because the platform supports [%s] only!"
% (" ".join(SkippedArchList), " ".join(self.Platform.SupArchList)))
- self.ArchList = tuple(ArchList)
+ self.ArchList = tuple(sorted(ArchList))
# Validate build target
if self.BuildTarget not in self.Platform.BuildTargets:
@@ -616,17 +616,17 @@ class WorkspaceAutoGen(AutoGen):
#
content = 'gCommandLineDefines: '
content += str(GlobalData.gCommandLineDefines)
- content += os.linesep
+ content += "\n"
content += 'BuildOptionPcd: '
content += str(GlobalData.BuildOptionPcd)
- content += os.linesep
+ content += "\n"
content += 'Active Platform: '
content += str(self.Platform)
- content += os.linesep
+ content += "\n"
if self.FdfFile:
content += 'Flash Image Definition: '
content += str(self.FdfFile)
- content += os.linesep
+ content += "\n"
SaveFileOnChange(os.path.join(self.BuildDir, 'BuildOptions'), content, False)
#
@@ -636,7 +636,7 @@ class WorkspaceAutoGen(AutoGen):
if Pa.PcdTokenNumber:
if Pa.DynamicPcdList:
for Pcd in Pa.DynamicPcdList:
- PcdTokenNumber += os.linesep
+ PcdTokenNumber += "\n"
PcdTokenNumber += str((Pcd.TokenCName, Pcd.TokenSpaceGuidCName))
PcdTokenNumber += ' : '
PcdTokenNumber += str(Pa.PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpaceGuidCName])
@@ -677,7 +677,7 @@ class WorkspaceAutoGen(AutoGen):
if not os.path.exists(self.BuildDir):
os.makedirs(self.BuildDir)
with open(os.path.join(self.BuildDir, 'AutoGen'), 'w+') as file:
- for f in AllWorkSpaceMetaFiles:
+ for f in sorted(AllWorkSpaceMetaFiles):
print(f, file=file)
return True
@@ -1598,6 +1598,9 @@ class PlatformAutoGen(AutoGen):
self._DynamicPcdList.extend(list(UnicodePcdArray))
self._DynamicPcdList.extend(list(HiiPcdArray))
self._DynamicPcdList.extend(list(OtherPcdArray))
+ #python3.6 set is not ordered at all
+ self._DynamicPcdList = sorted(self._DynamicPcdList, key=lambda x:(x.TokenSpaceGuidCName, x.TokenCName))
+ self._NonDynamicPcdList = sorted(self._NonDynamicPcdList, key=lambda x: (x.TokenSpaceGuidCName, x.TokenCName))
allskuset = [(SkuName, Sku.SkuId) for pcd in self._DynamicPcdList for (SkuName, Sku) in pcd.SkuInfoList.items()]
for pcd in self._DynamicPcdList:
if len(pcd.SkuInfoList) == 1:
@@ -2374,7 +2377,7 @@ class PlatformAutoGen(AutoGen):
list(PlatformModuleOptions.keys()) + list(ModuleTypeOptions.keys()) +
list(self.ToolDefinition.keys()))
BuildOptions = defaultdict(lambda: defaultdict(str))
- for Tool in AllTools:
+ for Tool in sorted(AllTools):
for Options in [self.ToolDefinition, ModuleOptions, PlatformOptions, ModuleTypeOptions, PlatformModuleOptions]:
if Tool not in Options:
continue
@@ -3156,12 +3159,12 @@ class ModuleAutoGen(AutoGen):
@cached_property
def IntroTargetList(self):
self.Targets
- return self._IntroBuildTargetList
+ return sorted(self._IntroBuildTargetList, key=lambda x: str(x.Target))
@cached_property
def CodaTargetList(self):
self.Targets
- return self._FinalBuildTargetList
+ return sorted(self._FinalBuildTargetList, key=lambda x: str(x.Target))
@cached_property
def FileTypes(self):
@@ -3889,7 +3892,7 @@ class ModuleAutoGen(AutoGen):
if os.path.exists (self.TimeStampPath):
os.remove (self.TimeStampPath)
with open(self.TimeStampPath, 'w+') as file:
- for f in FileSet:
+ for f in sorted(FileSet):
print(f, file=file)
# Ignore generating makefile when it is a binary module
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index a21880f317..4db5330e51 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1011,7 +1011,10 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
Value = Value[:-1]
ValueNumber = int (Value, 0)
except:
- EdkLogger.error("build", AUTOGEN_ERROR,
+ try:
+ ValueNumber = int(Value.lstrip('0'))
+ except:
+ EdkLogger.error("build", AUTOGEN_ERROR,
"PCD value is not valid dec or hex number for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
ExtraData="[%s]" % str(Info))
if ValueNumber < 0:
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 0051aaf41f..2f6fe06764 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -917,7 +917,7 @@ cleanlib:
#
# Extract common files list in the dependency files
#
- for File in DepSet:
+ for File in sorted(DepSet, key=lambda x: str(x)):
self.CommonFileDependency.append(self.PlaceMacro(File.Path, self.Macros))
for File in FileDependencyDict:
@@ -926,11 +926,11 @@ cleanlib:
continue
NewDepSet = set(FileDependencyDict[File])
NewDepSet -= DepSet
- FileDependencyDict[File] = ["$(COMMON_DEPS)"] + list(NewDepSet)
+ FileDependencyDict[File] = ["$(COMMON_DEPS)"] + sorted(NewDepSet, key=lambda x: str(x))
# Convert target description object to target string in makefile
for Type in self._AutoGenObject.Targets:
- for T in self._AutoGenObject.Targets[Type]:
+ for T in sorted(self._AutoGenObject.Targets[Type], key=lambda x: str(x)):
# Generate related macros if needed
if T.GenFileListMacro and T.FileListMacro not in self.FileListMacros:
self.FileListMacros[T.FileListMacro] = []
@@ -1097,7 +1097,7 @@ cleanlib:
DependencySet.update(ForceList)
if File in DependencySet:
DependencySet.remove(File)
- DependencyList = list(DependencySet) # remove duplicate ones
+ DependencyList = sorted(DependencySet, key=lambda x: str(x)) # remove duplicate ones
return DependencyList
diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
index a546ecbbb7..68f92ef063 100644
--- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py
+++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py
@@ -1348,7 +1348,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
DbValueList.append(Sku.DefaultValue)
- Pcd.TokenTypeList = list(set(Pcd.TokenTypeList))
+ Pcd.TokenTypeList = sorted(set(Pcd.TokenTypeList))
if Pcd.DatumType == TAB_VOID:
Dict['SIZE_TABLE_CNAME'].append(CName)
Dict['SIZE_TABLE_GUID'].append(TokenSpaceGuid)
@@ -1449,7 +1449,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
Dict['PCD_CNAME_LENGTH'][GeneratedTokenNumber] = len(CNameBinArray.split(","))
- Pcd.TokenTypeList = list(set(Pcd.TokenTypeList))
+ Pcd.TokenTypeList = sorted(set(Pcd.TokenTypeList))
# search the Offset and Table, used by LocalTokenNumberTableOffset
if 'PCD_TYPE_HII' in Pcd.TokenTypeList: