mirror of
https://github.com/reactos/CMake.git
synced 2024-12-02 00:26:18 +00:00
CPack: enable all CMake policies for generator scripts
This commit is contained in:
parent
0fe1966b79
commit
93d5f464cc
@ -610,12 +610,7 @@ function(cpack_deb_prepare_package_vars)
|
||||
|
||||
if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OR CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS)
|
||||
# Generating binary list - Get type of all install files
|
||||
cmake_policy(PUSH)
|
||||
# Tell file(GLOB_RECURSE) not to follow directory symlinks
|
||||
# even if the project does not set this policy to NEW.
|
||||
cmake_policy(SET CMP0009 NEW)
|
||||
file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*")
|
||||
cmake_policy(POP)
|
||||
file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*")
|
||||
|
||||
find_program(FILE_EXECUTABLE file)
|
||||
if(NOT FILE_EXECUTABLE)
|
||||
@ -931,13 +926,10 @@ function(cpack_deb_prepare_package_vars)
|
||||
|
||||
if(CPACK_DEBIAN_ARCHIVE_TYPE)
|
||||
set(archive_types_ "paxr;gnutar")
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_)
|
||||
message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported"
|
||||
"type ${CPACK_DEBIAN_ARCHIVE_TYPE}")
|
||||
endif()
|
||||
cmake_policy(POP)
|
||||
if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_)
|
||||
message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported"
|
||||
"type ${CPACK_DEBIAN_ARCHIVE_TYPE}")
|
||||
endif()
|
||||
else()
|
||||
set(CPACK_DEBIAN_ARCHIVE_TYPE "paxr")
|
||||
endif()
|
||||
@ -1039,13 +1031,9 @@ function(cpack_deb_prepare_package_vars)
|
||||
set(CPACK_OUTPUT_FILE_NAME
|
||||
"${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
|
||||
else()
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0010 NEW)
|
||||
if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)")
|
||||
cmake_policy(POP)
|
||||
message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!")
|
||||
endif()
|
||||
cmake_policy(POP)
|
||||
if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)")
|
||||
message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!")
|
||||
endif()
|
||||
|
||||
set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}")
|
||||
endif()
|
||||
|
@ -962,7 +962,6 @@ function(get_file_permissions FILE RETURN_VAR)
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
string(REPLACE " " ";" permissions_ "${permissions_}")
|
||||
list(GET permissions_ 0 permissions_)
|
||||
|
||||
@ -1066,12 +1065,7 @@ function(cpack_rpm_prepare_relocation_paths)
|
||||
endforeach()
|
||||
|
||||
# warn about all the paths that are not relocatable
|
||||
cmake_policy(PUSH)
|
||||
# Tell file(GLOB_RECURSE) not to follow directory symlinks
|
||||
# even if the project does not set this policy to NEW.
|
||||
cmake_policy(SET CMP0009 NEW)
|
||||
file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*")
|
||||
cmake_policy(POP)
|
||||
file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*")
|
||||
foreach(TMP_PATH ${FILE_PATHS_})
|
||||
string(LENGTH "${WDIR}" WDIR_LEN)
|
||||
string(SUBSTRING "${TMP_PATH}" ${WDIR_LEN} -1 TMP_PATH)
|
||||
@ -1098,10 +1092,7 @@ endfunction()
|
||||
|
||||
function(cpack_rpm_prepare_content_list)
|
||||
# get files list
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0009 NEW)
|
||||
file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*")
|
||||
cmake_policy(POP)
|
||||
file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*")
|
||||
set(CPACK_RPM_INSTALL_FILES "/${CPACK_RPM_INSTALL_FILES}")
|
||||
string(REPLACE ";" ";/" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}")
|
||||
|
||||
@ -1120,10 +1111,7 @@ function(cpack_rpm_prepare_content_list)
|
||||
set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}")
|
||||
|
||||
string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS " ${_RPM_RELOCATION_PREFIX}")
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0007 NEW)
|
||||
list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
|
||||
cmake_policy(POP)
|
||||
list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1)
|
||||
unset(_TMP_LIST)
|
||||
# Now generate all of the parent dirs of the relocation path
|
||||
foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS})
|
||||
@ -1608,7 +1596,6 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR)
|
||||
endif()
|
||||
|
||||
get_file_permissions("${WORKING_DIR}/${F}" permissions_)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
if(NOT "USER_EXECUTE" IN_LIST permissions_ AND
|
||||
NOT "GROUP_EXECUTE" IN_LIST permissions_ AND
|
||||
NOT "WORLD_EXECUTE" IN_LIST permissions_)
|
||||
@ -1997,19 +1984,15 @@ function(cpack_rpm_generate_package)
|
||||
endif()
|
||||
|
||||
if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
# Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now
|
||||
# Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun)
|
||||
# Auto* is a special case because the tags can not be queried by querytags rpmbuild flag
|
||||
set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV)
|
||||
if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_)
|
||||
cmake_policy(POP)
|
||||
message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not "
|
||||
"supported in provided rpmbuild. Tag will not be used.")
|
||||
continue()
|
||||
endif()
|
||||
cmake_policy(POP)
|
||||
# Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now
|
||||
# Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun)
|
||||
# Auto* is a special case because the tags can not be queried by querytags rpmbuild flag
|
||||
set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV)
|
||||
if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_)
|
||||
message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not "
|
||||
"supported in provided rpmbuild. Tag will not be used.")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
if(CPACK_RPM_PACKAGE_DEBUG)
|
||||
message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}")
|
||||
@ -2301,12 +2284,9 @@ function(cpack_rpm_generate_package)
|
||||
continue()
|
||||
endif()
|
||||
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0009 NEW)
|
||||
file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE
|
||||
"${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}"
|
||||
"${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*")
|
||||
cmake_policy(POP)
|
||||
file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE
|
||||
"${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}"
|
||||
"${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*")
|
||||
|
||||
foreach(f_ IN LISTS files_for_move_)
|
||||
get_filename_component(dir_path_ "${f_}" DIRECTORY)
|
||||
@ -2438,13 +2418,9 @@ ${TMP_DEBUGINFO_ADDITIONAL_SOURCES}
|
||||
"CPACK_RPM_FILE_NAME")
|
||||
if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
|
||||
if(CPACK_RPM_FILE_NAME)
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0010 NEW)
|
||||
if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm")
|
||||
cmake_policy(POP)
|
||||
message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!")
|
||||
endif()
|
||||
cmake_policy(POP)
|
||||
if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm")
|
||||
message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!")
|
||||
endif()
|
||||
else()
|
||||
# old file name format for back compatibility
|
||||
string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}"
|
||||
@ -2762,13 +2738,8 @@ mv %_topdir/tmpBBroot $RPM_BUILD_ROOT
|
||||
endif()
|
||||
|
||||
# find generated rpm files and take their names
|
||||
cmake_policy(PUSH)
|
||||
# Tell file(GLOB_RECURSE) not to follow directory symlinks
|
||||
# even if the project does not set this policy to NEW.
|
||||
cmake_policy(SET CMP0009 NEW)
|
||||
file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
|
||||
"${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
|
||||
cmake_policy(POP)
|
||||
file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm"
|
||||
"${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm")
|
||||
|
||||
if(NOT GENERATED_FILES)
|
||||
message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}")
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmStateSnapshot.h"
|
||||
#include "cmVersion.h"
|
||||
#include "cmWorkingDirectory.h"
|
||||
#include "cmXMLSafe.h"
|
||||
#include "cmake.h"
|
||||
@ -988,10 +989,16 @@ int cmCPackGenerator::DoPackage()
|
||||
*/
|
||||
packageFileNames.push_back(tempPackageFileName ? tempPackageFileName : "");
|
||||
toplevel = tempDirectory;
|
||||
if (!this->PackageFiles() || cmSystemTools::GetErrorOccuredFlag()) {
|
||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem compressing the directory"
|
||||
<< std::endl);
|
||||
return 0;
|
||||
{ // scope that enables package generators to run internal scripts with
|
||||
// latest CMake policies enabled
|
||||
cmMakefile::ScopePushPop pp{ this->MakefileMap };
|
||||
this->MakefileMap->SetPolicyVersion(cmVersion::GetCMakeVersion());
|
||||
|
||||
if (!this->PackageFiles() || cmSystemTools::GetErrorOccuredFlag()) {
|
||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem compressing the directory"
|
||||
<< std::endl);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Prepare checksum algorithm*/
|
||||
|
Loading…
Reference in New Issue
Block a user