-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: Add version macros and version checking function
The version checking function in particular is really useful for people doing `from gi.repository import RpmOstree`, which we'd like at least some things like Anaconda and Pungi to do. Closes: #891 Approved by: jlebon
- Loading branch information
1 parent
fee6d06
commit 2082b3f
Showing
6 changed files
with
139 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,17 @@ dnl To do a release, increment this number, commit, then submit it as a PR | |
dnl to merge via homu. After that, do `git pull origin && git reset --hard origin/master`. | ||
dnl Then use https://github.com/cgwalters/git-evtag to sign. | ||
dnl Then, git push origin v201X.XX | ||
AC_INIT([rpm-ostree], [2017.7], [[email protected]]) | ||
m4_define([year_version], [2017]) | ||
m4_define([release_version], [7]) | ||
m4_define([package_version], [year_version.release_version]) | ||
AC_INIT([rpm-ostree], [package_version], [[email protected]]) | ||
AC_CONFIG_HEADER([config.h]) | ||
AC_CONFIG_MACRO_DIR([buildutil]) | ||
AC_CONFIG_AUX_DIR([build-aux]) | ||
dnl Versioning information | ||
AC_SUBST([YEAR_VERSION], [year_version]) | ||
AC_SUBST([RELEASE_VERSION], [release_version]) | ||
AC_SUBST([PACKAGE_VERSION], [package_version]) | ||
|
||
AM_INIT_AUTOMAKE([1.11 -Wno-portability foreign no-define tar-ustar no-dist-gzip dist-xz subdir-objects]) | ||
AM_MAINTAINER_MODE([enable]) | ||
|
@@ -195,6 +202,7 @@ AC_CONFIG_FILES([ | |
Makefile | ||
api-doc/Makefile | ||
src/lib/rpm-ostree-1.pc | ||
src/lib/rpmostree-version.h | ||
]) | ||
AC_OUTPUT | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- | ||
* | ||
* Copyright (C) 2017 Georges Basile Stavracas Neto <[email protected]> | ||
* Copyright (C) 2017 Red Hat, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation; either version 2 of the licence or (at | ||
* your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General | ||
* Public License along with this library; if not, write to the | ||
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, | ||
* Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
#pragma once | ||
|
||
/** | ||
* SECTION:rpm-ostree-version | ||
* @short_description: Version checking | ||
* | ||
* Macros to check the version of the library at compile-time. | ||
*/ | ||
|
||
/** | ||
* RPM_OSTREE_YEAR_VERSION: | ||
* | ||
* Year version component (e.g. 2017 if %RPM_OSTREE_VERSION is 2017.9) | ||
* | ||
* Since: 2017.8 | ||
*/ | ||
#define RPM_OSTREE_YEAR_VERSION (@YEAR_VERSION@) | ||
|
||
/** | ||
* RPM_OSTREE_RELEASE_VERSION: | ||
* | ||
* Release version component (e.g. 9 if %RPM_OSTREE_VERSION is 2017.9) | ||
* | ||
* Since: 2017.8 | ||
*/ | ||
#define RPM_OSTREE_RELEASE_VERSION (@RELEASE_VERSION@) | ||
|
||
/** | ||
* RPM_OSTREE_VERSION | ||
* | ||
* Since: 2017.8 | ||
*/ | ||
#define RPM_OSTREE_VERSION (@VERSION@) | ||
|
||
/** | ||
* RPM_OSTREE_VERSION_S: | ||
* | ||
* Version encoded as a string, useful for printing and concatenation. | ||
* | ||
* Since: 2017.8 | ||
*/ | ||
#define RPM_OSTREE_VERSION_S "@VERSION@" | ||
|
||
#define RPM_OSTREE_ENCODE_VERSION(year,release) \ | ||
((year) << 16 | (release)) | ||
|
||
/** | ||
* RPM_OSTREE_VERSION_HEX: | ||
* | ||
* ostree version, encoded as an hexadecimal number, useful for | ||
* integer comparisons. | ||
* | ||
* Since: 2017.8 | ||
*/ | ||
#define RPM_OSTREE_VERSION_HEX \ | ||
(RPM_OSTREE_ENCODE_VERSION (RPM_OSTREE_YEAR_VERSION, RPM_OSTREE_RELEASE_VERSION)) | ||
|
||
/** | ||
* RPM_OSTREE_CHECK_VERSION: | ||
* @year: required year version | ||
* @release: required release version | ||
* | ||
* Compile-time version checking. Evaluates to %TRUE if the version | ||
* of ostree is equal or greater than the required one. | ||
* | ||
* Since: 2017.8 | ||
*/ | ||
#define RPM_OSTREE_CHECK_VERSION(year,release) \ | ||
(RPM_OSTREE_YEAR_VERSION > (year) || \ | ||
(RPM_OSTREE_YEAR_VERSION == (year) && RPM_OSTREE_RELEASE_VERSION >= (release))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters