-
Notifications
You must be signed in to change notification settings - Fork 37.7k
contrib: macdeploy: make gen-sdk deterministic #24534
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
Conversation
c719824
to
13a4a09
Compare
Testing your branch @ 13a4a09: shasum -a 256 Xcode_12.2.xip
28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0 Xcode_12.2.xip
....
contrib/macdeploy/gen-sdk Xcode.app
Found Xcode (version: 12.2, build id: 12B45b)
Found MacOSX SDK (version: 11.0, build id: 20A2408)
Creating output .tar.gz file...
Adding MacOSX SDK 11.0 files...
Adding libc++ headers...
Done! Find the resulting gzipped tarball at:
Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
...
shasum -a 256 Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
a396dd24f61fb55a6d3ec98b8b58fc0b04cdb6b2695039869d04105f885e0867 Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz |
How did you extract the xip file? Via Edit: I tried to unpack the xip file using both methods and despite the extracted folders have different timestamps ( Will investigate further ... |
13a4a09
to
140f8e7
Compare
It seems the default TAR format has changed from GNU to PAX in Python 3.8. This is addressed by change in 140f8e7 which sets the GNU format explicitly. |
Argh, found another culprit - https://bugs.python.org/issue18819 (fixed via python/cpython#18080) Python 3.8 and older use ASCII string This might be fixed by monkey-patching the |
on different Python versions (there was a change in TAR handling between Python 3.8 and Python 3.9)
140f8e7
to
ba30a54
Compare
I monkey-patched the Python bug in ba30a54. The new deterministic hash should be I was able to reproduce this hash on:
|
Concept ACK. |
Nice. I'm now getting a matching hash. ➜ SDK ./contrib/macdeploy/gen-sdk Xcode.app
Found Xcode (version: 12.2, build id: 12B45b)
Found MacOSX SDK (version: 11.0, build id: 20A2408)
Creating output .tar.gz file...
Adding MacOSX SDK 11.0 files...
Adding libc++ headers...
Done! Find the resulting gzipped tarball at:
Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
➜ SDK shasum -a 256 Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
e7ca56bc8804d16624fad68be2e71647747d6629cacaaa3de5fbfa7f444e9eae Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz |
Thanks. Switching from Draft to Ready for review. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Concept ACK. I think having a deterministic MacOS SDK input is very useful, so that we can be sure to start from the same point based on hashes. I think we should at least get this in before the next SDK bump. |
Concept ACK, would love to see this be deterministic but I have a hash mismatch with the resulting archive file. I get the same hash for the downloaded xip file:
But, I get a different hash for the resulting archive file:
|
OS version and Python version? Also what filesystem are you using? |
Tested ACK ba30a54 Output matches the hash in the OP (tried on Ubuntu 22.04, x86_64, Python 3.10.4): $ sha256sum ~/Downloads/Xcode_12.2.xip
28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0 /home/orion/Downloads/Xcode_12.2.xip
$ …/apple-sdk-tools/extract_xcode.py -f ~/Downloads/Xcode_12.2.xip | cpio -d -i
$ …/bitcoin/contrib/macdeploy/gen-sdk $PWD/Xcode.app/
Found Xcode (version: 12.2, build id: 12B45b)
Found MacOSX SDK (version: 11.0, build id: 20A2408)
Creating output .tar.gz file...
Adding MacOSX SDK 11.0 files...
Adding libc++ headers...
Done! Find the resulting gzipped tarball at:
…/apple-sdk-tools/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
$ sha256sum Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
e7ca56bc8804d16624fad68be2e71647747d6629cacaaa3de5fbfa7f444e9eae Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz |
@prusnak That run was Ubuntu 22.04, python 3.10, on arm64 cpu. Will rerun on x86 ubuntu
|
@jarolrod Hm, weird. can you please share the tarball with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK ba30a54
I don't know what had happened in my original run, its possible that on accident I hadn't successfully changed to the PR branch. I re-ran everything on my setup and now I get a matching hash :)
sha256sum ./Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
e7ca56bc8804d16624fad68be2e71647747d6629cacaaa3de5fbfa7f444e9eae ./Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
I think this causes an error while building from the SDK: #24947 |
This PR attempts to make
contrib/macdeploy/gen-sdk
deterministicCan anyone with the
Xcode_12.2.xip
confirm thatgen-sdk
produces the same hash? =>e7ca56bc8804d16624fad68be2e71647747d6629cacaaa3de5fbfa7f444e9eae