Skip to content

Commit a240bf2

Browse files
j-mracekConan-Kudo
authored andcommitted
Enforce synchronization of version in spec and VERSION.cmake
It enforces synchronization of version of rpm with version available to cmake to prevents issue when package with version 0.50.0 fails to build packages that requires pkgconfig(libdnf) >= 0.50.0.
1 parent 5fd1f05 commit a240bf2

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

VERSION.cmake

+21-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,22 @@
1-
set (LIBDNF_MAJOR_VERSION 0)
2-
set (LIBDNF_MINOR_VERSION 43)
3-
set (LIBDNF_MICRO_VERSION 1)
1+
set (DEFAULT_LIBDNF_MAJOR_VERSION 0)
2+
set (DEFAULT_LIBDNF_MINOR_VERSION 43)
3+
set (DEFAULT_LIBDNF_MICRO_VERSION 1)
4+
5+
if(DEFINED LIBDNF_MAJOR_VERSION AND NOT ${DEFAULT_LIBDNF_MAJOR_VERSION} STREQUAL ${LIBDNF_MAJOR_VERSION})
6+
message(FATAL_ERROR "Variable DEFAULT_LIBDNF_MAJOR_VERSION=" ${DEFAULT_LIBDNF_MAJOR_VERSION} " in VERSION.cmake differs from LIBDNF_MAJOR_VERSION=" ${LIBDNF_MAJOR_VERSION} " in spec")
7+
else()
8+
set (LIBDNF_MAJOR_VERSION ${DEFAULT_LIBDNF_MAJOR_VERSION})
9+
endif()
10+
11+
if(DEFINED LIBDNF_MINOR_VERSION AND NOT ${DEFAULT_LIBDNF_MINOR_VERSION} STREQUAL ${LIBDNF_MINOR_VERSION})
12+
message(FATAL_ERROR "Variable DEFAULT_LIBDNF_MINOR_VERSION=" ${DEFAULT_LIBDNF_MINOR_VERSION} " in VERSION.cmake differs from LIBDNF_MINOR_VERSION=" ${LIBDNF_MINOR_VERSION} " in spec")
13+
else()
14+
set (LIBDNF_MINOR_VERSION ${DEFAULT_LIBDNF_MINOR_VERSION})
15+
endif()
16+
17+
if(DEFINED LIBDNF_MICRO_VERSION AND NOT ${DEFAULT_LIBDNF_MICRO_VERSION} STREQUAL ${LIBDNF_MICRO_VERSION})
18+
message(FATAL_ERROR "Variable DEFAULT_LIBDNF_MICRO_VERSION=" ${DEFAULT_LIBDNF_MICRO_VERSION} " in VERSION.cmake differs from LIBDNF_MICRO_VERSION=" ${LIBDNF_MICRO_VERSION} " in spec")
19+
else()
20+
set (LIBDNF_MICRO_VERSION ${DEFAULT_LIBDNF_MICRO_VERSION})
21+
endif()
422
set (LIBDNF_VERSION ${LIBDNF_MAJOR_VERSION}.${LIBDNF_MINOR_VERSION}.${LIBDNF_MICRO_VERSION})

libdnf.spec

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
%global librepo_version 1.11.0
44
%global dnf_conflict 4.2.13
55
%global swig_version 3.0.12
6+
%global libdnf_major_version 0
7+
%global libdnf_minor_version 43
8+
%global libdnf_micro_version 1
69

710
# set sphinx package name according to distro
811
%global requires_python2_sphinx python2-sphinx
@@ -48,7 +51,7 @@
4851
%{nil}
4952

5053
Name: libdnf
51-
Version: 0.43.1
54+
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
5255
Release: 1%{?dist}
5356
Summary: Library providing simplified C and Python API to libsolv
5457
License: LGPLv2+

0 commit comments

Comments
 (0)