[Mesa-dev] [PATCH mesa 2/3] bin: make MESA_GIT_SHA1 directly usable in code

Emil Velikov emil.l.velikov at gmail.com
Thu Aug 16 13:21:42 UTC 2018


On 16 August 2018 at 12:19, Eric Engestrom <eric.engestrom at intel.com> wrote:
> On Thursday, 2018-08-16 12:00:10 +0100, Emil Velikov wrote:
>> On 14 August 2018 at 18:24, Eric Engestrom <eric.engestrom at intel.com> wrote:
>> > Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
>> > ---
>> >  bin/git_sha1_gen.py                                | 2 +-
>> >  src/gallium/drivers/svga/svga_screen.c             | 6 +-----
>> >  src/gallium/state_trackers/clover/api/device.cpp   | 6 +-----
>> >  src/gallium/state_trackers/clover/api/platform.cpp | 6 +-----
>> >  src/git_sha1.h.in                                  | 2 +-
>> >  src/mesa/main/context.c                            | 6 +-----
>> >  src/mesa/main/version.c                            | 6 +-----
>> >  7 files changed, 7 insertions(+), 27 deletions(-)
>> >
>> > diff --git a/bin/git_sha1_gen.py b/bin/git_sha1_gen.py
>> > index bc0279ccef16d42bb88d..bcc29de1c6218ab3af79 100755
>> > --- a/bin/git_sha1_gen.py
>> > +++ b/bin/git_sha1_gen.py
>> > @@ -53,4 +53,4 @@ def write_if_different(contents):
>> >          new_sha1 = git_sha1_h_in.read().replace('@VCS_TAG@', git_sha1)
>> >          write_if_different(new_sha1)
>> You're missing the leading " (" and trailing ")" in the above call.
>>
>> Without those the output will change as below:
>> from: foo (git-12345)
>> to: foogit-12345
>
> You missed this hunk (it's in the original patch, scroll down)
>
> ----8<----
> diff --git a/src/git_sha1.h.in b/src/git_sha1.h.in
> index dc17f5e6614930d7d376..d814d253442b913a21c7 100644
> --- a/src/git_sha1.h.in
> +++ b/src/git_sha1.h.in
> @@ -1 +1 @@
> -#define MESA_GIT_SHA1 "git- at VCS_TAG@"
> +#define MESA_GIT_SHA1 " (git- at VCS_TAG@)"
> ---->8----
>
Thanks Eric - I most certainly did. With the typo in 1/3 the series is:
Reviewed-by: Emil Velikov <emil.velikov at collabora.com>

>>
>> >  else:
>> > -    write_if_different('')
>> > +    write_if_different('#define MESA_GIT_SHA1 ""')
>> > diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
>> > index b8f936ee96730d97c570..355aaa38f6ba5510f3fe 100644
>> > --- a/src/gallium/drivers/svga/svga_screen.c
>> > +++ b/src/gallium/drivers/svga/svga_screen.c
>> > @@ -889,11 +889,7 @@ init_logging(struct pipe_screen *screen)
>> >     svga_host_log(host_log);
>> >
>> >     util_snprintf(host_log, sizeof(host_log) - strlen(log_prefix),
>> > -                 "%s%s"
>> > -#ifdef MESA_GIT_SHA1
>> > -                 " (" MESA_GIT_SHA1 ")"
>> > -#endif
>> > -                 , log_prefix, PACKAGE_VERSION);
>> > +                 "%s%s%s", log_prefix, PACKAGE_VERSION, MESA_GIT_SHA1);
>> Wondering why we need the explicit %s modifier for PACKAGE_VERSION
>> (and MESA_GIT_SHA1) here.
>> Should be safe to drop and alight with rest of tree. But that for another patch.
>
> It's in case there's any % in there, it would break printf, but you're
> right, it's basically impossible here since we have full control over
> both of these.  I'll send a patch for that in a bit.
>
That would keep my OCD at bay, thanks ;-)

-Emil


More information about the mesa-dev mailing list