From 69932b41f06498e5266d0102a164041bb8f660ab Mon Sep 17 00:00:00 2001 From: bbahnsen Date: Sat, 16 Dec 2006 07:50:00 +0000 Subject: [PATCH] Start to build the manifest. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2104 6f19259b-4bc3-4df7-8a09-765794883524 --- Tools/Python/MkFar.py | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/Tools/Python/MkFar.py b/Tools/Python/MkFar.py index 1dba1fc4aa..b5284b4781 100755 --- a/Tools/Python/MkFar.py +++ b/Tools/Python/MkFar.py @@ -6,7 +6,7 @@ from WorkspaceRoutines import * def parseMsa(msaFile, spdDir): - filelist = [] + filelist = [msaFile] msaDir = os.path.dirname(msaFile) @@ -42,8 +42,6 @@ def parseSpd(spdFile): for xmlPath in ["/PackageSurfaceArea/MsaFiles/Filename"]: for f in XmlList(spd, xmlPath): msaFile = str(os.path.join(spdDir, XmlElementData(f))) - filelist.append(msaFile) - filelist += parseMsa(msaFile, spdDir) return filelist @@ -55,6 +53,23 @@ def makeFar(filelist, farname): """ + + 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") for file in args: if not os.path.exists(inWorkspace(file)): @@ -62,13 +77,24 @@ def makeFar(filelist, farname): (_, extension) = os.path.splitext(file) if extension == ".spd": 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": filelist = [file] else: filelist = [] for f in set(filelist): zip.write(inWorkspace(f), f) - zip.writestr("FrameworkArchiveManifest.xml", man) + zip.writestr("FrameworkArchiveManifest.xml", man.toprettyxml(" ")) zip.close() return