-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libostree: add versioning macros #728
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One minor question, otherwise looks good. While it's not worth respinning for, I think general best practice nowadays is to only generate configure
from configure.ac
, and do everything else via sed
in Makefile.am
, like how we do for e.g. systemd unit files. But again, not worth respinning for.
src/libostree/ostree-version.h.in
Outdated
#define OSTREE_VERSION_S "@VERSION@" | ||
|
||
#define OSTREE_ENCODE_VERSION(year,release) \ | ||
((year) << 16 | (release) << 8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not (year) << 8 | (release)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or alternatively if we want to allow ourselves more than 256
releases, (year) << 16 | (release)
?
12130b9
to
4554150
Compare
Fixed the shifting. I'm not sure why the builds are failing; I'm pretty sure the headers are being exported... |
4554150
to
800b3ed
Compare
I think it's a
|
3fd2c37
to
51a95c4
Compare
apidoc/Makefile.am
Outdated
@@ -34,7 +34,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml | |||
# gtk-doc will search all .c & .h files beneath here for inline comments | |||
# documenting the functions and macros. | |||
# e.g. DOC_SOURCE_DIR=../../../gtk | |||
DOC_SOURCE_DIR=$(top_srcdir)/src/libostree | |||
DOC_SOURCE_DIR=$(top_builddir)/src/libostree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs to be top_srcdir
, no?
src/libostree/ostree-version.h.in
Outdated
*/ | ||
#define OSTREE_CHECK_VERSION(year,release) \ | ||
(OSTREE_YEAR_VERSION > (year) || \ | ||
(OSTREE_YEAR_VERSION == (year) && OSTREE_RELEASE_VERSION > (release))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think I would prefer the semantic for this to be >=
. E.g.: https://github.com/libvirt/libvirt/blob/master/include/libvirt/libvirt-common.h.in#L87
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a really cool addition BTW!
* | ||
* ostree year version component (e.g. 2017 if %OSTREE_VERSION is 2017.2) | ||
*/ | ||
#define OSTREE_YEAR_VERSION (@YEAR_VERSION@) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this information be exported with a function so that it is evaluated after the library is loaded? Otherwise, IMHO, it adds not much more value than pkg-config --modversion
@giuseppe You're 100% correct in that this PR is for a user who wants runtime dependency, and this is compile time only. However, two things. First, I think this is nicer for compile time checking than Second, doing compile time checking is a prerequisite IMO for having the runtime equivalent - we should steal the code from glib I'd say. |
@GeorgesStavracas If you want I can fix it, I have a lot of autogoop experience, just let me know. |
@cgwalters sure, I didn't mean to block the PR. At the time these new macros will be available though, we can assume all the previous features are available as well. Just wanted to point out to @GeorgesStavracas that if he needs to check a particular feature not available in older versions, he could use |
OSTree currently provides no way to inspect the versioning information at run time, being only available at compile time through pkg-config. This is a problem for e.g. Flatpak, that needs to check whether the 'update-frequency' option is available. Checking at compile time isn't great since it's not looking for new symbols, but only if an optional feature is present. This commit, then, adds a new header that is generated at compile time, exposing OSTree's versioning information.
51a95c4
to
31c61ac
Compare
@cgwalters would be great if you could fix that, but more important than the fix itself, I'm curious to learn what's failing, and why. I'm obviously missing something related to the |
I pushed a |
OSTree currently provides no way to inspect the versioning information at run time, being only available at compile time through pkg-config. This is a problem for e.g. Flatpak, that needs to check whether the 'update-frequency' option is available. Checking at compile time isn't great since it's not looking for new symbols, but only if an optional feature is present. This commit, then, adds a new header that is generated at compile time, exposing OSTree's versioning information. Closes: #728 Approved by: cgwalters
💔 Test failed - status-atomicjenkins |
Sigh, need to get libsoup patches out. @rh-atomic-bot retry |
☀️ Test successful - status-atomicjenkins |
[Previously](ostreedev#728) we added compile-time checking for versions, but there are use cases for runtime checking as well, because in a number of API calls we use `GVariant` as an API extension mechanism.
Followup in #735 |
OSTree currently provides no way to inspect the versioning
information at run time, being only available at compile
time through pkg-config.
This is a problem for e.g. Flatpak, that needs to check
whether the 'update-frequency' option is available. Checking
at compile time isn't great since it's not looking for new
symbols, but only if an optional feature is present.
This pull request, then, adds a new header that is generated
at compile time, exposing OSTree's versioning information.