mirror of https://github.com/acidanthera/audk.git
Start to build the manifest.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2104 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
e853a9d483
commit
69932b41f0
|
@ -6,7 +6,7 @@ from WorkspaceRoutines import *
|
||||||
|
|
||||||
def parseMsa(msaFile, spdDir):
|
def parseMsa(msaFile, spdDir):
|
||||||
|
|
||||||
filelist = []
|
filelist = [msaFile]
|
||||||
|
|
||||||
msaDir = os.path.dirname(msaFile)
|
msaDir = os.path.dirname(msaFile)
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@ def parseSpd(spdFile):
|
||||||
for xmlPath in ["/PackageSurfaceArea/MsaFiles/Filename"]:
|
for xmlPath in ["/PackageSurfaceArea/MsaFiles/Filename"]:
|
||||||
for f in XmlList(spd, xmlPath):
|
for f in XmlList(spd, xmlPath):
|
||||||
msaFile = str(os.path.join(spdDir, XmlElementData(f)))
|
msaFile = str(os.path.join(spdDir, XmlElementData(f)))
|
||||||
filelist.append(msaFile)
|
|
||||||
|
|
||||||
filelist += parseMsa(msaFile, spdDir)
|
filelist += parseMsa(msaFile, spdDir)
|
||||||
|
|
||||||
return filelist
|
return filelist
|
||||||
|
@ -55,6 +53,23 @@ def makeFar(filelist, farname):
|
||||||
<FrameworkArchiveManifest>
|
<FrameworkArchiveManifest>
|
||||||
</FrameworkArchiveManifest>
|
</FrameworkArchiveManifest>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
domImpl = xml.dom.minidom.getDOMImplementation()
|
||||||
|
man = domImpl.createDocument(None, "FrameworkArchiveManifest", None)
|
||||||
|
top_element = man.documentElement
|
||||||
|
|
||||||
|
header = man.createElement("FarHeader")
|
||||||
|
top_element.appendChild(header)
|
||||||
|
|
||||||
|
packList = man.createElement("FarPackageList")
|
||||||
|
top_element.appendChild(packList)
|
||||||
|
|
||||||
|
platList = man.createElement("FarPlatformList")
|
||||||
|
top_element.appendChild(platList)
|
||||||
|
|
||||||
|
contents = man.createElement("Contents")
|
||||||
|
top_element.appendChild(contents)
|
||||||
|
|
||||||
zip = zipfile.ZipFile(farname, "w")
|
zip = zipfile.ZipFile(farname, "w")
|
||||||
for file in args:
|
for file in args:
|
||||||
if not os.path.exists(inWorkspace(file)):
|
if not os.path.exists(inWorkspace(file)):
|
||||||
|
@ -62,13 +77,24 @@ def makeFar(filelist, farname):
|
||||||
(_, extension) = os.path.splitext(file)
|
(_, extension) = os.path.splitext(file)
|
||||||
if extension == ".spd":
|
if extension == ".spd":
|
||||||
filelist = parseSpd(file)
|
filelist = parseSpd(file)
|
||||||
|
|
||||||
|
for file in filelist:
|
||||||
|
|
||||||
|
package = man.createElement("FarPackage")
|
||||||
|
packList.appendChild(package)
|
||||||
|
|
||||||
|
spdfilename = man.createElement("FarFileName")
|
||||||
|
package.appendChild(spdfilename)
|
||||||
|
|
||||||
|
spdfilename.appendChild( man.createTextNode(file) )
|
||||||
|
|
||||||
elif extension == ".fpd":
|
elif extension == ".fpd":
|
||||||
filelist = [file]
|
filelist = [file]
|
||||||
else:
|
else:
|
||||||
filelist = []
|
filelist = []
|
||||||
for f in set(filelist):
|
for f in set(filelist):
|
||||||
zip.write(inWorkspace(f), f)
|
zip.write(inWorkspace(f), f)
|
||||||
zip.writestr("FrameworkArchiveManifest.xml", man)
|
zip.writestr("FrameworkArchiveManifest.xml", man.toprettyxml(" "))
|
||||||
zip.close()
|
zip.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue