MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / Main

Function Main

BaseTools/Source/Python/UPT/MkPkg.py:69–240  ·  view source on GitHub ↗
(Options = None)

Source from the content-addressed store, hash-verified

67#
68#
69def Main(Options = None):
70 if Options is None:
71 Logger.Error("\nMkPkg", OPTION_UNKNOWN_ERROR, ST.ERR_OPTION_NOT_FOUND)
72 try:
73 DataBase = GlobalData.gDB
74 ContentFileClosed = True
75 WorkspaceDir = GlobalData.gWORKSPACE
76
77 #
78 # Init PackFileToCreate
79 #
80 if not Options.PackFileToCreate:
81 Logger.Error("\nMkPkg", OPTION_UNKNOWN_ERROR, ST.ERR_OPTION_NOT_FOUND)
82
83 #
84 # Handle if the distribution package file already exists
85 #
86 CheckForExistingDp(Options.PackFileToCreate)
87
88 #
89 # Check package file existing and valid
90 #
91 CheckFileList('.DEC', Options.PackageFileList, ST.ERR_INVALID_PACKAGE_NAME, ST.ERR_INVALID_PACKAGE_PATH)
92 #
93 # Check module file existing and valid
94 #
95 CheckFileList('.INF', Options.ModuleFileList, ST.ERR_INVALID_MODULE_NAME, ST.ERR_INVALID_MODULE_PATH)
96
97 #
98 # Get list of files that installed with RePackage attribute available
99 #
100 RePkgDict = DataBase.GetRePkgDict()
101
102 ContentFile = PackageFile(GlobalData.gCONTENT_FILE, "w")
103 ContentFileClosed = False
104
105 #
106 # Add temp distribution header
107 #
108 if Options.PackageInformationDataFile:
109 XmlFile = IniToXml(Options.PackageInformationDataFile)
110 DistPkg = DistributionPackageXml().FromXml(XmlFile)
111 remove(XmlFile)
112
113 #
114 # add distribution level tool/misc files
115 # before pack, current dir should be workspace dir, else the full
116 # path will be in the pack file
117 #
118 Cwd = getcwd()
119 chdir(WorkspaceDir)
120 ToolObject = DistPkg.Tools
121 MiscObject = DistPkg.MiscellaneousFiles
122 FileList = []
123 if ToolObject:
124 FileList += ToolObject.GetFileList()
125 if MiscObject:
126 FileList += MiscObject.GetFileList()

Callers

nothing calls this directly

Calls 15

PackFileMethod · 0.95
PackFilesMethod · 0.95
CloseMethod · 0.95
PackDataMethod · 0.95
ToXmlMethod · 0.95
PackageFileClass · 0.90
IniToXmlFunction · 0.90
CheckForExistingDpFunction · 0.85

Tested by

no test coverage detected