## @file
#
# This file is the main entry for UPT
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
'''
UPT
'''
## import modules
#
import sys
import MkPkg
import InstallPkg
import RmPkg
##
# Version and Copyright
#
#VersionNumber = "1.0"
#__version__ = "Revision " + VersionNumber
#__copyright__ = "Copyright (c) 2011 Intel Corporation All Rights Reserved."
## CheckConflictOption
#
# CheckConflictOption
#
## SetLogLevel
#
if Opt.opt_verbose:
elif Opt.debug_level != None:
else:
elif Opt.opt_slient:
else:
## Main
#
# Main
#
def Main():
Parser.add_option("-d", "--debug", action="store", type="int", dest="debug_level", help=ST.HLP_PRINT_DEBUG_INFO)
Parser.add_option("-s", "--silent", action="store_true", dest="opt_slient", help=ST.HLP_RETURN_NO_DISPLAY)
Parser.add_option("-q", "--quiet", action="store_true", dest="opt_quiet", help=ST.HLP_RETURN_AND_DISPLAY)
Parser.add_option("-i", "--install", action="store", type="string", dest="Install_Distribution_Package_File",
Parser.add_option("-c", "--create", action="store", type="string", dest="Create_Distribution_Package_File",
Parser.add_option("-r", "--remove", action="store", type="string", dest="Remove_Distribution_Package_File",
Parser.add_option("-t", "--template", action="store", type="string", dest="Package_Information_Data_File",
Parser.add_option("-n", "--custom-path", action="store_true", dest="CustomPath", help=ST.HLP_CUSTOM_PATH_PROMPT)
Parser.add_option("-x", "--free-lock", action="store_true", dest="SkipLock", help=ST.HLP_SKIP_LOCK_CHECK)
Var2Var = [
]
try:
except FatalError, XExcept:
GlobalData.gDB = IpiDatabase(os.path.normpath(os.path.join(WorkspaceDir, "Conf/DistributionPackageDatabase.db")))
#
# Make sure the Db will get closed correctly
#
try:
ReturnCode = 0
RunModule = None
if Opt.PackFileToCreate:
else:
else:
Logger.Error("CreatePkg", FILE_TYPE_MISMATCH, ExtraData=ST.ERR_DIST_EXT_ERROR % Opt.PackFileToCreate)
elif Opt.PackFileToInstall:
Logger.Error("InstallPkg", FILE_TYPE_MISMATCH, ExtraData=ST.ERR_DIST_EXT_ERROR % Opt.PackFileToInstall)
#
# check file existence, if not absolute path, then try current working directory, then $(WORKSPACE)
#
else:
if Existed:
if not Existed:
elif Opt.PackFileToRemove:
Logger.Error("RemovePkg", FILE_TYPE_MISMATCH, ExtraData=ST.ERR_DIST_EXT_ERROR % Opt.PackFileToRemove)
else:
return OPTION_MISSING
except FatalError, XExcept:
format_exc())
finally:
return ReturnCode
if __name__ == '__main__':
#
# 0-127 is a safe return range, and 1 is a standard default error
#