All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	peter.maydell@linaro.org, qemu-devel@nongnu.org,
	qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3 2/2] Makefile: Derive "PKGVERSION" from "git describe" by default
Date: Thu, 2 Jun 2016 09:14:39 +0800	[thread overview]
Message-ID: <20160602011439.GD19448@ad.usersys.redhat.com> (raw)
In-Reply-To: <b972e299-40d6-dff1-89ac-b984a79c75c2@redhat.com>

On Wed, 06/01 15:55, Paolo Bonzini wrote:
> 
> 
> On 01/06/2016 13:13, Laszlo Ersek wrote:
> > On 06/01/16 12:40, Gerd Hoffmann wrote:
> >>   Hi,
> >>
> >>> +				git describe 2>/dev/null | tr -d '\n'; \
> >>> +				if ! git diff-index --quiet HEAD &>/dev/null; then \
> >>> +					printf -- '-dirty'; \
> >>> +				fi \
> >>
> >> /me suggests "git describe --dirty --match 'v*'"
> >>
> >> Saves the extra effort to check for a dirty tree manually.
> > 
> > We couldn't convince ourselves that support for "--dirty" is ubiquitous;
> > please see the sub-thread rooted at
> > <http://thread.gmane.org/gmane.comp.emulators.qemu/414824/focus=414828>.
> > 
> >> Also greatly reduces the chance non-release tags are matched, so I don't
> >> get results like "pull-vga-20160523-1-236-g9fd5eb7".
> > 
> > Since what version is "--match" supported? ;)
> 
> git's own version history says 1.5.5.
> 
> Another small point is that some people put the whole home directory in
> git, so I would test for $(SRC_PATH)/.git instead of using "git
> status".  And no-git is unnecessary if the git part is included in
> parentheses.  This gives:
> 
> diff --git a/Makefile b/Makefile
> index a4d7da0..412c2b8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -173,16 +173,16 @@ qemu-version.h: FORCE
>  		if test -n "$(PKGVERSION)"; then \
>  			printf '"$(PKGVERSION)"\n'; \
>  		else \
> -			printf '" ('; \
> -			if ! git status &>/dev/null; then \
> -				printf "no-git"; \
> -			else \
> -				git describe 2>/dev/null | tr -d '\n'; \
> +			if test -d .git; then \
> +			        printf '" ('; \
> +				git describe --match 'v*' 2>/dev/null | tr -d '\n'; \
>  				if ! git diff-index --quiet HEAD &>/dev/null; then \
>  					printf -- '-dirty'; \
> -				fi \
> +				fi; \
> +			        printf ')"\n'; \
> +			else \
> +				printf '""\n'; \
>  			fi; \
> -			printf ')"\n'; \
>  		fi) > $@.tmp)
>  	$(call quiet-command, cmp --quiet $@ $@.tmp || mv $@.tmp $@)
>  
> 
> 
> Looks good?

Looks good except I'd use tabs everywhere. Can you fix when applying? :)

Fam

  parent reply	other threads:[~2016-06-02  1:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-01  9:44 [Qemu-devel] [PATCH v3 0/2] Let PKGVERSION include the "git describe" output Fam Zheng
2016-06-01  9:44 ` [Qemu-devel] [PATCH v3 1/2] Makefile: Add a "FORCE" target Fam Zheng
2016-06-01 10:12   ` Daniel P. Berrange
2016-06-01  9:44 ` [Qemu-devel] [PATCH v3 2/2] Makefile: Derive "PKGVERSION" from "git describe" by default Fam Zheng
2016-06-01 10:13   ` Daniel P. Berrange
2016-06-01 10:40   ` Gerd Hoffmann
2016-06-01 11:13     ` Laszlo Ersek
2016-06-01 13:55       ` Paolo Bonzini
2016-06-01 15:30         ` Laszlo Ersek
2016-06-02  1:14         ` Fam Zheng [this message]
2016-06-20  4:50 ` [Qemu-devel] [PATCH v3 0/2] Let PKGVERSION include the "git describe" output Changlong Xie
2016-06-20  8:05   ` Fam Zheng

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=20160602011439.GD19448@ad.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.