diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-12-20 20:35:25 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-12-21 13:43:20 +0100 |
commit | 681bd2c524ed71ac04045c90884ba8d55eee7b66 (patch) | |
tree | f50b21fb487cead9833a04a307f0e4d7b54d7a8d /src/test/test-udev.c | |
parent | udev: modernize ctrl_send and use PROJECT_VERSION (diff) | |
download | systemd-681bd2c524ed71ac04045c90884ba8d55eee7b66.tar.xz systemd-681bd2c524ed71ac04045c90884ba8d55eee7b66.zip |
meson: generate version tag from git
$ build/systemctl --version
systemd 239-3555-g6178cbb5b5
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid
$ git tag v240 -m 'v240'
$ ninja -C build
ninja: Entering directory `build'
[76/76] Linking target fuzz-unit-file.
$ build/systemctl --version
systemd 240
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid
This is very useful during development, because a precise version string is
embedded in the build product and displayed during boot, so we don't have to
guess answers for questions like "did I just boot the latest version or the one
from before?".
This change creates an overhead for "noop" builds. On my laptop, 'ninja -C
build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid
this, but I think that <1 s is still acceptable.
Fixes #7183.
PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the
more dynamically changing version string.
Why save to a file? It would be easy to generate the version tag using
run_command(), but we want to go through a file so that stuff gets rebuilt when
this file changes. If we just defined an variable in meson, ninja wouldn't know
it needs to rebuild things.
Diffstat (limited to 'src/test/test-udev.c')
-rw-r--r-- | src/test/test-udev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/test-udev.c b/src/test/test-udev.c index 7a4622b875..ab31f5a2f1 100644 --- a/src/test/test-udev.c +++ b/src/test/test-udev.c @@ -11,6 +11,7 @@ #include <sys/signalfd.h> #include <unistd.h> +#include "build.h" #include "device-private.h" #include "fs-util.h" #include "log.h" @@ -81,7 +82,7 @@ static int run(int argc, char *argv[]) { return 0; } - log_debug("version %s", PACKAGE_VERSION); + log_debug("version %s", GIT_VERSION); mac_selinux_init(); action = argv[1]; |