Closes #30145.
This PR solves two major issues in the parse_version_string
function of verify-binaries:
-aarch64
binaries cannot be specifically downloaded. The -platform string gets interpreted as a release candidate that doesn’t exist due to containing sub-string “rc”.- Specifying a platform with a “-” in the name causes the parser to ignore both “-platform” AND “-rcN” and download the potentially wrong (non-rc) version for every platform. This also prevented specifying just one platform binary the user wished to download.
It also updates the accompanying test.py
to cover problem two and adds two examples that were formerly broken to README.md
to show what is now possible. Including the most useful case of downloading only 1 specific platform’s binary.
This improves the Bitcoin verify-binaries tools user experience by not:
- Failing to download for inexplicable reasons,
- Downloading more files than what the user told it to, or in the worst case
- Downloading only the wrong files.
- A test was added to cover the command
verify-binaries/verify.py pub 22.0-x86_64-linux-gnu.tar.gz
which checks that bitcoin-22.0-x86_64-linux-gnu.tar.gz downloads successfully AND ONLY bitcoin-22.0-x86_64-linux-gnu.tar.gz downloads. - The steps to reproduce each bug are in the referenced issue #30145. Explanation of the potential issue as well as reasoning for the way the bug was fixed are in my commit descriptions.
- This delivers the promised feature of “only download the binaries for a certain platform”, by allowing strings with ‘-’ to be accepted, allowing for single file downloads for any specific platform which was not always possible before.
- Removes 6 lines of code from the offending
parse_version_string
function, while fixing the bugs/errors, and extending the functionality to be practical for users with slow connections. - Makes the error message more helpful when no file matches the provided platform string, now prints “Did you mean:
closest-match
” to help correct typos.
Thanks for reading my PR. I look forward to getting this helpful tool in its best shape yet.
Log of this branch passing the new test.py:
0python3 test.py
1✓ 'Nonexistent version should fail' passed
2✓ 'Malformed version should fail' passed
3✓ '--min-good-sigs 20 should fail' passed
4- testing verification (22.0-x86_64-linux-gnu.tar.gz)
5✓ '22.0-x86_64-linux-gnu.tar.gz should succeed' passed
6- testing verification (22.0)
7✓ '22.0 should succeed' passed
Log of master failing the new test.py:
0python3 test.py
1✓ 'Nonexistent version should fail' passed
2✓ 'Malformed version should fail' passed
3✓ '--min-good-sigs 20 should fail' passed
4- testing verification (22.0-x86_64-linux-gnu.tar.gz)
5✓ '22.0-x86_64-linux-gnu.tar.gz should succeed' passed
6Traceback (most recent call last):
7 File "/home/ben/Documents/GitHub/bitcoin/contrib/verify-binaries/test.py", line 74, in <module>
8 main()
9 File "/home/ben/Documents/GitHub/bitcoin/contrib/verify-binaries/test.py", line 27, in main
10 assert len(v) == 1
11 ^^^^^^^^^^^
12AssertionError