## @file
# Install distribution package.
#
# 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.
#
'''
MkPkg
'''
##
# Import Modules
#
import md5
## CheckForExistingDp
#
# Check if there is a same name DP file existing
# @param Path: The path to be checked
#
## Tool entrance method
#
# This method mainly dispatch specific methods per the command line options.
# If no error found, return zero value so the caller of this tool can know
# if it's executed successfully or not.
#
#
if Options == None:
try:
#
# Init PackFileToCreate
#
if not Options.PackFileToCreate:
#
# Handle if the distribution package file already exists
#
#
# Check package file existing and valid
#
CheckFileList('.DEC', Options.PackageFileList, ST.ERR_INVALID_PACKAGE_NAME, ST.ERR_INVALID_PACKAGE_PATH)
#
# Check module file existing and valid
#
CheckFileList('.INF', Options.ModuleFileList, ST.ERR_INVALID_MODULE_NAME, ST.ERR_INVALID_MODULE_PATH)
#
# Get list of files that installed with RePackage attribute available
#
#
# Add temp distribution header
#
#
# before pack, current dir should be workspace dir, else the full
# path will be in the pack file
#
FileList = []
if ToolObject:
if MiscObject:
for FileObject in FileList:
#
# If you have unicode file names, please convert them to byte
# strings in your desired encoding before passing them to
# write().
#
if FileFullPath in RePkgDict:
if not Repackage:
)
else:
#
# Add init dp information
#
else:
#
# check whether file was included in a distribution that can not
# be repackaged
#
if FileFullPath in RePkgDict:
if not Repackage:
ExtraData = \
)
else:
#
# Add Md5Sigature
#
#
# Add current Date
#
#
# Finish final dp file
#
ReturnCode = 0
except FatalError, XExcept:
except KeyboardInterrupt:
except OSError:
pass
except:
"\nMkPkg",
)
finally:
if not ContentFileClosed:
return ReturnCode
## CheckFileList
#
# @param QualifiedExt: QualifiedExt
# @param FileList: FileList
# @param ErrorStringExt: ErrorStringExt
# @param ErrorStringFullPath: ErrorStringFullPath
#
if not FileList:
return