Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace the version scripts #392

Merged
merged 4 commits into from
Mar 19, 2024
Merged

Replace the version scripts #392

merged 4 commits into from
Mar 19, 2024

Conversation

abrown
Copy link
Collaborator

@abrown abrown commented Mar 7, 2024

In the past, I've had trouble keeping the current set of version scripts
to correctly output the version, especially in light of how we append
Git suffixes for a non-tagged commit and dirty state. This change
replaces those scripts with a single Python one which, though much more
wordy than the previous one, may be easier for contributors to read and
modify. The original scripts relied on Perl; this one relies on Python,
which seems like a fair exchange. Having a single script also makes it
easier to solve #372.

As noted in #372, some users may need to identify which version of
wasi-sdk they are using after it has been downloaded. There are many
ways to solve this, but the one I chose here is to dump the wasi-sdk
version into a VERSION file and follow that up with several dependency
versions that may be helpful to note when troubleshooting. Ideally
someone could paste the contents of that file when filing a bug. If we
adopt this approach, this fixes #372.

@abrown
Copy link
Collaborator Author

abrown commented Mar 7, 2024

For reference, ./version dump emits something like the following, which gets placed in a VERSION file in the wasi-sdk installation directory:

21.11gdb977fd767ca
wasi-libc: c9c7d0616e0f
llvm: 6009708b4367
llvm-version: 17.0.6
config: f992bcc08219

version Outdated Show resolved Hide resolved
version Outdated Show resolved Hide resolved
version Outdated Show resolved Hide resolved
version Outdated Show resolved Hide resolved
version Outdated Show resolved Hide resolved
version Outdated Show resolved Hide resolved
version Outdated Show resolved Hide resolved
@abrown abrown force-pushed the version branch 2 times, most recently from 51aa8ac to d4f5bbf Compare March 8, 2024 20:27
@abrown
Copy link
Collaborator Author

abrown commented Mar 8, 2024

Looks like the Docker issue, when replicated locally, is due to the bionic (18.04) image having only Python 3.6, which does not include the capture_output parameter I used in version.py. capture_output was added in Python 3.7.

version.py Outdated Show resolved Hide resolved
version.py Outdated Show resolved Hide resolved
abrown added a commit to abrown/wasi-sdk that referenced this pull request Mar 8, 2024
I came across this in WebAssembly#392, where it became clear that Ubuntu's 18.04
release (now several years old) was using quite ancient versions of
certain tools.
docker_build.sh Outdated Show resolved Hide resolved
@abrown abrown marked this pull request as ready for review March 16, 2024 02:31
In the past, I've had trouble keeping the current set of version scripts
to correctly output the version, especially in light of how we append
Git suffixes for a non-tagged commit and dirty state. This change
replaces those scripts with a single Python one which, though much more
wordy than the previous one, may be easier for contributors to read and
modify. The original scripts relied on Perl; this one relies on Python,
which seems like a fair exchange. Having a single script also makes it
easier to solve WebAssembly#372.
As noted in WebAssembly#372, some users may need to identify which version of
wasi-sdk they are using after it has been downloaded. There are many
ways to solve this, but the one I chose here is to dump the wasi-sdk
version into a `VERSION` file and follow that up with several dependency
versions that may be helpful to note when troubleshooting. Ideally
someone could paste the contents of that file when filing a bug. If we
adopt this approach, this fixes WebAssembly#372.
When running Git commands inside this Docker container (i.e., commands
that the `version.py` script needs for determining version information),
the Docker build would run into issues like:

```
fatal: detected dubious ownership in repository at '/workspace'
To add an exception for this directory, call:
    git config --global --add safe.directory /workspace
```

This is due to an extra Git check that detects that the Docker user is
not the same one who owns the `.git` directory of this project. After
looking into this, the best solution the internet has to offer is to
thread the current user's UID and GID through the Docker image (i.e.,
the new `builder` user) and then `docker run --user ...`. This both
avoids the Git check but also seems to be considered a best practice in
some circles (?).
In WebAssembly#399, @glandium points out that newer versions of LLVM will place
their version information at a different path. This change adapts WebAssembly#399
to the new Python version script.
@abrown
Copy link
Collaborator Author

abrown commented Mar 18, 2024

@sbc100, @sunfishcode: I rebased this change and re-split the commits as atomic changes on top of main. To solve the Docker build issues, this PR now incorporates the essence of #395 (closing now...). This means that now, unlike what we currently have in main, I am able to run the docker_build.sh script locally.

@abrown abrown merged commit a50a641 into WebAssembly:main Mar 19, 2024
5 checks passed
@abrown abrown deleted the version branch March 19, 2024 17:37
alexcrichton added a commit to alexcrichton/wasi-sdk that referenced this pull request Apr 12, 2024
This commit fixes a minor mistake from WebAssembly#392 where the previous perl
script had a special case that if the "minor" version was zero then the
git hash information wouldn't be printed.
abrown pushed a commit that referenced this pull request Apr 15, 2024
This commit fixes a minor mistake from #392 where the previous perl
script had a special case that if the "minor" version was zero then the
git hash information wouldn't be printed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to tell what version of the WASI-SDK is installed?
2 participants