summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2024-04-05 14:02:39 +0000
committerDavid Kalnischkies <david@kalnischkies.de>2024-04-24 13:16:21 +0000
commit3e24f431d9527816820e103df7db9f39062b551d (patch)
tree857d53b421f8982edabe4a2c0ba6a7b85b7c845d
parentedfbc3869361f709d70794a794199ac2076ea9f1 (diff)
Do not ignore if a cmake execute_process fails
Ignoring errors might lead to failures later on anyhow, but especially with triehash it could also lead to broken builds or other crazy stuff, so lets better be save than sorry.
-rw-r--r--CMake/vendor_substitute.cmake3
-rw-r--r--CMakeLists.txt9
-rw-r--r--apt-pkg/CMakeLists.txt12
-rw-r--r--vendor/CMakeLists.txt3
4 files changed, 18 insertions, 9 deletions
diff --git a/CMake/vendor_substitute.cmake b/CMake/vendor_substitute.cmake
index 71449c9e8..277cb3ac9 100644
--- a/CMake/vendor_substitute.cmake
+++ b/CMake/vendor_substitute.cmake
@@ -2,7 +2,8 @@ file(READ ${IN} input)
foreach(variable ${VARS})
execute_process(COMMAND ${PROJECT_SOURCE_DIR}/vendor/getinfo
--vendor ${CURRENT_VENDOR} ${variable}
- OUTPUT_VARIABLE value OUTPUT_STRIP_TRAILING_WHITESPACE)
+ OUTPUT_VARIABLE value OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND_ERROR_IS_FATAL ANY)
string(REPLACE "&${variable};" "${value}" input "${input}")
endforeach()
file(WRITE ${OUT} "${input}")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00ba2e499..11b614af5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -211,17 +211,20 @@ string(REGEX MATCH "^[0-9.]+" PROJECT_VERSION ${PACKAGE_VERSION})
if (NOT DEFINED DPKG_DATADIR)
execute_process(COMMAND ${PERL_EXECUTABLE} -MDpkg -e "print $Dpkg::DATADIR;"
- OUTPUT_VARIABLE DPKG_DATADIR_CMD OUTPUT_STRIP_TRAILING_WHITESPACE)
+ OUTPUT_VARIABLE DPKG_DATADIR_CMD OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND_ERROR_IS_FATAL ANY)
message(STATUS "Found dpkg data dir: ${DPKG_DATADIR_CMD}")
set(DPKG_DATADIR "${DPKG_DATADIR_CMD}" CACHE PATH "dpkg data directory")
endif()
if (NOT DEFINED COMMON_ARCH)
execute_process(COMMAND dpkg-architecture -qDEB_HOST_ARCH
- OUTPUT_VARIABLE COMMON_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
+ OUTPUT_VARIABLE COMMON_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND_ERROR_IS_FATAL ANY)
endif()
if (NOT DEFINED ROOT_GROUP)
execute_process(COMMAND id -gn root
- OUTPUT_VARIABLE ROOT_GROUP OUTPUT_STRIP_TRAILING_WHITESPACE)
+ OUTPUT_VARIABLE ROOT_GROUP OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND_ERROR_IS_FATAL ANY)
message(STATUS "Found root group: ${ROOT_GROUP}")
endif()
set(ROOT_GROUP "${ROOT_GROUP}" CACHE STRING "Group of root (e.g.: wheel or root)")
diff --git a/apt-pkg/CMakeLists.txt b/apt-pkg/CMakeLists.txt
index d13aed96c..63052faad 100644
--- a/apt-pkg/CMakeLists.txt
+++ b/apt-pkg/CMakeLists.txt
@@ -3,7 +3,8 @@ include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/include/apt-pkg/)
execute_process(COMMAND grep -v "^#" "${CMAKE_CURRENT_SOURCE_DIR}/tagfile-keys.list"
- OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.clean.list")
+ OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.clean.list"
+ COMMAND_ERROR_IS_FATAL ANY)
execute_process(COMMAND ${TRIEHASH_EXECUTABLE}
--ignore-case
--header ${PROJECT_BINARY_DIR}/include/apt-pkg/tagfile-keys.h
@@ -13,7 +14,8 @@ execute_process(COMMAND ${TRIEHASH_EXECUTABLE}
--function-name pkgTagHash
--include "<apt-pkg/tagfile.h>"
--include "<apt-pkg/header-is-private.h>"
- "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.clean.list")
+ "${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.clean.list"
+ COMMAND_ERROR_IS_FATAL ANY)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "tagfile-keys.list")
set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.cc" PROPERTIES COMPILE_DEFINITIONS APT_COMPILING_APT)
@@ -22,11 +24,13 @@ set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/tagfile-keys.cc" PROPER
execute_process(COMMAND awk -v ORS=. "/^\#define APT_PKG_M/ {print \$3}"
COMMAND sed "s/\\.\$//"
INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/macros.h
- OUTPUT_VARIABLE MAJOR OUTPUT_STRIP_TRAILING_WHITESPACE)
+ OUTPUT_VARIABLE MAJOR OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND_ERROR_IS_FATAL ANY)
execute_process(COMMAND grep "^#define APT_PKG_RELEASE"
COMMAND cut -d " " -f 3
INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/macros.h
- OUTPUT_VARIABLE MINOR OUTPUT_STRIP_TRAILING_WHITESPACE)
+ OUTPUT_VARIABLE MINOR OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND_ERROR_IS_FATAL ANY)
message(STATUS "Building libapt-pkg ${MAJOR} (release ${MINOR})")
set(APT_PKG_MAJOR ${MAJOR} PARENT_SCOPE) # exporting for methods/CMakeLists.txt
diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt
index f6d88690a..615d282da 100644
--- a/vendor/CMakeLists.txt
+++ b/vendor/CMakeLists.txt
@@ -1,7 +1,8 @@
# Determine the current vendor, export to CURRENT_VENDOR
if (NOT DEFINED CURRENT_VENDOR)
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getinfo current
- OUTPUT_VARIABLE CURRENT_VENDOR_OUT OUTPUT_STRIP_TRAILING_WHITESPACE)
+ OUTPUT_VARIABLE CURRENT_VENDOR_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
+ COMMAND_ERROR_IS_FATAL ANY)
set(CURRENT_VENDOR "${CURRENT_VENDOR_OUT}" CACHE STRING "Select the system vendor")
message(STATUS "Detected vendor: ${CURRENT_VENDOR_OUT}")