Commit Graph

16 Commits

Author SHA1 Message Date
Eric Engestrom ba44990726 git_sha1_gen.py: fix whitespace
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5112>
2020-05-20 22:05:41 +00:00
Eric Engestrom c909370117 git_sha1_gen.py: fix code style
Bare `except` are bad form as per PEP8.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5112>
2020-05-20 22:05:41 +00:00
Eric Engestrom 413c6f9905 git_sha1_gen.py: fix out-of-date comment
This hasn't been true since 7088622e5f ("buildsys: move file
regeneration logic to the script itself") almost 3 years ago.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5112>
2020-05-20 22:05:41 +00:00
Emil Velikov c51e7486d9 bin/git_sha1_gen.py: remove execute bit/shebang
The script is executed explicitly via the build system, that uses
PYTHON/prog_python and equivalent.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
2018-08-23 17:00:04 +01:00
Eric Engestrom bc8abc1adf bin: always define MESA_GIT_SHA1 to make it directly usable in code
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-08-16 17:38:31 +01:00
Eric Engestrom 471f708ed6 git_sha1: simplify logic
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-08-16 17:38:31 +01:00
Eric Engestrom c5dd02287f bin: split `write_if_different()` out
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2018-08-16 12:33:35 +01:00
Eric Engestrom c2e00f9eee bin: whitespace cleanup
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2018-08-16 12:30:30 +01:00
Eric Engestrom 2117d03310 git_sha1_gen: create empty file in fallback path
I missed this part in my conversion, the old stream redirection meant
the file was always created.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103496
Fixes: 7088622e5f "buildsys: move file regeneration logic to
       the script itself"
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2017-10-30 17:21:58 +00:00
Eric Engestrom 7088622e5f buildsys: move file regeneration logic to the script itself
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2017-10-27 13:38:37 +01:00
Eric Engestrom 16be271c6e git_sha1_gen: use git_sha1.h.in on all build systems
Meson already uses this, let's get the other build sys to use it too.

Note: rstrip() was dropped, as truncating to the first 10 chars already
gets rid of the terminating newline (not an issue with the env var
either, unless maliciously crafted to break the build... not sure this
is a real-world issue).

Verified to work and give the same output as before on both python 2
and 3 :)

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2017-10-16 18:52:35 +01:00
Brian Paul a3b2e60aa0 git_sha1_gen: accept MESA_GIT_SHA1_OVERRIDE env var
If one uses a parent build script to download/build Mesa we may not
have a full git repository (maybe a tar archive) so the 'git rev-parse'
command will fail.

This updates the script to look for a MESA_GIT_SHA1_OVERRIDE env var.
If it's set, use that sha1 instead of using git rev-parse.  With this
change we can put a git hash in the GL_VERSION string even when we
don't have a git repo.

v2: incorporate Dylan's suggestions to simplify the code

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2017-10-10 11:28:31 -06:00
Eric Engestrom adea68a8a2 git_sha1_gen: fix output on python3
String handling has changed on python3.

Before this patch, on python3:
	#define MESA_GIT_SHA1 "git-b'b99dcbfeb3'"
After:
	#define MESA_GIT_SHA1 "git-b99dcbfeb3"

(No change on python2, it always looked ok)

Cc: Jose Fonseca <jfonseca@vmware.com>
Fixes: b99dcbfeb3 "build: Convert git_sha1_gen script to Python."
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2017-09-25 14:58:26 +01:00
Eric Engestrom aab0649487 git_sha1_gen: catch any error the same way
Acked-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-08-02 14:57:54 +01:00
Tobias Klausmann 44828e99f9 build: Don't bail on OSError in git_sha1_gen.py
When building sandboxed, we may encounter additional errors. Ignore the errors,
as we are in a constrained environment.

This can be observed when building latest git with OBS.

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-08-02 14:28:58 +01:00
Jose Fonseca b99dcbfeb3 build: Convert git_sha1_gen script to Python.
Python is the scripting language we've been using for scripts that need
to run across all supported platforms.

Shell is *not* a portable language for scripts.

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-08-01 15:24:39 +01:00