qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/2] Makefile: Derive "PKGVERSION" from "git


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH v3 2/2] Makefile: Derive "PKGVERSION" from "git describe" by default
Date: Wed, 1 Jun 2016 17:30:52 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

On 06/01/16 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) > address@hidden)
>       $(call quiet-command, cmp --quiet $@ address@hidden || mv 
> address@hidden $@)
>  
> 
> 
> Looks good?

It does to me, yes.

Thanks!
Laszlo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]