Skip to content

Commit

Permalink
Set the proper rpkg version
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcima committed Jul 14, 2022
1 parent b30c4c4 commit fedd7a9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@ math(EXPR PROJECT_LETTER_VERSION "97+${PROJECT_VERSION_PATCH}")
string(ASCII "${PROJECT_LETTER_VERSION}" PROJECT_LETTER_VERSION)
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}${PROJECT_LETTER_VERSION}")

####
# rpkg version

function(smf_dsp_update_rpkg_version SPEC LEAD FOLLOW)
file(READ "${SPEC}" text)
set(expr "((^|\n|\r)Version[ \t]*:[ \t]*)[^\n\r]*")
string(REGEX MATCH "${expr}" match "${text}")
if(match STREQUAL "")
message(FATAL_ERROR "The spec file does not have a \"Version\" field.")
endif()
string(REGEX REPLACE
"${expr}" "\\1{{{ git_dir_version lead=\"${LEAD}\" follow=\"${FOLLOW}\" }}}"
new_text "${text}")
if(NOT text STREQUAL new_text)
file(WRITE "${SPEC}" "${new_text}")
endif()
endfunction()

smf_dsp_update_rpkg_version(
"${PROJECT_SOURCE_DIR}/smf-dsp.rpkg.spec"
"${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}"
"${PROJECT_VERSION_PATCH}")

###
set(CMAKE_CXX_STANDARD "14")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

Expand Down
2 changes: 1 addition & 1 deletion smf-dsp.rpkg.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: {{{ git_dir_name }}}

Version: {{{ git_dir_version }}}
Version: {{{ git_dir_version lead="0.10" follow="0" }}}

Release: 1%{?dist}

Expand Down

0 comments on commit fedd7a9

Please sign in to comment.