Skip to content

Commit fedd7a9

Browse files
committed
Set the proper rpkg version
1 parent b30c4c4 commit fedd7a9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

CMakeLists.txt

+24
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@ math(EXPR PROJECT_LETTER_VERSION "97+${PROJECT_VERSION_PATCH}")
1212
string(ASCII "${PROJECT_LETTER_VERSION}" PROJECT_LETTER_VERSION)
1313
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}${PROJECT_LETTER_VERSION}")
1414

15+
####
16+
# rpkg version
17+
18+
function(smf_dsp_update_rpkg_version SPEC LEAD FOLLOW)
19+
file(READ "${SPEC}" text)
20+
set(expr "((^|\n|\r)Version[ \t]*:[ \t]*)[^\n\r]*")
21+
string(REGEX MATCH "${expr}" match "${text}")
22+
if(match STREQUAL "")
23+
message(FATAL_ERROR "The spec file does not have a \"Version\" field.")
24+
endif()
25+
string(REGEX REPLACE
26+
"${expr}" "\\1{{{ git_dir_version lead=\"${LEAD}\" follow=\"${FOLLOW}\" }}}"
27+
new_text "${text}")
28+
if(NOT text STREQUAL new_text)
29+
file(WRITE "${SPEC}" "${new_text}")
30+
endif()
31+
endfunction()
32+
33+
smf_dsp_update_rpkg_version(
34+
"${PROJECT_SOURCE_DIR}/smf-dsp.rpkg.spec"
35+
"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
36+
"${PROJECT_VERSION_PATCH}")
37+
38+
###
1539
set(CMAKE_CXX_STANDARD "14")
1640
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
1741

smf-dsp.rpkg.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Name: {{{ git_dir_name }}}
22

3-
Version: {{{ git_dir_version }}}
3+
Version: {{{ git_dir_version lead="0.10" follow="0" }}}
44

55
Release: 1%{?dist}
66

0 commit comments

Comments
 (0)