[cpack/jenkins-main] rework build tag generation to be at cpack time through LY_INSTALLER_AUTO_GEN_TAG
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
set(_target_name ${CMAKE_HOST_SYSTEM_NAME})
|
||||
if(${_target_name} STREQUAL Darwin)
|
||||
set(_target_name Mac)
|
||||
endif()
|
||||
|
||||
if(CPACK_AUTO_GEN_TAG)
|
||||
set(_python_script python.sh)
|
||||
if(${_target_name} STREQUAL WINDOWS)
|
||||
set(_python_script python.cmd)
|
||||
endif()
|
||||
|
||||
file(REAL_PATH "${CPACK_SOURCE_DIR}/.." _root_path)
|
||||
file(TO_NATIVE_PATH "${_root_path}/python/${_python_script}" _python_cmd)
|
||||
file(TO_NATIVE_PATH "${_root_path}/scripts/build/tools/generate_build_tag.py" _gen_tag_script)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${_python_cmd} -s -u ${_gen_tag_script}
|
||||
RESULT_VARIABLE _gen_tag_result
|
||||
OUTPUT_VARIABLE _gen_tag_output
|
||||
ERROR_VARIABLE _gen_tag_errors
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if (NOT ${_gen_tag_result} EQUAL 0)
|
||||
message(FATAL_ERROR "Failed to generate build tag!")
|
||||
endif()
|
||||
|
||||
set(_url_tag ${_gen_tag_output})
|
||||
else()
|
||||
set(_url_tag ${CPACK_PACKAGE_VERSION})
|
||||
endif()
|
||||
|
||||
set(_full_tag ${_url_tag}/${_target_name})
|
||||
|
||||
if(CPACK_DOWNLOAD_SITE)
|
||||
set(CPACK_DOWNLOAD_SITE ${CPACK_DOWNLOAD_SITE}/${_full_tag})
|
||||
endif()
|
||||
if(CPACK_UPLOAD_URL)
|
||||
set(CPACK_UPLOAD_URL ${CPACK_UPLOAD_URL}/${_full_tag})
|
||||
endif()
|
||||
Reference in New Issue
Block a user