Skip to content

Commit

Permalink
fix: support pacman epoch in DetectVersion.cmake
Browse files Browse the repository at this point in the history
Relates: #841
Tested: localhost

------------------------
Note: by creating a PR or an issue you automatically agree to the CLA. See [CONTRIBUTING.md](https://github.com/userver-framework/userver/blob/develop/CONTRIBUTING.md). Feel free to remove this note, the agreement holds.

Tests: протестировано CI

Pull Request resolved: #842
commit_hash:e0535d92d96cc65f9d40393c002011c0cbc8695b
  • Loading branch information
botanegg authored and fdr400 committed Jan 30, 2025
1 parent 470ce77 commit af6ea1c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cmake/DetectVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ function(pacman_version version_output_var pacmanpackage)
)

if (version_result EQUAL 0)
if (version_output MATCHES "^(.*) (.*)-.*$")
set(${version_output_var} ${CMAKE_MATCH_2} PARENT_SCOPE)
message(STATUS "pacman version of ${pacmanpackage}: ${CMAKE_MATCH_2}")
# Possible output is `re2 1:20240702-2` (format spec https://wiki.archlinux.org/title/PKGBUILD#Version)
# `re2` is name
# `1` is epoch (optional)
# `20240702` is version
# `2` is release number
if (version_output MATCHES "^(.*) ([0-9]*:)?(.*)-.*$")
set(${version_output_var} ${CMAKE_MATCH_3} PARENT_SCOPE)
message(STATUS "pacman version of ${pacmanpackage}: ${CMAKE_MATCH_3}")
else()
set(${version_output_var} "NOT_FOUND")
endif()
Expand Down

0 comments on commit af6ea1c

Please sign in to comment.