[Mesa-dev] [PATCH 2/2] mesa: Include GIT SHA1 in GL version string
Shuang He
shuang.he at intel.com
Thu Mar 31 18:37:06 PDT 2011
On 2011/4/1 9:24, Kristian Høgsberg wrote:
> On Thu, Mar 31, 2011 at 8:03 PM, Dan Nicholson<dbn.lists at gmail.com> wrote:
>> On Thu, Mar 31, 2011 at 3:41 PM, Eric Anholt<eric at anholt.net> wrote:
>>> On Thu, 31 Mar 2011 13:56:56 -0700, Corbin Simpson<mostawesomedude at gmail.com> wrote:
>>>> On Thu, Mar 31, 2011 at 1:30 PM, Ian Romanick<idr at freedesktop.org> wrote:
>>>>> From: Ian Romanick<ian.d.romanick at intel.com>
>>>>>
>>>>> ---
>>>>> Makefile | 8 ++++++++
>>>>> src/mesa/main/version.c | 7 ++++++-
>>>>> 2 files changed, 14 insertions(+), 1 deletions(-)
>>>>>
>>>>> diff --git a/Makefile b/Makefile
>>>>> index a1ab65e..c85b903 100644
>>>>> --- a/Makefile
>>>>> +++ b/Makefile
>>>>> @@ -5,7 +5,15 @@ TOP = .
>>>>> SUBDIRS = src
>>>>>
>>>>>
>>>>> +# The git command below generates an empty string when we're not
>>>>> +# building in a GIT tree (i.e., building from a release tarball).
>>>>> default: $(TOP)/configs/current
>>>>> + @touch src/mesa/main/git_sha1.h
>>>>> + @if which git> /dev/null; then \
>>>>> + git log -n 1 --oneline |\
>>>>> + sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "\1"/' \
>>>>> +> src/mesa/main/git_sha1.h; \
>>>>> + fi
>>>>> @for dir in $(SUBDIRS) ; do \
>>>>> if [ -d $$dir ] ; then \
>>>>> (cd $$dir&& $(MAKE)) || exit 1 ; \
>>>>> diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
>>>>> index c7a0d69..80fa0c2 100644
>>>>> --- a/src/mesa/main/version.c
>>>>> +++ b/src/mesa/main/version.c
>>>>> @@ -25,6 +25,7 @@
>>>>> #include "imports.h"
>>>>> #include "mtypes.h"
>>>>> #include "version.h"
>>>>> +#include "git_sha1.h"
>>>>>
>>>>>
>>>>>
>>>>> @@ -185,7 +186,11 @@ compute_version(struct gl_context *ctx)
>>>>> ctx->VersionString = (char *) malloc(max);
>>>>> if (ctx->VersionString) {
>>>>> _mesa_snprintf(ctx->VersionString, max,
>>>>> - "%u.%u Mesa " MESA_VERSION_STRING,
>>>>> + "%u.%u Mesa " MESA_VERSION_STRING
>>>>> +#ifdef MESA_GIT_SHA1
>>>>> + " (" MESA_GIT_SHA1 ")"
>>>>> +#endif
>>>>> + ,
>>>>> ctx->VersionMajor, ctx->VersionMinor);
>>>>> }
>>>>> }
>>>>> --
>>>>> 1.7.4
>>>> Hmm, wouldn't the output of "git describe" be more useful?
>>> That's what we talked about initially, but since we tag releases of the
>>> stable branches, "git describe" of master says:
>>>
>>> snb-magic-2692-gb3d1c77
>>>
>>> which is some tag off master that we pushed last year.
>> I think krh knows the magic command, but "git rev-list HEAD" works here.
> Well, no, there really isn't a good way to get a more readable output,
> since we only tag the stable branches and typically only after a few
> commits happen. So if you look at the commits reachable from master,
> none of them have (meaningful) tags, which means that there is nothing
> for git describe to base a more readable name on.
>
> Kristian
How about we deliberately add some tag to indicate current master branch
is in which stage:
Like after 7.10 release, we tag it as 7.11-dev or something alike
Thanks
--Shuang
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list