aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake/Modules/UHDPackage.cmake
diff options
context:
space:
mode:
authormattprost <matt.prost@ni.com>2022-04-29 14:47:09 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2022-06-10 13:24:04 -0500
commit72e6df51de5a766889fedcb9970dedd7fcfda6e8 (patch)
treed16c5a7d1b27710e740775752293c12b62e77ab3 /host/cmake/Modules/UHDPackage.cmake
parentcb8fa61a5bcc576224ab8afa80ed712c31ddd629 (diff)
downloaduhd-72e6df51de5a766889fedcb9970dedd7fcfda6e8.tar.gz
uhd-72e6df51de5a766889fedcb9970dedd7fcfda6e8.tar.bz2
uhd-72e6df51de5a766889fedcb9970dedd7fcfda6e8.zip
cmake: Add support for fedora rpm versioning
Adds cmake option for replacing dashes in the UHD Component version with underscores. This is necessary as Fedora package management is now enforcing the format <Package>-<Version>-<Release> for all rpm builds, so dashes in the UHD_VERSION from dev branches is not supported. Signed-off-by: mattprost <matt.prost@ni.com>
Diffstat (limited to 'host/cmake/Modules/UHDPackage.cmake')
-rw-r--r--host/cmake/Modules/UHDPackage.cmake34
1 files changed, 18 insertions, 16 deletions
diff --git a/host/cmake/Modules/UHDPackage.cmake b/host/cmake/Modules/UHDPackage.cmake
index f02bd3ca1..ce9f04be7 100644
--- a/host/cmake/Modules/UHDPackage.cmake
+++ b/host/cmake/Modules/UHDPackage.cmake
@@ -40,22 +40,23 @@ endif()
# Setup package file name
########################################################################
if(REDHAT)
- find_program(LSB_RELEASE_EXECUTABLE lsb_release)
-
- if(LSB_RELEASE_EXECUTABLE)
- #extract system information by executing the commands
- execute_process(
- COMMAND ${LSB_RELEASE_EXECUTABLE} --short --id
- OUTPUT_VARIABLE LSB_ID OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- execute_process(
- COMMAND ${LSB_RELEASE_EXECUTABLE} --short --release
- OUTPUT_VARIABLE LSB_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE
- )
-
- #set a more sensible package name for this system
- set(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_${LSB_ID}-${LSB_RELEASE}-${CMAKE_SYSTEM_PROCESSOR}" CACHE INTERNAL "")
- endif(LSB_RELEASE_EXECUTABLE)
+ #extract system information by executing the commands
+ execute_process(
+ COMMAND bash -c "source /etc/os-release && echo $ID"
+ OUTPUT_VARIABLE OS_ID OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ execute_process(
+ COMMAND bash -c "source /etc/os-release && echo $VERSION_ID"
+ OUTPUT_VARIABLE VERSION_ID OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ #set a more sensible package name for this system
+ if(UHD_RELEASE_MODE)
+ string(REGEX REPLACE "(.release)$" "" uhd_vers_pretty ${UHD_VERSION})
+ set(CPACK_PACKAGE_FILE_NAME "uhd-${uhd_vers_pretty}-${OS_ID}${VERSION_ID}" CACHE INTERNAL "")
+ else()
+ set(CPACK_PACKAGE_FILE_NAME "uhd-${UHD_VERSION}-${OS_ID}${VERSION_ID}" CACHE INTERNAL "")
+ endif()
endif(REDHAT)
if(${CPACK_GENERATOR} STREQUAL NSIS)
@@ -152,6 +153,7 @@ set(CPACK_COMPONENTS_ALL libraries pythonapi headers utilities examples manual d
set(CPACK_RPM_SPEC_MORE_DEFINE "%global __python %{__python3}")
set(CPACK_RPM_PACKAGE_REQUIRES "boost-devel, python3-requests")
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/share/man;/usr/share/man/man1;/usr/lib64/pkgconfig;/usr/lib64/cmake;/usr/lib64/python2.7;/usr/lib64/python2.7/site-packages")
+set(CPACK_RPM_FILE_NAME "$CACHE{CPACK_PACKAGE_FILE_NAME}.rpm")
foreach(filename post_install post_uninstall pre_install pre_uninstall)
string(TOUPPER ${filename} filename_upper)
list(APPEND CPACK_RPM_${filename_upper}_SCRIPT_FILE ${UHD_BINARY_DIR}/redhat/${filename})