Exemplo n.º 1
0
def CreateCCodeDB(FileNameList):
    FileObjList = []
    ParseErrorFileList = []

    for FullName in FileNameList:
        if os.path.splitext(FullName)[1] in ('.h', '.c'):
            EdkLogger.info("Parsing " + FullName)
            model = FullName.endswith(
                'c') and DataClass.MODEL_FILE_C or DataClass.MODEL_FILE_H
            collector = CodeFragmentCollector.CodeFragmentCollector(FullName)
            try:
                collector.ParseFile()
            except UnicodeError:
                ParseErrorFileList.append(FullName)
            BaseName = os.path.basename(FullName)
            DirName = os.path.dirname(FullName)
            Ext = os.path.splitext(BaseName)[1].lstrip('.')
            ModifiedTime = os.path.getmtime(FullName)
            FileObj = DataClass.FileClass(-1, BaseName, Ext, DirName,
                                          FullName, model, ModifiedTime,
                                          GetFunctionList(),
                                          GetIdentifierList(), [])
            FileObjList.append(FileObj)
            collector.CleanFileProfileBuffer()

    if len(ParseErrorFileList) > 0:
        EdkLogger.info("Found unrecoverable error during parsing:\n\t%s\n" %
                       "\n\t".join(ParseErrorFileList))

    Db = EotGlobalData.gDb
    for file in FileObjList:
        Db.InsertOneFile(file)

    Db.UpdateIdentifierBelongsToFunction()
Exemplo n.º 2
0
Arquivo: c.py Projeto: etiago/vbox
def CreateCCodeDB(FileNameList):
    FileObjList = []
    ParseErrorFileList = []
    ParsedFiles = {}
    for FullName in FileNameList:
        if os.path.splitext(FullName)[1] in ('.h', '.c'):
            if FullName.lower() in ParsedFiles:
                continue
            ParsedFiles[FullName.lower()] = 1
            EdkLogger.info("Parsing " + FullName)
            model = FullName.endswith('c') and DataClass.MODEL_FILE_C or DataClass.MODEL_FILE_H
            collector = CodeFragmentCollector.CodeFragmentCollector(FullName)
            try:
                collector.ParseFile()
            except:
                ParseErrorFileList.append(FullName)
            BaseName = os.path.basename(FullName)
            DirName = os.path.dirname(FullName)
            Ext = os.path.splitext(BaseName)[1].lstrip('.')
            ModifiedTime = os.path.getmtime(FullName)
            FileObj = DataClass.FileClass(-1, BaseName, Ext, DirName, FullName, model, ModifiedTime, GetFunctionList(), GetIdentifierList(), [])
            FileObjList.append(FileObj)
            collector.CleanFileProfileBuffer()

    if len(ParseErrorFileList) > 0:
        EdkLogger.info("Found unrecoverable error during parsing:\n\t%s\n" % "\n\t".join(ParseErrorFileList))

    Db = EotGlobalData.gDb
    for file in FileObjList:
        Db.InsertOneFile(file)

    Db.UpdateIdentifierBelongsToFunction()
Exemplo n.º 3
0
Arquivo: BPDG.py Projeto: lersek/edk2
def MyOptionParser():
    #
    # Process command line firstly.
    #
    parser = OptionParser(version="%s - Version %s" % (PROJECT_NAME, VERSION),
                          description='',
                          prog='BPDG',
                          usage=st.LBL_BPDG_USAGE
                          )
    parser.add_option('-d', '--debug', action='store', type="int", dest='debug_level',
                      help=st.MSG_OPTION_DEBUG_LEVEL)
    parser.add_option('-v', '--verbose', action='store_true', dest='opt_verbose',
                      help=st.MSG_OPTION_VERBOSE)
    parser.add_option('-q', '--quiet', action='store_true', dest='opt_quiet', default=False,
                      help=st.MSG_OPTION_QUIET)
    parser.add_option('-o', '--vpd-filename', action='store', dest='bin_filename',
                      help=st.MSG_OPTION_VPD_FILENAME)
    parser.add_option('-m', '--map-filename', action='store', dest='filename',
                      help=st.MSG_OPTION_MAP_FILENAME)
    parser.add_option('-f', '--force', action='store_true', dest='opt_force',
                      help=st.MSG_OPTION_FORCE)

    (options, args) = parser.parse_args()
    if len(args) == 0:
        EdkLogger.info("Please specify the filename.txt file which contain the VPD pcd info!")
        EdkLogger.info(parser.usage)
        sys.exit(1)
    return options, args
Exemplo n.º 4
0
def MyOptionParser():   
    #
    # Process command line firstly.
    #
    parser = OptionParser(version="%s - Version %s" % (PROJECT_NAME, VERSION),
                          description='',
                          prog='BPDG',
                          usage=st.LBL_BPDG_USAGE
                          )
    parser.add_option('-d', '--debug', action='store', type="int", dest='debug_level',
                      help=st.MSG_OPTION_DEBUG_LEVEL)
    parser.add_option('-v', '--verbose', action='store_true', dest='opt_verbose',
                      help=st.MSG_OPTION_VERBOSE)
    parser.add_option('-q', '--quiet', action='store_true', dest='opt_quiet', default=False,
                      help=st.MSG_OPTION_QUIET)
    parser.add_option('-o', '--vpd-filename', action='store', dest='bin_filename',
                      help=st.MSG_OPTION_VPD_FILENAME)
    parser.add_option('-m', '--map-filename', action='store', dest='filename',
                      help=st.MSG_OPTION_MAP_FILENAME)   
    parser.add_option('-f', '--force', action='store_true', dest='opt_force',
                      help=st.MSG_OPTION_FORCE)     
    
    (options, args) = parser.parse_args()
    if len(args) == 0:
        EdkLogger.info("Please specify the filename.txt file which contain the VPD pcd info!")
        EdkLogger.info(parser.usage)
        sys.exit(1)
    return options, args
Exemplo n.º 5
0
    def __init__(self):
        # Version and Copyright
        self.VersionNumber = ("1.0" + " Build " + gBUILD_VERSION)
        self.Version = "%prog Version " + self.VersionNumber
        self.Copyright = "Copyright (c) 2009 - 2018, Intel Corporation  All rights reserved."

        self.InitDefaultConfigIni()
        self.OutputFile = 'output.txt'
        self.ReportFile = 'Report.csv'
        self.ExceptionFile = 'exception.xml'
        self.IsInit = True
        self.ScanSourceCode = True
        self.ScanMetaData = True
        self.MetaFile = ''
        self.OnlyScan = None

        # Parse the options and args
        self.ParseOption()
        EdkLogger.info(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n")

        WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"]))
        os.environ["WORKSPACE"] = WorkspaceDir

        # set multiple workspace
        PackagesPath = os.getenv("PACKAGES_PATH")
        mws.setWs(WorkspaceDir, PackagesPath)

        GlobalData.gWorkspace = WorkspaceDir

        GlobalData.gGlobalDefines["WORKSPACE"]  = WorkspaceDir

        EdkLogger.info("Loading ECC configuration ... done")
        # Generate checkpoints list
        EccGlobalData.gConfig = Configuration(self.ConfigFile)

        # Generate exception list
        EccGlobalData.gException = ExceptionCheck(self.ExceptionFile)

        # Init Ecc database
        EccGlobalData.gDb = Database.Database(Database.DATABASE_PATH)
        EccGlobalData.gDb.InitDatabase(self.IsInit)

        #
        # Get files real name in workspace dir
        #
        GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace)

        # Build ECC database
#         self.BuildDatabase()
        self.DetectOnlyScanDirs()

        # Start to check
        self.Check()

        # Show report
        self.GenReport()

        # Close Database
        EccGlobalData.gDb.Close()
Exemplo n.º 6
0
    def __init__(self):
        # Version and Copyright
        self.VersionNumber = ("1.0" + " Build " + gBUILD_VERSION)
        self.Version = "%prog Version " + self.VersionNumber
        self.Copyright = "Copyright (c) 2009 - 2018, Intel Corporation  All rights reserved."

        self.InitDefaultConfigIni()
        self.OutputFile = 'output.txt'
        self.ReportFile = 'Report.csv'
        self.ExceptionFile = 'exception.xml'
        self.IsInit = True
        self.ScanSourceCode = True
        self.ScanMetaData = True
        self.MetaFile = ''
        self.OnlyScan = None

        # Parse the options and args
        self.ParseOption()
        EdkLogger.info(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n")

        WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"]))
        os.environ["WORKSPACE"] = WorkspaceDir

        # set multiple workspace
        PackagesPath = os.getenv("PACKAGES_PATH")
        mws.setWs(WorkspaceDir, PackagesPath)

        GlobalData.gWorkspace = WorkspaceDir

        GlobalData.gGlobalDefines["WORKSPACE"]  = WorkspaceDir

        EdkLogger.info("Loading ECC configuration ... done")
        # Generate checkpoints list
        EccGlobalData.gConfig = Configuration(self.ConfigFile)

        # Generate exception list
        EccGlobalData.gException = ExceptionCheck(self.ExceptionFile)

        # Init Ecc database
        EccGlobalData.gDb = Database.Database(Database.DATABASE_PATH)
        EccGlobalData.gDb.InitDatabase(self.IsInit)

        #
        # Get files real name in workspace dir
        #
        GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace)

        # Build ECC database
#         self.BuildDatabase()
        self.DetectOnlyScanDirs()

        # Start to check
        self.Check()

        # Show report
        self.GenReport()

        # Close Database
        EccGlobalData.gDb.Close()
Exemplo n.º 7
0
def ParseArgs():
    # Initialize the parser.
    Parser = argparse.ArgumentParser(
      description="Convert an AML file to a .hex file containing the AML " + \
                  "bytecode stored in a C array. By default, " + \
                  "\"Tables\\Dsdt.aml\" will generate" + \
                  "\"Tables\\Dsdt.hex\". \"Tables\\Dsdt.hex\" will " + \
                  "contain a C array named \"dsdt_aml_code\" that " + \
                  "contains the AML bytecode."
      )

    # Define the possible arguments.
    Parser.add_argument(
        dest="InputFile",
        help="Path to an input AML file to generate a .hex file from.")
    Parser.add_argument(
      "-o", "--out-dir", dest="OutDir",
      help="Output directory where the .hex file will be generated. " + \
           "Default is the input file's directory."
      )

    # Parse the input arguments.
    Args = Parser.parse_args()
    SplitInputName = ""

    if not os.path.exists(Args.InputFile):
        EdkLogger.error(__file__, FILE_OPEN_FAILURE, ExtraData=Args.InputFile)
        return None
    else:
        with open(Args.InputFile, "rb") as fIn:
            Signature = str(fIn.read(4))
            if ("DSDT" not in Signature) and ("SSDT" not in Signature):
                EdkLogger.info("Invalid file type. " + \
                                "File does not have a valid " + \
                                "DSDT or SSDT signature: %s" % Args.InputFile)
                return None

    # Get the basename of the input file.
    SplitInputName = os.path.splitext(Args.InputFile)
    BaseName = os.path.basename(SplitInputName[0])

    # If no output directory is specified, output to the input directory.
    if not Args.OutDir:
        Args.OutputFile = os.path.join(os.path.dirname(Args.InputFile),
                                       BaseName + ".hex")
    else:
        if not os.path.exists(Args.OutDir):
            os.mkdir(Args.OutDir)
        Args.OutputFile = os.path.join(Args.OutDir, BaseName + ".hex")

    Args.BaseName = BaseName

    return Args
Exemplo n.º 8
0
def ParseArgs():
    # Initialize the parser.
    Parser = argparse.ArgumentParser(description=__description__)

    # Define the possible arguments.
    Parser.add_argument(
        dest="InputFile",
        help="Path to an input AML file to generate a .c file from.")
    Parser.add_argument(
        "-o",
        "--out-dir",
        dest="OutDir",
        help=
        "Output directory where the .c file will be generated. Default is the input file's directory."
    )

    # Parse the input arguments.
    Args = Parser.parse_args()
    SplitInputName = ""

    if not os.path.exists(Args.InputFile):
        EdkLogger.error(__file__, FILE_OPEN_FAILURE, ExtraData=Args.InputFile)
        return None
    else:
        with open(Args.InputFile, "rb") as fIn:
            Signature = str(fIn.read(4))
            if ("DSDT" not in Signature) and ("SSDT" not in Signature):
                EdkLogger.info(
                    "Invalid file type. File does not have a valid DSDT or SSDT signature: {}"
                    .format(Args.InputFile))
                return None

    # Get the basename of the input file.
    SplitInputName = os.path.splitext(Args.InputFile)
    BaseName = os.path.basename(SplitInputName[0])

    # If no output directory is specified, output to the input directory.
    if not Args.OutDir:
        Args.OutputFile = os.path.join(os.path.dirname(Args.InputFile),
                                       BaseName + ".c")
    else:
        if not os.path.exists(Args.OutDir):
            os.mkdir(Args.OutDir)
        Args.OutputFile = os.path.join(Args.OutDir, BaseName + ".c")

    Args.BaseName = BaseName

    return Args
Exemplo n.º 9
0
def StartBpdg(InputFileName, MapFileName, VpdFileName, Force):
    if os.path.exists(VpdFileName) and not Force:
        print "\nFile %s already exist, Overwrite(Yes/No)?[Y]: " % VpdFileName
        choice = sys.stdin.readline()
        if choice.strip().lower() not in ['y', 'yes', '']:
            return

    GenVPD = GenVpd.GenVPD(InputFileName, MapFileName, VpdFileName)

    EdkLogger.info('%-24s = %s' % ("VPD input data file: ", InputFileName))
    EdkLogger.info('%-24s = %s' % ("VPD output map file: ", MapFileName))
    EdkLogger.info('%-24s = %s' % ("VPD output binary file: ", VpdFileName))

    GenVPD.ParserInputFile()
    GenVPD.FormatFileLine()
    GenVPD.FixVpdOffset()
    GenVPD.GenerateVpdFile(MapFileName, VpdFileName)

    EdkLogger.info("- Vpd pcd fixed done! -")
Exemplo n.º 10
0
Arquivo: BPDG.py Projeto: lersek/edk2
def StartBpdg(InputFileName, MapFileName, VpdFileName, Force):
    if os.path.exists(VpdFileName) and not Force:
        print("\nFile %s already exist, Overwrite(Yes/No)?[Y]: " % VpdFileName)
        choice = sys.stdin.readline()
        if choice.strip().lower() not in ['y', 'yes', '']:
            return

    GenVPD = GenVpd.GenVPD (InputFileName, MapFileName, VpdFileName)

    EdkLogger.info('%-24s = %s' % ("VPD input data file: ", InputFileName))
    EdkLogger.info('%-24s = %s' % ("VPD output map file: ", MapFileName))
    EdkLogger.info('%-24s = %s' % ("VPD output binary file: ", VpdFileName))

    GenVPD.ParserInputFile()
    GenVPD.FormatFileLine()
    GenVPD.FixVpdOffset()
    GenVPD.GenerateVpdFile(MapFileName, VpdFileName)

    EdkLogger.info("- Vpd pcd fixed done! -")
Exemplo n.º 11
0
 def InfLogger(msg):
     EdkLogger.info(msg)
 def InfLogger (msg):
     EdkLogger.info(msg)
Exemplo n.º 13
0
#
def Write(Target, Item):
    return ''.join([Target, Item])


#
# Write an item with a break line
#
def WriteLine(Target, Item):
    return ''.join([Target, Item, '\n'])


# This acts like the main() function for the script, unless it is 'import'ed into another
# script.
if __name__ == '__main__':
    EdkLogger.info('start')

    UniFileList = [r'C:\\Edk\\Strings2.uni', r'C:\\Edk\\Strings.uni']

    SrcFileList = []
    for Root, Dirs, Files in os.walk('C:\\Edk'):
        for File in Files:
            SrcFileList.append(File)

    IncludeList = [r'C:\\Edk']

    SkipList = ['.inf', '.uni']
    BaseName = 'DriverSample'
    (h, c) = GetStringFiles(UniFileList, SrcFileList, IncludeList, SkipList,
                            BaseName, True)
    hfile = open('unistring.h', 'w')
Exemplo n.º 14
0
#
# Write an item
#
def Write(Target, Item):
    return ''.join([Target, Item])

#
# Write an item with a break line
#
def WriteLine(Target, Item):
    return ''.join([Target, Item, '\n'])

# This acts like the main() function for the script, unless it is 'import'ed into another
# script.
if __name__ == '__main__':
    EdkLogger.info('start')

    UniFileList = [
                   r'C:\\Edk\\Strings2.uni',
                   r'C:\\Edk\\Strings.uni'
    ]

    SrcFileList = []
    for Root, Dirs, Files in os.walk('C:\\Edk'):
        for File in Files:
            SrcFileList.append(File)

    IncludeList = [
                   r'C:\\Edk'
    ]
Exemplo n.º 15
0
#
def Write(Target, Item):
    return "".join([Target, Item])


#
# Write an item with a break line
#
def WriteLine(Target, Item):
    return "".join([Target, Item, "\n"])


# This acts like the main() function for the script, unless it is 'import'ed into another
# script.
if __name__ == "__main__":
    EdkLogger.info("start")

    UniFileList = [r"C:\\Edk\\Strings2.uni", r"C:\\Edk\\Strings.uni"]

    SrcFileList = []
    for Root, Dirs, Files in os.walk("C:\\Edk"):
        for File in Files:
            SrcFileList.append(File)

    IncludeList = [r"C:\\Edk"]

    SkipList = [".inf", ".uni"]
    BaseName = "DriverSample"
    (h, c) = GetStringFiles(UniFileList, SrcFileList, IncludeList, SkipList, BaseName, True)
    hfile = open("unistring.h", "w")
    cfile = open("unistring.c", "w")
Exemplo n.º 16
0
def Main():
    EdkLogger.Initialize()
    Options = None
    DistFileName = 'dist.pkg'
    ContentFileName = 'content.zip'
    DistFile, ContentZipFile, UnpackDir = None, None, None
    
    Options = MyOptionParser()
    try:
        if Options.LogLevel < EdkLogger.DEBUG_9:
            EdkLogger.SetLevel(Options.LogLevel + 1)
        else:
            EdkLogger.SetLevel(Options.LogLevel)

        CheckEnvVariable()
        WorkspaceDir = os.environ["WORKSPACE"]
        if not Options.PackageFile:
            EdkLogger.error("InstallPkg", OPTION_NOT_SUPPORTED, ExtraData="Must specify one distribution package")

        # unzip dist.pkg file
        EdkLogger.quiet("Unzipping and parsing distribution package XML file ... ")
        DistFile = PackageFile(Options.PackageFile)
        UnpackDir = os.path.normpath(os.path.join(WorkspaceDir, ".tmp"))
        DistPkgFile = DistFile.UnpackFile(DistFileName, os.path.normpath(os.path.join(UnpackDir, DistFileName)))
        if not DistPkgFile:
            EdkLogger.error("InstallPkg", FILE_NOT_FOUND, "File [%s] is broken in distribution package" %DistFileName)
        
        # Generate distpkg
        DistPkgObj = DistributionPackageXml()
        DistPkg = DistPkgObj.FromXml(DistPkgFile)

        # prepare check dependency
        Db = IpiDatabase(os.path.normpath(os.path.join(WorkspaceDir, "Conf/DistributionPackageDatabase.db")))
        Db.InitDatabase()
        Dep = DependencyRules(Db)
        
        # Check distribution package exist
        if Dep.CheckDpExists(DistPkg.Header.Guid, DistPkg.Header.Version):
            EdkLogger.error("InstallPkg", UNKNOWN_ERROR, "This distribution package has been installed", ExtraData=DistPkg.Header.Name)
        
        # unzip contents.zip file
        ContentFile = DistFile.UnpackFile(ContentFileName, os.path.normpath(os.path.join(UnpackDir, ContentFileName)))
        ContentZipFile = PackageFile(ContentFile)
        if not ContentFile:
            EdkLogger.error("InstallPkg", FILE_NOT_FOUND, "File [%s] is broken in distribution package" %ContentFileName)
        
        # verify MD5 signature
        Md5Sigature = md5.new(open(ContentFile).read())
        if DistPkg.Header.Signature != Md5Sigature.hexdigest():
            EdkLogger.error("InstallPkg", FILE_CHECKSUM_FAILURE, ExtraData=ContentFile)
        
        # Check package exist and install
        for Guid,Version,Path in DistPkg.PackageSurfaceArea:
            PackagePath = os.path.dirname(Path)
            NewPackagePath = PackagePath
            Package = DistPkg.PackageSurfaceArea[Guid,Version,Path]
            EdkLogger.info("Installing package ... %s" % Package.PackageHeader.Name)
            if Dep.CheckPackageExists(Guid, Version):
                EdkLogger.quiet("Package [%s] has been installed" %Path)
            NewPackagePath = InstallNewPackage(WorkspaceDir, PackagePath)
            Package.FileList = []
            for Item in Package.MiscFiles.Files:
                FromFile = os.path.join(PackagePath, Item.Filename)
                ToFile = os.path.normpath(os.path.join(WorkspaceDir, NewPackagePath, Item.Filename))
                ContentZipFile.UnpackFile(FromFile, ToFile)
                Package.FileList.append(ToFile)
            
            # Update package
            Package.PackageHeader.CombinePath = Package.PackageHeader.CombinePath.replace(PackagePath, NewPackagePath, 1)
            # Update modules of package
            Module = None
            for ModuleGuid, ModuleVersion, ModulePath in Package.Modules:
                Module = Package.Modules[ModuleGuid, ModuleVersion, ModulePath]
                NewModulePath = ModulePath.replace(PackagePath, NewPackagePath, 1)
                del Package.Modules[ModuleGuid, ModuleVersion, ModulePath]
                Package.Modules[ModuleGuid, ModuleVersion, NewModulePath] = Module
            del DistPkg.PackageSurfaceArea[Guid,Version,Path]
            DistPkg.PackageSurfaceArea[Guid,Version,Package.PackageHeader.CombinePath] = Package

#            SaveFileOnChange(os.path.join(Options.InstallDir, ModulePath, Module.Header.Name, ".inf"), Inf.ModuleToInf(Module), False)
#            EdkLogger.info("Installing package ... %s" % Package.Header.Name)
#            shutil.copytree(os.path.join(ContentFileDir, Path), Options.InstallDir)
#            SaveFileOnChange(os.path.join(Options.InstallDir, Path, Package.Header.Name, ".dec"), Dec.PackageToDec(Package), False)

        # Check module exist and install
        Module = None
        for Guid,Version,Path in DistPkg.ModuleSurfaceArea:
            ModulePath = os.path.dirname(Path)
            NewModulePath = ModulePath
            Module = DistPkg.ModuleSurfaceArea[Guid,Version,Path]
            EdkLogger.info("Installing module ... %s" % Module.ModuleHeader.Name)
            if Dep.CheckModuleExists(Guid, Version):
                EdkLogger.quiet("Module [%s] has been installed" %Path)
            NewModulePath = InstallNewPackage(WorkspaceDir, ModulePath)
            Module.FileList = []
            for Item in Module.MiscFiles.Files:
                ModulePath = ModulePath[os.path.normpath(ModulePath).rfind(os.path.normpath('/'))+1:]
                FromFile = os.path.join(ModulePath, Item.Filename)
                ToFile = os.path.normpath(os.path.join(WorkspaceDir, NewModulePath, Item.Filename))
                ContentZipFile.UnpackFile(FromFile, ToFile)
                Module.FileList.append(ToFile)
            
#            EdkLogger.info("Installing module ... %s" % Module.Header.Name)
#            shutil.copytree(os.path.join(ContentFileDir, Path), Options.InstallDir)
#            SaveFileOnChange(os.path.join(Options.InstallDir, Path, Module.Header.Name, ".inf"), Inf.ModuleToInf(Module), False)
            
            # Update module
            Module.ModuleHeader.CombinePath = Module.ModuleHeader.CombinePath.replace(os.path.dirname(Path), NewModulePath, 1)
            del DistPkg.ModuleSurfaceArea[Guid,Version,Path]
            DistPkg.ModuleSurfaceArea[Guid,Version,Module.ModuleHeader.CombinePath] = Module
#            
#        
#        for Guid,Version,Path in DistPkg.PackageSurfaceArea:
#            print Guid,Version,Path
#            for item in DistPkg.PackageSurfaceArea[Guid,Version,Path].FileList:
#                print item
#        for Guid,Version,Path in DistPkg.ModuleSurfaceArea:
#            print Guid,Version,Path
#            for item in DistPkg.ModuleSurfaceArea[Guid,Version,Path].FileList:
#                print item

        if Options.Tools:
            EdkLogger.info("Installing tools ... ")
            for File in DistPkg.Tools.Files:
                FromFile = File.Filename
                ToFile = InstallNewFile(WorkspaceDir, FromFile)
                ContentZipFile.UnpackFile(FromFile, ToFile)
        if Options.MiscFiles:
            EdkLogger.info("Installing misc files ... ")
            for File in DistPkg.MiscellaneousFiles.Files:
                FromFile = File.Filename
                ToFile = InstallNewFile(WorkspaceDir, FromFile)
                ContentZipFile.UnpackFile(FromFile, ToFile)

        # update database
        EdkLogger.quiet("Update Distribution Package Database ...")
        Db.AddDPObject(DistPkg)

    except FatalError, X:
        if Options and Options.LogLevel < EdkLogger.DEBUG_9:
            EdkLogger.quiet("(Python %s on %s) " % (platform.python_version(), sys.platform) + traceback.format_exc())
        ReturnCode = X.args[0]