Commit Graph

35 Commits

Author SHA1 Message Date
David Neto
14000ad47a
Use python3 explicitly. (#5540)
Some Linux images don't ship with a plain 'python'
2024-01-23 15:42:34 -05:00
ncesario-lunarg
c8510a5e89
Fix python warning seen on Fedora 39 (#5474)
Python 3.12 on Fedora 39 is producing a deprecation warning about
datetime.utcfromtimestamp.

See
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp
for more details.
2023-11-15 10:36:36 -05:00
sethp
d88742fbd8
fix(build): git describe all tagged versions (#5447)
Previously, the version string would include `v2022.4-N-...` indicating N commits since the last annotated tag (`v2022.4`).

This change broadens the search from just annotated tags to all tags that match `v*`, including the latest version `v2023.4.rc2`.

See also: https://github.com/KhronosGroup/SPIRV-Tools/pull/5417#issuecomment-1764772856
2023-11-13 17:28:30 +01:00
Natalie Chouinard
6b1e609ef1
Support missing git in update_build_version.py (#5473)
Return False instead of raising an exception when running git commands
fail, which allows the script to fallback to alternative options.

Fixes #5469
2023-11-10 15:43:11 -08:00
Fumitoshi Ukai
a9c61d1376
update_build_version.py produce deterministic header. (#5426)
When building, .git directory may not exist in current
directory (e.g. chromium build), so it will produce
with current timestamp, which becomes non-deterministic build.

Check if repo_path is in git repository and use git info.
Also fix fallback logic when 'git describe' failed.
'git rev-parse HEAD' result was not used because it didn't
update success.
2023-10-18 18:49:51 +02:00
André Cruz
2d6996f731
Check for git repository before git commands (#5403)
When we are attempting to fetch the version info from the git
repository, first check if we're actually in one, otherwise
spurious errors messages get printed.
2023-09-11 20:52:31 +00:00
Nathan Gauër
b029037aaa
Revert changes around CHANGES file. (#5143)
* Revert "build: allow update_build to generate fake version (#5098)"

This reverts commit 7823b8ff4a.

* Revert "build: stop parsing CHANGES file. (#5067)"

This reverts commit fcfc3c580c.
2023-03-09 18:24:20 +01:00
Bruce Dawson
2cf48e9534
Allow invoking git.bat as git on Windows (#5118)
In a Chromium build environment on Windows git is supplied by
depot_tools as git.bat. This was causing build errors on Windows that
are most easily reproduced with this command:

  gn gen out\default && gn clean out\default && ninja -C out\default spirv-as

The errors included:

[12:55:40][ERROR   ] Failed to run "['git', 'tag', '--sort=-v:refname']" in "C:\src\chromium\src\third_party\vulkan-deps\spirv-tools\src": [WinError 2] The system cannot find the file specified
[12:55:40][WARNING ] Could not deduce latest release version from history.

This is because 'git' does not resolve to git.bat unless shell=True is
passed to subprocess.Popen. This change passes shell=True but only on
Windows which resolves these errors.
2023-02-23 03:24:34 +00:00
Nathan Gauër
7823b8ff4a
build: allow update_build to generate fake version (#5098)
When the build is done on a shallow repo, or on a non-git copy,
the version script failed. We should not hard fail, but generate
a "version" (unknown).

Sample outputs:

with git history:
`"v2023.2-dev", "SPIRV-Tools v2023.2-dev v2022.4-87-g53541064"`

with shallow clone:
`"unknown_version", "SPIRV-Tools unknown_version d8759a140bc65811332d5f91f3b08febadd5a21d"`

not a git repo:
`"unknown_version", "SPIRV-Tools unknown_version unknown_hash, 2023-02-02T16:25:48.077995"`
2023-02-03 20:43:03 +00:00
Nathan Gauër
fcfc3c580c
build: stop parsing CHANGES file. (#5067)
The CHANGES file was an alternative source of truth that was trying
to duplicate/replace the git history truth.
This allow us to change the way we handle releases so we don't have to make
sure our CHANGES PR are linked to the tag and tested PR, simplifying the
process.
2023-01-30 13:23:41 -05:00
Nathan Gauër
64ba112ffb
build: refactorize update_build_version (#5079)
This commit prepares the next change to stop parsing the
CHANGES file to determine version, but to use tags instead.
2023-01-27 14:36:09 +00:00
Natalie Chouinard
78a0f075ac
Fix gen_build_version on Windows (#4780)
* Fix gen_build_version on Windows

The paths used in the gen_build_version script are causing some failures
in downstream builds. Switch to using the location of the CHANGES file
rather than the ".." parent directory workaround.

* Update other build files
2022-04-07 13:19:05 +00:00
David Neto
8a35bf030b Python 3: remove deprecated U qualifier on 'open' (#3019)
The U qualifier (universal line endings) has no effect
in Python3. Remove its use to avoid a Python warning.
2019-11-07 08:39:09 -05:00
Chris Lamb
178c4ddea5 Correct "environment" typo (#3007) 2019-11-04 21:01:27 -05:00
Chris Lamb
e8c3f9b0b4 Ensure timestamp does not vary with timezone. (#2982) 2019-10-18 17:08:16 -04:00
Ryan Harrison
65f49dfc39
Remove unneeded future imports (#2739)
Also, adds explicitly setting python executable in the NDK build script, rewrites 
some Python2-isms to 3isms, and formats some code.

Fixes #2738
2019-07-24 15:29:38 -04:00
David Neto
654feb32f2 Do nothing if trying to make the current dir 2017-03-20 11:23:35 -04:00
David Neto
699943d297 Say why we allow override of build timestamp
It's for reproducible builds.

Also, fix Python formatting.
2017-01-17 15:42:02 -05:00
Bernhard M. Wiedemann
29b37fb310 make build reproducible
see https://reproducible-builds.org/ for why this is good
2017-01-17 19:36:39 +01:00
David Neto
558ac1e5aa Allow trailing whitespace on version lines in CHANGES 2017-01-06 13:18:50 -05:00
David Neto
37422e9dba Support building under CYGWIN
- Parse CHANGES file with Universal Python line endings in case
  the source tree was checked out with Windows line endings.
- Use our own clone of strnlen_s which might not be available
  everywhere.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/508
2016-12-21 10:34:23 -05:00
David Neto
0e001b70e4 Fix Google copyright lines 2016-09-02 10:00:29 -04:00
David Neto
033b7d00f0 Avoid race on mkdir
Should fix https://github.com/KhronosGroup/SPIRV-Tools/issues/340
2016-08-15 11:14:34 -04:00
Lei Zhang
0d8ddd0b75 Create directory first if not existing and always refresh. 2016-08-05 10:23:41 -04:00
Lei Zhang
c6465fb220 Avoid redefining builtin dir. 2016-08-05 10:23:41 -04:00
David Neto
87125a19c6 Fix CHANGES file version parsing. -dev is optional 2016-06-02 15:32:28 -04:00
David Neto
9166854ac9 Add CHANGES file with high level software history
Add a high level version number for SPIRV-Tools, beginning
with v2016.0-dev.  The README describes the format of the
version number.

The high level version number is extracted from the CHANGES
file.  That works around:
 - stale-bait for when we don't add tags to the repository
 - our inability to add tags to the repository

Option --version causes spirv-as, spirv-dis, and spirv-val to
show the high level version number.

Add spvSoftwareVersionString to return the C-string for
the high level version number.

Add spvSoftwareVersionDetailsString() so that clients can get
more information if they want to.
Also allows us to clean up the uses in the tool executables files,
so now only one file includes build-version.inc.

Move the update-build-version logic to the only
CMakeLists file that needs it.

The update build version script takes a new argument
to name the output file.
2016-04-22 15:19:45 -04:00
Lei Zhang
476989e7b7 Return str in describe() as said by the blurb. 2016-03-11 15:30:38 -05:00
Lei Zhang
9149a66ca4 Fix the corner case in version generation script.
When the given directory is not inside the SPIRV-Tools project,
describe() returns a str instance instead of bytes instance
in Python3, which will case problem when calling decode() on it.
2016-03-11 15:06:15 -05:00
Lei Zhang
f7e63786a9 Add comments to explain why calling decode(). 2016-03-07 13:44:09 -05:00
Lei Zhang
c15683906c Run pyformat with -s 4 --force_quote_type=single. 2016-03-06 13:00:58 -05:00
Lei Zhang
703b0f7ab4 Imporve compatibility with Python3.
* Use print_function from __future__ to tackle the print syntax
   change.
 * In Python3 str and bytes are no longer the same thing. Need
   proper decode.
2016-03-06 12:58:13 -05:00
David Neto
3deecefde5 If no tag in the repo, then show the commit hash 2016-02-24 12:42:13 -05:00
David Neto
b38ac4bae6 Use subprocess.Popen, hoping for Windows portability
Replaces use of subprocess.check_output
2016-02-23 18:09:50 -05:00
qining
4e797f8236 Implement --version for spirv-tools
'spirv-as --version', 'spirv-dis --version' and 'spirv-val --version'
will display version information.
2016-02-23 14:14:23 -05:00