On Tue, May 31, 2016 at 05:04:04PM +0200, Laszlo Ersek wrote: > When building QEMU from a git working tree (either in-tree or > out-of-tree), it is useful to capture the working tree status in the QEMU > binary, for the "-version" option to report. > > Daniel suggested using the "pkgversion" variable (tied to the > "--with-pkgversion" option) of the configure script for this. Downstream > packagers of QEMU already use this option for customizing their builds, > plus libvirtd captures "pkgversion" (with the "-version" option) in > "/var/log/libvirt/qemu/$GUEST.log", whenever a guest is started. > > The information we include in "pkgversion" is the output of git-describe, > with a plus sign (+) appended if there are staged or unstaged changes to > tracked files, at the time of "configure" being executed. > > The content of "pkgversion" is not changed when "--with-pkgversion" is > used on the command line. > > Cc: "Daniel P. Berrange" <berra...@redhat.com> > Cc: Kashyap Chamarthy <kcham...@redhat.com> > Signed-off-by: Laszlo Ersek <ler...@redhat.com> > --- > configure | 38 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+)
[...] Thanks, this is quite handy as I often have multiple QEMU binaries, and it'd be useful to associate the binary with a Git tree. Just tested on a clean tree. Before: $ ./x86_64-softmmu/qemu-system-x86_64 -version QEMU emulator version 2.5.50, Copyright (c) 2003-2008 Fabrice Bellard After applying the patch: $ ./x86_64-softmmu/qemu-system-x86_64 -version QEMU emulator version 2.6.50 (v2.6.0-602-g0132639), Copyright (c) 2003-2008 Fabrice Bellard - - - I see there's an in-progress discussion of "git describe --dirty" vs. the plus-sign fallback. For the current version: Tested-by: Kashyap Chamarthy <kcham...@redhat.com> -- /kashyap