Say why we allow override of build timestamp
It's for reproducible builds. Also, fix Python formatting.
This commit is contained in:
Родитель
29b37fb310
Коммит
699943d297
2
CHANGES
2
CHANGES
|
@ -3,6 +3,8 @@ Revision history for SPIRV-Tools
|
||||||
v2016.7-dev 2017-01-06
|
v2016.7-dev 2017-01-06
|
||||||
- Add build target spirv-tools-vimsyntax to generate spvasm.vim, a SPIR-V
|
- Add build target spirv-tools-vimsyntax to generate spvasm.vim, a SPIR-V
|
||||||
assembly syntax file for Vim.
|
assembly syntax file for Vim.
|
||||||
|
- Version string: Allow overriding of wall clock timestamp with contents
|
||||||
|
of environment variable SOURCE_DATE_EPOCH.
|
||||||
- Fixes:
|
- Fixes:
|
||||||
#508: Support compilation under CYGWIN
|
#508: Support compilation under CYGWIN
|
||||||
#517: Fix validation when continue (or case) contstruct is also the head of a
|
#517: Fix validation when continue (or case) contstruct is also the head of a
|
||||||
|
|
|
@ -110,9 +110,15 @@ def describe(directory):
|
||||||
return command_output(
|
return command_output(
|
||||||
['git', 'rev-parse', 'HEAD'], directory).rstrip().decode()
|
['git', 'rev-parse', 'HEAD'], directory).rstrip().decode()
|
||||||
except:
|
except:
|
||||||
return 'unknown hash, {}'.format(datetime.date.fromtimestamp(
|
# This is the fallback case where git gives us no information,
|
||||||
int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
|
# e.g. because the source tree might not be in a git tree.
|
||||||
).isoformat())
|
# In this case, usually use a timestamp. However, to ensure
|
||||||
|
# reproducible builds, allow the builder to override the wall
|
||||||
|
# clock time with enviornment variable SOURCE_DATE_EPOCH
|
||||||
|
# containing a (presumably) fixed timestamp.
|
||||||
|
timestamp = int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
|
||||||
|
formatted = datetime.date.fromtimestamp(timestamp).isoformat()
|
||||||
|
return 'unknown hash, {}'.format(formatted)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Загрузка…
Ссылка в новой задаче