From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8HEE-0000YG-JG for qemu-devel@nongnu.org; Wed, 01 Jun 2016 21:15:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8HEC-0002iv-E0 for qemu-devel@nongnu.org; Wed, 01 Jun 2016 21:15:17 -0400 Date: Thu, 2 Jun 2016 09:14:39 +0800 From: Fam Zheng Message-ID: <20160602011439.GD19448@ad.usersys.redhat.com> References: <1464774261-648-1-git-send-email-famz@redhat.com> <1464774261-648-3-git-send-email-famz@redhat.com> <1464777632.8823.22.camel@redhat.com> <5f939153-1f8e-105e-c277-94f84a44b0a8@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH v3 2/2] Makefile: Derive "PKGVERSION" from "git describe" by default List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Laszlo Ersek , Gerd Hoffmann , peter.maydell@linaro.org, qemu-devel@nongnu.org, qemu-block@nongnu.org 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 > > . > > > >> 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