From: Fam Zheng <famz@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: lersek@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] Makefile: Derive "PKGVERSION" from "git describe" by default
Date: Wed, 1 Jun 2016 11:17:16 +0800 [thread overview]
Message-ID: <20160601031716.GD8639@ad.usersys.redhat.com> (raw)
In-Reply-To: <574E50E9.3030007@redhat.com>
On Tue, 05/31 21:05, Eric Blake wrote:
> On 05/31/2016 07:31 PM, Fam Zheng wrote:
> > Currently, if not specified in "./configure", QEMU_PKGVERSION will be
> > empty. Write a rule in Makefile to generate a value from "git describe"
> > combined with a possible git tree cleanness suffix, and write into a new
> > header.
> >
> > $ cat qemu-version.h
> > #define QEMU_PKGVERSION "-v2.6.0-557-gd6550e9-unclean"
> >
> > Include the header in .c files where the macro is referenced. It's not
> > necessary to include it in all files, otherwise each time the content of
> > the file changes, all sources have to be recompiled.
> >
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
>
> > +qemu-version.h: FORCE
> > + $(call quiet-command, \
> > + (cd $(SRC_PATH); \
>
> Can CDPATH interfere with this one?
I think SRC_PATH is either an absolute path, or is ".". Both cases are fine.
>
> > + echo -n '#define QEMU_PKGVERSION '; \
>
> 'echo -n' is non-portable, use printf instead.
Will fix.
>
> > + if test -n "$(PKGVERSION)"; then \
> > + echo '"$(PKGVERSION)"'; \
> > + else \
> > + echo -n '"-'; \
>
> And again
>
> > + if ! git status &>/dev/null; then \
> > + echo -n "no-git"; \
>
> and again
>
> > + else \
> > + git describe 2>/dev/null | tr -d '\n'; \
> > + if ! git diff-index --quiet HEAD &>/dev/null; then \
> > + echo -n '-unclean'; \
>
> and again
>
> Why -unclean instead of -dirty?
The non-native speaker can fix that.
>
> > + fi \
> > + fi; \
> > + echo '"'; \
> > + fi) > $@.tmp)
> > + $(call quiet-command, cmp --quiet $@ $@.tmp || mv $@.tmp $@)
> > +
>
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
Thanks,
Fam
prev parent reply other threads:[~2016-06-01 3:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 11:16 [Qemu-devel] including the "git describe" output in the QEMU binaries? Laszlo Ersek
2016-05-31 11:32 ` Daniel P. Berrange
2016-05-31 12:16 ` Laszlo Ersek
2016-05-31 13:19 ` Daniel P. Berrange
2016-05-31 13:26 ` Laszlo Ersek
2016-06-01 1:31 ` [Qemu-devel] [PATCH 0/2] Let PKGVERSION include the "git describe" output Fam Zheng
2016-06-01 1:31 ` [Qemu-devel] [PATCH 1/2] Makefile: Add a "FORCE" target Fam Zheng
2016-06-01 1:31 ` [Qemu-devel] [PATCH 2/2] Makefile: Derive "PKGVERSION" from "git describe" by default Fam Zheng
2016-06-01 3:05 ` Eric Blake
2016-06-01 3:17 ` Fam Zheng [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160601031716.GD8639@ad.usersys.redhat.com \
--to=famz@redhat.com \
--cc=eblake@redhat.com \
--cc=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).