mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 00:24:07 +02:00
Added some new field to the far template.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2126 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d56b1906f1
commit
af2efcafd4
@ -120,6 +120,8 @@ def getCNames(spdFile):
|
|||||||
|
|
||||||
# Get the name of the package
|
# Get the name of the package
|
||||||
packageName = XmlElement(spd, "PackageSurfaceArea/SpdHeader/PackageName")
|
packageName = XmlElement(spd, "PackageSurfaceArea/SpdHeader/PackageName")
|
||||||
|
packageVersion = XmlElement(spd, "PackageSurfaceArea/SpdHeader/Version")
|
||||||
|
packageGuid = XmlElement(spd, "PackageSurfaceArea/SpdHeader/GuidValue")
|
||||||
|
|
||||||
# Find the C_Name
|
# Find the C_Name
|
||||||
for cname in XmlList(spd, "/PackageSurfaceArea/GuidDeclarations/Entry/C_Name") + \
|
for cname in XmlList(spd, "/PackageSurfaceArea/GuidDeclarations/Entry/C_Name") + \
|
||||||
@ -132,7 +134,8 @@ def getCNames(spdFile):
|
|||||||
|
|
||||||
# Map the <C_Name> to the <PackageName>. We will use this to lookup every
|
# Map the <C_Name> to the <PackageName>. We will use this to lookup every
|
||||||
# identifier in the Input Code.
|
# identifier in the Input Code.
|
||||||
cname_table[cname_text] = packageName
|
cname_table[cname_text] = {"name": packageName, "version": packageVersion, "guid": packageGuid}
|
||||||
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -195,7 +198,11 @@ large file."""
|
|||||||
getSpds()
|
getSpds()
|
||||||
|
|
||||||
# Debug stuff.
|
# Debug stuff.
|
||||||
print pp.pprint(function_table)
|
print "Function Table = "
|
||||||
print pp.pprint(cname_table)
|
pp.pprint(function_table)
|
||||||
print "Classes = ", pp.pprint(list(search_classes(ids)))
|
print "CName Table = "
|
||||||
print "C_Names = ", pp.pprint(list(search_cnames(ids)))
|
pp.pprint(cname_table)
|
||||||
|
print "Classes = "
|
||||||
|
pp.pprint(list(search_classes(ids)))
|
||||||
|
print "C_Names = "
|
||||||
|
pp.pprint(list(search_cnames(ids)))
|
||||||
|
47
Tools/Python/ListWorkspace.py
Executable file
47
Tools/Python/ListWorkspace.py
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
"""List the contents of the Framework Database to the screen in a readble
|
||||||
|
form."""
|
||||||
|
|
||||||
|
import os, sys, getopt, string, xml.dom.minidom, zipfile, md5
|
||||||
|
from XmlRoutines import *
|
||||||
|
from WorkspaceRoutines import *
|
||||||
|
|
||||||
|
def openDatabase(f):
|
||||||
|
|
||||||
|
print "Dumping the contents of %s workspace database file." % f
|
||||||
|
|
||||||
|
db = xml.dom.minidom.parse(inWorkspace(f))
|
||||||
|
|
||||||
|
return db
|
||||||
|
|
||||||
|
def showSpds(db):
|
||||||
|
|
||||||
|
print "--------\nPackages\n--------"
|
||||||
|
|
||||||
|
for spdFile in XmlList(db, "/FrameworkDatabase/PackageList/Filename"):
|
||||||
|
spdFileName = XmlElementData(spdFile)
|
||||||
|
spd = xml.dom.minidom.parse(inWorkspace(spdFileName))
|
||||||
|
spdName = XmlElement(spd, "/PackageSurfaceArea/SpdHeader/PackageName")
|
||||||
|
|
||||||
|
print " %-24s %-10s" % (spdName, spdFileName)
|
||||||
|
|
||||||
|
def showFpds(db):
|
||||||
|
|
||||||
|
print "--------\nPlatforms\n--------"
|
||||||
|
|
||||||
|
for fpdFile in XmlList(db, "/FrameworkDatabase/PlatformList/Filename"):
|
||||||
|
fpdFileName = XmlElementData(fpdFile)
|
||||||
|
fpd = xml.dom.minidom.parse(inWorkspace(fpdFileName))
|
||||||
|
fpdName = XmlElement(fpd, "/PlatformSurfaceArea/PlatformHeader/PlatformName")
|
||||||
|
|
||||||
|
print " %-24s %-10s" % (fpdName, fpdFileName)
|
||||||
|
|
||||||
|
# This acts like the main() function for the script, unless it is 'import'ed
|
||||||
|
# into another script.
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
db = openDatabase("Tools/Conf/FrameworkDatabase.db")
|
||||||
|
|
||||||
|
showSpds(db)
|
||||||
|
showFpds(db)
|
@ -12,11 +12,12 @@ class Far:
|
|||||||
far.FarName=""
|
far.FarName=""
|
||||||
far.Version=""
|
far.Version=""
|
||||||
far.License=""
|
far.License=""
|
||||||
|
far.Abstract=""
|
||||||
far.Description=""
|
far.Description=""
|
||||||
far.Copyright=""
|
far.Copyright=""
|
||||||
far.SpdFiles=""
|
far.SpdFiles=[]
|
||||||
far.FpdFile=""
|
far.FpdFiles=[]
|
||||||
far.ExtraFile=""
|
far.ExtraFiles=[]
|
||||||
|
|
||||||
far = Far()
|
far = Far()
|
||||||
|
|
||||||
@ -62,7 +63,8 @@ def parseSpd(spdFile):
|
|||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
os.chdir(inWorkspace(spdDir))
|
os.chdir(inWorkspace(spdDir))
|
||||||
for root, dirs, entries in os.walk("Include"):
|
for root, dirs, entries in os.walk("Include"):
|
||||||
for r in ["CVS", ".svn"]:
|
# Some files need to be skipped.
|
||||||
|
for r in ["CVS", ".svn"]:
|
||||||
if r in dirs:
|
if r in dirs:
|
||||||
dirs.remove(r)
|
dirs.remove(r)
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
@ -108,7 +110,7 @@ def getSpdGuidVersion(spdFile):
|
|||||||
return (XmlElement(spd, "/PackageSurfaceArea/SpdHeader/GuidValue"),
|
return (XmlElement(spd, "/PackageSurfaceArea/SpdHeader/GuidValue"),
|
||||||
XmlElement(spd, "/PackageSurfaceArea/SpdHeader/Version"))
|
XmlElement(spd, "/PackageSurfaceArea/SpdHeader/Version"))
|
||||||
|
|
||||||
def makeFar(filelist, farname):
|
def makeFar(files, farname):
|
||||||
|
|
||||||
domImpl = xml.dom.minidom.getDOMImplementation()
|
domImpl = xml.dom.minidom.getDOMImplementation()
|
||||||
man = domImpl.createDocument(None, "FrameworkArchiveManifest", None)
|
man = domImpl.createDocument(None, "FrameworkArchiveManifest", None)
|
||||||
@ -129,7 +131,7 @@ def makeFar(filelist, farname):
|
|||||||
top_element.appendChild(exts)
|
top_element.appendChild(exts)
|
||||||
|
|
||||||
zip = zipfile.ZipFile(farname, "w")
|
zip = zipfile.ZipFile(farname, "w")
|
||||||
for infile in filelist:
|
for infile in set(files):
|
||||||
if not os.path.exists(inWorkspace(infile)):
|
if not os.path.exists(inWorkspace(infile)):
|
||||||
print "Skipping non-existent file '%s'." % infile
|
print "Skipping non-existent file '%s'." % infile
|
||||||
(_, extension) = os.path.splitext(infile)
|
(_, extension) = os.path.splitext(infile)
|
||||||
@ -144,7 +146,7 @@ def makeFar(filelist, farname):
|
|||||||
|
|
||||||
spdfilename = farFileNode(man, inWorkspace(infile))
|
spdfilename = farFileNode(man, inWorkspace(infile))
|
||||||
zip.write(inWorkspace(infile), infile)
|
zip.write(inWorkspace(infile), infile)
|
||||||
spdfilename.appendChild(man.createTextNode(infile))
|
spdfilename.appendChild(man.createTextNode(lean(infile)))
|
||||||
package.appendChild(spdfilename)
|
package.appendChild(spdfilename)
|
||||||
|
|
||||||
guidValue = man.createElement("GuidValue")
|
guidValue = man.createElement("GuidValue")
|
||||||
@ -171,7 +173,7 @@ def makeFar(filelist, farname):
|
|||||||
for spdfile in filelist:
|
for spdfile in filelist:
|
||||||
content = farFileNode(man, inWorkspace(os.path.join(spdDir, spdfile)))
|
content = farFileNode(man, inWorkspace(os.path.join(spdDir, spdfile)))
|
||||||
zip.write(inWorkspace(os.path.join(spdDir, spdfile)), spdfile)
|
zip.write(inWorkspace(os.path.join(spdDir, spdfile)), spdfile)
|
||||||
content.appendChild(man.createTextNode(spdfile))
|
content.appendChild(man.createTextNode(lean(spdfile)))
|
||||||
packContents.appendChild(content)
|
packContents.appendChild(content)
|
||||||
|
|
||||||
elif extension == ".fpd":
|
elif extension == ".fpd":
|
||||||
@ -182,12 +184,12 @@ def makeFar(filelist, farname):
|
|||||||
fpdfilename = farFileNode(man, inWorkspace(infile))
|
fpdfilename = farFileNode(man, inWorkspace(infile))
|
||||||
zip.write(inWorkspace(infile), infile)
|
zip.write(inWorkspace(infile), infile)
|
||||||
platform.appendChild(fpdfilename)
|
platform.appendChild(fpdfilename)
|
||||||
fpdfilename.appendChild( man.createTextNode(infile) )
|
fpdfilename.appendChild(man.createTextNode(lean(infile)))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
content = farFileNode(man, inWorkspace(infile))
|
content = farFileNode(man, inWorkspace(infile))
|
||||||
zip.write(inWorkspace(infile), infile)
|
zip.write(inWorkspace(infile), infile)
|
||||||
content.appendChild(man.createTextNode(infile))
|
content.appendChild(man.createTextNode(lean(infile)))
|
||||||
contents.appendChild(content)
|
contents.appendChild(content)
|
||||||
|
|
||||||
zip.writestr("FrameworkArchiveManifest.xml", man.toprettyxml(2*" "))
|
zip.writestr("FrameworkArchiveManifest.xml", man.toprettyxml(2*" "))
|
||||||
@ -211,6 +213,7 @@ if __name__ == '__main__':
|
|||||||
# Process the command line args.
|
# Process the command line args.
|
||||||
optlist, args = getopt.getopt(sys.argv[1:], 'hf:t:', [ 'template=', 'far=', 'help'])
|
optlist, args = getopt.getopt(sys.argv[1:], 'hf:t:', [ 'template=', 'far=', 'help'])
|
||||||
|
|
||||||
|
# First pass through the options list.
|
||||||
for o, a in optlist:
|
for o, a in optlist:
|
||||||
if o in ["-h", "--help"]:
|
if o in ["-h", "--help"]:
|
||||||
print """
|
print """
|
||||||
@ -220,19 +223,28 @@ You may give the name of the far with a -f or --far option. For example:
|
|||||||
%s --far library.far MdePkg/MdePkg.spd
|
%s --far library.far MdePkg/MdePkg.spd
|
||||||
|
|
||||||
The file paths of .spd and .fpd are treated as relative to the WORKSPACE
|
The file paths of .spd and .fpd are treated as relative to the WORKSPACE
|
||||||
envirnonment variable which must be set to a valid workspace root directory.
|
environment variable which must be set to a valid workspace root directory.
|
||||||
""" % os.path.basename(sys.argv[0])
|
""" % os.path.basename(sys.argv[0])
|
||||||
|
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
optlist.remove((o,a))
|
||||||
if o in ["-t", "--template"]:
|
if o in ["-t", "--template"]:
|
||||||
# The template file is processed first, so that command line options can
|
# The template file is processed first, so that command line options can
|
||||||
# override it.
|
# override it.
|
||||||
templateName = a
|
templateName = a
|
||||||
execfile(templateName)
|
execfile(templateName)
|
||||||
|
optlist.remove((o,a))
|
||||||
|
|
||||||
|
# Second pass through the options list. These can override the first pass.
|
||||||
|
for o, a in optlist:
|
||||||
|
print o, a
|
||||||
if o in ["-f", "--far"]:
|
if o in ["-f", "--far"]:
|
||||||
far.FileName = a
|
far.FileName = a
|
||||||
if os.path.exists(far.FileName):
|
|
||||||
print "Error: File %s exists. Not overwriting." % far.FileName
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
makeFar(args, far.FileName)
|
# Let's err on the side of caution and not let people blow away data
|
||||||
|
# accidentally.
|
||||||
|
if os.path.exists(far.FileName):
|
||||||
|
print "Error: File %s exists. Not overwriting." % far.FileName
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
makeFar(far.SpdFiles + far.FpdFiles + far.ExtraFiles + args, far.FileName)
|
||||||
|
@ -19,3 +19,8 @@ def genguid():
|
|||||||
str(time.time()) +
|
str(time.time()) +
|
||||||
socket.gethostbyname(socket.gethostname())).hexdigest()
|
socket.gethostbyname(socket.gethostname())).hexdigest()
|
||||||
return "%s-%s-%s-%s-%s" % (g[0:8], g[8:12], g[12:16], g[16:20], g[20:])
|
return "%s-%s-%s-%s-%s" % (g[0:8], g[8:12], g[12:16], g[16:20], g[20:])
|
||||||
|
|
||||||
|
def lean(path):
|
||||||
|
"""Lean the slashes forward"""
|
||||||
|
|
||||||
|
return os.path.normpath(path).replace("\\", "/")
|
||||||
|
@ -44,7 +44,7 @@ def XmlAttribute (Dom, String):
|
|||||||
|
|
||||||
def XmlTopTag(Dom):
|
def XmlTopTag(Dom):
|
||||||
"""Return the name of the Root or top tag in the XML tree."""
|
"""Return the name of the Root or top tag in the XML tree."""
|
||||||
return Dom.firstChild.nodeName
|
return Dom.documentElement.nodeName
|
||||||
|
|
||||||
|
|
||||||
# This acts like the main() function for the script, unless it is 'import'ed into another
|
# This acts like the main() function for the script, unless it is 'import'ed into another
|
||||||
|
@ -1,23 +1,48 @@
|
|||||||
# This file is a template to be used in creating a Framework Archive Manifest.
|
# This file is a template to be used in creating a Framework Archive Manifest.
|
||||||
# Each entry can be assigned to a string, which is quoted, or to a string that
|
# Each entry can be assigned to a string, which is quoted, or to a string that
|
||||||
# spans mutliple lines, which is triple quoted.
|
# spans mutliple lines, which is triple quoted. Lists of strings are placed
|
||||||
# This file should be passed as a command line argument to the MkFar.py script.
|
# inside of square brackets.
|
||||||
# It is used to help the user control how the far is created.
|
# This file should be passed as a command line argument to the MkFar.py script.
|
||||||
|
# It is used to help the user control how the far is created.
|
||||||
far.FileName = "my.far"
|
|
||||||
far.FarName = "My Far"
|
# The filename to give the new far.
|
||||||
far.Version = "0.3"
|
far.FileName = "my.far"
|
||||||
far.License="""This program and the accompanying materials are licensed and made
|
|
||||||
available under the terms and conditions of the BSD License which accompanies
|
# The user readable name to give the far.
|
||||||
this distribution. The full text of the license may be found at
|
far.FarName = "My Far"
|
||||||
http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER
|
|
||||||
THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
|
# The version of the far.
|
||||||
ANY KIND, EITHER EXPRESS OR IMPLIED."""
|
far.Version = "0.3"
|
||||||
far.Description="""This Package provides headers and libraries that conform to
|
|
||||||
my wishes."""
|
# The license terms of the far.
|
||||||
far.Copyright="Copyright (c) 2006, My Corporation."
|
far.License="""This program and the accompanying materials are licensed and made
|
||||||
far.SpdFiles=""
|
available under the terms and conditions of the BSD License which accompanies
|
||||||
far.FpdFile=""
|
this distribution. The full text of the license may be found at
|
||||||
far.ExtraFile=""
|
http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER
|
||||||
|
THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF
|
||||||
# vim:syntax=python
|
ANY KIND, EITHER EXPRESS OR IMPLIED."""
|
||||||
|
|
||||||
|
# Short description.
|
||||||
|
far.Abstract = "Its a good far."
|
||||||
|
|
||||||
|
# Long description.
|
||||||
|
far.Description="""This Package provides headers and libraries that conform to
|
||||||
|
my wishes."""
|
||||||
|
|
||||||
|
# Copyright string to be placed inside the far.
|
||||||
|
far.Copyright="Copyright (c) 2006, My Corporation."
|
||||||
|
|
||||||
|
# A list of workspace-relative paths to the .spd files that should be
|
||||||
|
# placed inside this far.
|
||||||
|
far.SpdFiles=[]
|
||||||
|
|
||||||
|
# A list of workspace-relative paths to the .fpd files that should be
|
||||||
|
# placed inside this far.
|
||||||
|
far.FpdFiles=[]
|
||||||
|
|
||||||
|
# A list of workspace-relative paths to the extra files that should be
|
||||||
|
# placed inside this far. Extra files are ones that are not part of
|
||||||
|
# an spd or msa or fpd.
|
||||||
|
far.ExtraFiles=["tools_def_for_this_package.template", "setup.sh"]
|
||||||
|
|
||||||
|
# vim:syntax=python
|
||||||
|
Loading…
x
Reference in New Issue
Block a user