[Mesa-dev] [PATCH 3/4] scons: rework the git_sha1.h generation rule

Jose Fonseca jfonseca at vmware.com
Mon Jun 6 11:43:46 UTC 2016


On 30/05/16 13:46, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
>
> Analogous to the previous commit
>
> Cc: Brian Paul <brianp at vmware.com>
> Cc: Jose Fonseca <jfonseca at vmware.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> Note: this may cause "false positives" if one extracts the release
> tarball in another git repository. This is a preexisting bug, which we
> want to fix one day.
> ---
>   src/SConscript | 19 ++-----------------
>   1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/src/SConscript b/src/SConscript
> index d623c51..b93aee2 100644
> --- a/src/SConscript
> +++ b/src/SConscript
> @@ -1,6 +1,4 @@
>   Import('*')
> -import filecmp
> -import os
>   import subprocess
>
>   def write_git_sha1_h_file(filename):
> @@ -14,26 +12,13 @@ def write_git_sha1_h_file(filename):
>           (commit, foo) = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()
>       except:
>           # git log command didn't work
> -        if not os.path.exists(filename):
> -            dirname = os.path.dirname(filename)
> -            if not os.path.exists(dirname):
> -                os.makedirs(dirname)
> -            # create an empty file if none already exists
> -            f = open(filename, "w")
> -            f.close()
> +        # bail out without touching/removing the existing file
>           return
>
>       commit = '#define MESA_GIT_SHA1 "git-%s"\n' % commit[0:7]
> -    tempfile = "git_sha1.h.tmp"
> -    f = open(tempfile, "w")
> +    f = open(filename, "w")
>       f.write(commit)
>       f.close()
> -    if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename):
> -        # The filename does not exist or it's different from the new file,
> -        # so replace old file with new.
> -        if os.path.exists(filename):
> -            os.remove(filename)
> -        os.rename(tempfile, filename)
>       return
>
>
>



Looks alright to me.

Patch 1 and 3 are

Acked-by: Jose Fonseca <jfonseca at vmware.com>


More information about the mesa-dev mailing list