build: Rename PACKAGE_* variables to CLIENT_* #31042

pull hebasto wants to merge 3 commits into bitcoin:master from hebasto:241006-prefix changing 55 files +151 −151
  1. hebasto commented at 9:37 pm on October 6, 2024: member

    The use of PACKAGE_NAME for the project’s variable name is problematic, as this name is commonly used in CMake’s interface variables. If third-party CMake code handles with scopes improperly, our PACKAGE_NAME variable could end up with an unexpected value.

    This PR avoids such conflicts by renaming all PACKAGE_* variables to CLIENT_*.

    The code in the master branch works correctly only incidentally. It is definitely broken in #30997.

  2. hebasto added the label Build system on Oct 6, 2024
  3. DrahtBot commented at 9:37 pm on October 6, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK TheCharlatan
    Stale ACK pablomartin4btc

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #bitcoin-core/gui/762 (Update about logo icon (colour) to denote the chain type of the QT instance in About/ Help Message Window/ Dialog by pablomartin4btc)
    • #31157 (Cleanups to port mapping module post UPnP drop by darosior)
    • #31149 (tinyformat: enforce compile-time checks for format string literals by stickies-v)
    • #31130 (Drop miniupnp dependency by darosior)
    • #31072 (refactor: Clean up messy strformat and bilingual_str usages by ryanofsky)
    • #31061 (refactor: Check translatable format strings at compile-time by maflcko)
    • #30988 (Split CConnman by vasild)
    • #30909 (wallet, assumeutxo: Don’t Assume m_chain_tx_count, Improve wallet RPC errors by fjahr)
    • #29686 (Update manpage descriptions by willcl-ark)
    • #29641 (scripted-diff: Use LogInfo over LogPrintf [WIP, NOMERGE, DRAFT] by maflcko)
    • #28710 (Remove the legacy wallet and BDB dependency by achow101)

    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.

  4. in CMakeLists.txt:52 in 5f5f3e81f9 outdated
    46@@ -47,14 +47,14 @@ project(BitcoinCore
    47   LANGUAGES NONE
    48 )
    49 
    50-set(PACKAGE_VERSION ${PROJECT_VERSION})
    51+set(BITCOIN_PACKAGE_VERSION ${PROJECT_VERSION})
    52 if(CLIENT_VERSION_RC GREATER 0)
    53-  string(APPEND PACKAGE_VERSION "rc${CLIENT_VERSION_RC}")
    54+  string(APPEND BITCOIN_PACKAGE_VERSION "rc${CLIENT_VERSION_RC}")
    


    maflcko commented at 6:27 am on October 7, 2024:
    nit: When renaming this, wouldn’t it make more sense to use the CLIENT_VERSION_ prefix here as well? (Maybe the two other variables others could use the CLIENT_ prefix as well?)

    hebasto commented at 7:17 am on October 7, 2024:
    Thanks! Updated per your feedback.

    maflcko commented at 1:52 pm on October 10, 2024:

    It seems CLIENT_NAME is already used in a different (non-build) context to denote the “user agent name”. Maybe a preparatory commit could be added to change that to UA_NAME, for clarity and to avoid a name clash?

    0$ git grep --line-number CLIENT_NAME 
    1src/clientversion.cpp:23:const std::string CLIENT_NAME("Satoshi");
    2src/clientversion.h:36:extern const std::string CLIENT_NAME;
    3src/init.cpp:1470:    strSubVersion = FormatSubVersion(CLIENT_NAME, CLIENT_VERSION, uacomments);
    

    fanquake commented at 2:02 pm on October 10, 2024:
    I think if we end up doingthat, we should extend this to renaming other source variables that exist in the PACKAGE_ namespace. This PR as-is is already changing things such that naming becomes more inconsistent in that regard.

    hebasto commented at 12:27 pm on October 11, 2024:
    Thanks! Reworked per feedback.
  5. hebasto force-pushed on Oct 7, 2024
  6. hebasto renamed this:
    build: Rename `PACKAGE_*` variables to `BITCOIN_PACKAGE_*`
    build: Rename `PACKAGE_*` variables to `CLIENT_*`
    on Oct 7, 2024
  7. DrahtBot added the label CI failed on Oct 7, 2024
  8. DrahtBot removed the label CI failed on Oct 7, 2024
  9. pablomartin4btc commented at 8:31 pm on October 7, 2024: member
    ACK c87a9d2e4c0ad7f2653857f34d7e048585f00be2
  10. maflcko added the label DrahtBot Guix build requested on Oct 8, 2024
  11. hebasto commented at 1:23 pm on October 8, 2024: member
    Friendly ping @ryanofsky @theuni :)
  12. DrahtBot commented at 3:40 pm on October 8, 2024: contributor

    Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

    File commit 62e4516722115c2d5aeb6c197abc73ca7c078b23(master) commit 5ed6cea3d9c1a90f262749bb5cdeaa0d9686d68e(master and this pull)
    SHA256SUMS.part f2d49fb72517ef0c... 5005efffcf410479...
    *-aarch64-linux-gnu-debug.tar.gz d37cbe26a25f7540... 3f36a94db3e92d66...
    *-aarch64-linux-gnu.tar.gz 42b4d4db0c531caf... 63ff5a599fe8b19a...
    *-arm-linux-gnueabihf-debug.tar.gz 63eddcf3cfdb6c32... c0cf87d19e7eeb27...
    *-arm-linux-gnueabihf.tar.gz fd2eb3904357b5f4... 39bf6e96d0321ba8...
    *-arm64-apple-darwin-unsigned.tar.gz 71a08c8f938313cf... 66071da60789cfd8...
    *-arm64-apple-darwin-unsigned.zip ed11994d8f055418... 6fd1ec5eb314df65...
    *-arm64-apple-darwin.tar.gz 0c11a002f4f3030c... 5e085108ec8ca844...
    *-powerpc64-linux-gnu-debug.tar.gz a76483c3abcddcc1... 90df5b5ffc6f8d2f...
    *-powerpc64-linux-gnu.tar.gz 335ec17b370a19d5... 2c19cf3041bb430b...
    *-riscv64-linux-gnu-debug.tar.gz 8494e354e088382e... 2465908aa76e7efe...
    *-riscv64-linux-gnu.tar.gz 457df2421685bdda... 98b4e7a065d219fc...
    *-x86_64-apple-darwin-unsigned.tar.gz 3cedc5861a78c8a5... 944bd6e444d3074c...
    *-x86_64-apple-darwin-unsigned.zip 19b332dccbc792b4... 1169a427b1a26c57...
    *-x86_64-apple-darwin.tar.gz 54c6788eb266f818... 7d62f24640f698f5...
    *-x86_64-linux-gnu-debug.tar.gz a761c3712ed00392... 84e9676d3421743a...
    *-x86_64-linux-gnu.tar.gz fceda20d8f50b5ab... 0c91cd3c3f4d58fa...
    *.tar.gz 38978a4be1a7c7eb... a6d8a1494135eebd...
    guix_build.log 022bedb7b63b12f2... 098d5b76f7a1c904...
    guix_build.log.diff e451373908777661...
  13. DrahtBot removed the label DrahtBot Guix build requested on Oct 8, 2024
  14. DrahtBot added the label Needs rebase on Oct 10, 2024
  15. hebasto force-pushed on Oct 11, 2024
  16. hebasto marked this as a draft on Oct 11, 2024
  17. DrahtBot added the label CI failed on Oct 11, 2024
  18. DrahtBot commented at 10:35 am on October 11, 2024: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/31403424642

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  19. hebasto force-pushed on Oct 11, 2024
  20. hebasto marked this as ready for review on Oct 11, 2024
  21. DrahtBot removed the label CI failed on Oct 11, 2024
  22. DrahtBot removed the label Needs rebase on Oct 11, 2024
  23. DrahtBot added the label Needs rebase on Oct 21, 2024
  24. hebasto force-pushed on Oct 22, 2024
  25. hebasto commented at 9:40 am on October 22, 2024: member
    Rebased due to the conflict with the merged #26334.
  26. fanquake commented at 11:13 am on October 22, 2024: member

    It is definitely broken in #30997.

    Shouldn’t #30997 be based on this PR then (or at least mention in the PR description it’s expected to be broken)?

  27. DrahtBot removed the label Needs rebase on Oct 22, 2024
  28. maflcko added the label DrahtBot Guix build requested on Oct 24, 2024
  29. hebasto force-pushed on Oct 24, 2024
  30. hebasto commented at 12:52 pm on October 24, 2024: member

    It is definitely broken in #30997.

    Shouldn’t #30997 be based on this PR then (or at least mention in the PR description it’s expected to be broken)?

    Done.

  31. hebasto force-pushed on Oct 24, 2024
  32. DrahtBot added the label CI failed on Oct 24, 2024
  33. DrahtBot commented at 2:00 pm on October 24, 2024: contributor

    🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/32008030836

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

  34. in cmake/module/GenerateSetupNsi.cmake:9 in 333c66f05c outdated
     4@@ -5,8 +5,8 @@
     5 function(generate_setup_nsi)
     6   set(abs_top_srcdir ${PROJECT_SOURCE_DIR})
     7   set(abs_top_builddir ${PROJECT_BINARY_DIR})
     8-  set(PACKAGE_URL ${PROJECT_HOMEPAGE_URL})
     9-  set(PACKAGE_TARNAME "bitcoin")
    10+  set(CLIENT_URL ${PROJECT_HOMEPAGE_URL})
    11+  set(CLIENT_TARNAME "bitcoin")
    


    fanquake commented at 3:35 pm on October 24, 2024:
    In b75d532ca4703e26f59c7d33a882a6c1295784ed: The CLIENT_TARNAME re-naming is incomplete.

    hebasto commented at 3:40 pm on October 24, 2024:
    Thanks! Fixed.
  35. hebasto force-pushed on Oct 24, 2024
  36. pablomartin4btc commented at 5:01 pm on October 24, 2024: member

    re-ACK 36a3de0af9a9120aa98a07ca4abbb77ee6e58ef9

    Since my previous review: extended renaming to the rest of sources where PACKAGE_ namespace existed.

  37. DrahtBot removed the label CI failed on Oct 24, 2024
  38. DrahtBot commented at 5:15 am on October 25, 2024: contributor

    Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

    File commit 74fb19317aec6d5156e12da6be63e59e0cc99770(master) commit 18c78924030c038e2df0674ce06048283f0b3e71(master and this pull)
    SHA256SUMS.part ad80f9275f7592f5... 105f7e99fe2ea776...
    *-aarch64-linux-gnu-debug.tar.gz e3f077c9e2efe42c... d941af501de3c4bc...
    *-aarch64-linux-gnu.tar.gz 84c5837e967a705e... c789aa4991d87907...
    *-arm-linux-gnueabihf-debug.tar.gz 198436220bbb764e... 3141966da9a55a69...
    *-arm-linux-gnueabihf.tar.gz 8ab9ee456035f028... e9d2ada88260f063...
    *-arm64-apple-darwin-unsigned.tar.gz 5f3493c8841e7000... cd6c42f626601e75...
    *-arm64-apple-darwin-unsigned.zip 53586205b08dae04... f7e514b0c15f7f63...
    *-arm64-apple-darwin.tar.gz 9bc61a1a9c494690... 18d89fae96719424...
    *-powerpc64-linux-gnu-debug.tar.gz d736c35074e1ab00... d432fb4e0d5ecdbb...
    *-powerpc64-linux-gnu.tar.gz dc3411d9d8e023d0... d2cdc438582b7920...
    *-riscv64-linux-gnu-debug.tar.gz 14f550c7e6be73cb... d458b01297d7d6f7...
    *-riscv64-linux-gnu.tar.gz a5ce20b057de5651... 8cca56c53745b49c...
    *-x86_64-apple-darwin-unsigned.tar.gz 0a5aeae59a745fdd... bfff017a6e65f5d3...
    *-x86_64-apple-darwin-unsigned.zip c17d6c147152032f... d34ff50cdbe2148b...
    *-x86_64-apple-darwin.tar.gz eb310f282a01918f... 4eb8c4509b9386d2...
    *-x86_64-linux-gnu-debug.tar.gz 788598dd19a44259... da42106f8faa2beb...
    *-x86_64-linux-gnu.tar.gz 6b13f937a5601c35... 3f4c088c211451f5...
    *.tar.gz d344eb18d56160d8... a12f34aad2744538...
    guix_build.log baf52e47221c27f4... 93b59c7bc5b0979d...
    guix_build.log.diff 9e667259d151f4f3...
  39. DrahtBot removed the label DrahtBot Guix build requested on Oct 25, 2024
  40. TheCharlatan approved
  41. TheCharlatan commented at 12:12 pm on October 26, 2024: contributor

    ACK 36a3de0af9a9120aa98a07ca4abbb77ee6e58ef9

    The last two commits could be squashed together though? I don’t think that would complicate the scripted diff.

  42. hebasto force-pushed on Oct 26, 2024
  43. hebasto commented at 12:28 pm on October 26, 2024: member

    The last two commits could be squashed together though? I don’t think that would complicate the scripted diff.

    Thanks! Squashed.

  44. TheCharlatan approved
  45. TheCharlatan commented at 12:37 pm on October 26, 2024: contributor
    Re-ACK 2076a0863ce6e7fcd5a1f2c29c38c1305816e57d
  46. DrahtBot requested review from pablomartin4btc on Oct 26, 2024
  47. DrahtBot added the label Needs rebase on Oct 28, 2024
  48. scripted-diff: Clarify "user agent" variable name
    This change allows to the use of the `CLIENT_` namespace without
    potential name clashes.
    
    -BEGIN VERIFY SCRIPT-
    sed -i "s/\<CLIENT_NAME\>/UA_NAME/g" $( git grep -l "CLIENT_NAME" ./src)
    -END VERIFY SCRIPT-
    e6e29e3c94
  49. build: Rename `PACKAGE_*` variables to `CLIENT_*`
    The use of `PACKAGE_NAME` for the project's variable name is
    problematic, as this name is commonly used in CMake's interface
    variables. If third-party CMake code handles with scopes improperly,
    our `PACKAGE_NAME` variable could end up with an unexpected value.
    
    This change avoids such conflicts by renaming all `PACKAGE_*` variables
    to `CLIENT_*`.
    332655cb52
  50. scripted-diff: Rename `PACKAGE_*` variables to `CLIENT_*`
    This change ensures consistent use of the `CLIENT_` namespace everywhere
    in the repository.
    
    -BEGIN VERIFY SCRIPT-
    
    ren() { sed -i "s/\<$1\>/$2/g" $( git grep -l "$1" ./cmake ./src :\(exclude\)./src/secp256k1 ./test ) ; }
    
    ren PACKAGE_NAME      CLIENT_NAME
    ren PACKAGE_VERSION   CLIENT_VERSION_STRING
    ren PACKAGE_URL       CLIENT_URL
    ren PACKAGE_BUGREPORT CLIENT_BUGREPORT
    
    -END VERIFY SCRIPT-
    70713303b6
  51. hebasto force-pushed on Oct 28, 2024
  52. hebasto commented at 12:37 pm on October 28, 2024: member
    Rebased due to the conflict with the merged #31130.
  53. TheCharlatan approved
  54. TheCharlatan commented at 1:16 pm on October 28, 2024: contributor
    Re-ACK 70713303b6399e0627c1960da4fbab48f9cf71e7
  55. DrahtBot removed the label Needs rebase on Oct 28, 2024
  56. fanquake commented at 3:22 pm on October 28, 2024: member

    Guix Build:

     02df1f3823c8f689140e3a400f0fdc49d4fe0d2bc4d29402d9765bf9821147b28  guix-build-70713303b639/output/aarch64-linux-gnu/SHA256SUMS.part
     133a4689e3200b0fbd56d8098b33cf9388baebe641d27dd6dc09813f56ea2abb1  guix-build-70713303b639/output/aarch64-linux-gnu/bitcoin-70713303b639-aarch64-linux-gnu-debug.tar.gz
     235f43ddc81853d054544bbe70d7d8461867c026a7b4d3c9ae90ee248bf28c9de  guix-build-70713303b639/output/aarch64-linux-gnu/bitcoin-70713303b639-aarch64-linux-gnu.tar.gz
     3b87c9dd6990934021ef5a421e46d0159b822b1ddd4457a7bcbad3ab0763eb279  guix-build-70713303b639/output/arm-linux-gnueabihf/SHA256SUMS.part
     4da4a4a1dcee0d6b0f210b25b8e0320dda1f2249efb90a7677cafcf2f00c1eb56  guix-build-70713303b639/output/arm-linux-gnueabihf/bitcoin-70713303b639-arm-linux-gnueabihf-debug.tar.gz
     5925b1d6cf6fb2c59a34c74a05053278d88ed7ee84ddeb960f39599835fd31a8e  guix-build-70713303b639/output/arm-linux-gnueabihf/bitcoin-70713303b639-arm-linux-gnueabihf.tar.gz
     61a36013e0f1585b5c8ffe4e39fa24638481a2c38d8dafc9aaaece11698236b92  guix-build-70713303b639/output/arm64-apple-darwin/SHA256SUMS.part
     79bfcbd2ddc619ccca320424a0520e79f8489c28207093e855bba48322a48f24a  guix-build-70713303b639/output/arm64-apple-darwin/bitcoin-70713303b639-arm64-apple-darwin-unsigned.tar.gz
     859c841f7b385bd9645cef3e4b1a5f93b2ef577a276e06418f919180ee23d7e4d  guix-build-70713303b639/output/arm64-apple-darwin/bitcoin-70713303b639-arm64-apple-darwin-unsigned.zip
     957019be46ef95ea27ca5a4fb3d29c78782988fbe15ee893aa912b43b3da7dfa0  guix-build-70713303b639/output/arm64-apple-darwin/bitcoin-70713303b639-arm64-apple-darwin.tar.gz
    10ab6762e153f42dfb37d21d205c14a9ff3fd381b74141a45b9ea38ee129e856e5  guix-build-70713303b639/output/dist-archive/bitcoin-70713303b639.tar.gz
    11fb9b9719b2769406a6d7d4ad05d737b954c51f374385cb44a336272c3c291736  guix-build-70713303b639/output/powerpc64-linux-gnu/SHA256SUMS.part
    12d4f2cdf931b7bba6c4d9291ea930659c04fd6a7a3a9682c5268ee96145861c97  guix-build-70713303b639/output/powerpc64-linux-gnu/bitcoin-70713303b639-powerpc64-linux-gnu-debug.tar.gz
    13f9db6ed69d00b9dfaa72fe7a0658e19b3c841ea0b4ada59a5cd4659dd330d392  guix-build-70713303b639/output/powerpc64-linux-gnu/bitcoin-70713303b639-powerpc64-linux-gnu.tar.gz
    148167118fcef084f28831e6bece33eb2061404fa0f7e96d629a95d3f329ba5310  guix-build-70713303b639/output/riscv64-linux-gnu/SHA256SUMS.part
    15819cd35f0c32a68a545347adb0f6bc6e53c0d243a4bacf37cebf99b400648b35  guix-build-70713303b639/output/riscv64-linux-gnu/bitcoin-70713303b639-riscv64-linux-gnu-debug.tar.gz
    16521107405bccfd2032356dd06227391d696ebaf1edf87a24330b4d78bb55af49  guix-build-70713303b639/output/riscv64-linux-gnu/bitcoin-70713303b639-riscv64-linux-gnu.tar.gz
    171eb6cbf97f5c9a0e66c204b141f6f4780374242b05ac2f55e47fdb571abbafda  guix-build-70713303b639/output/x86_64-apple-darwin/SHA256SUMS.part
    18509038ecfac467f801f06078868bf52de2918928faea4d2aae9a5784732f976c  guix-build-70713303b639/output/x86_64-apple-darwin/bitcoin-70713303b639-x86_64-apple-darwin-unsigned.tar.gz
    19213a190c1cfed5f40089b078cef860ffc1ba3a0bedc7e489e89658db40718bef  guix-build-70713303b639/output/x86_64-apple-darwin/bitcoin-70713303b639-x86_64-apple-darwin-unsigned.zip
    20691f5cd5e4f9659ef15161cc4f30a797c6abd803f60e4eeba36b9d391b23981d  guix-build-70713303b639/output/x86_64-apple-darwin/bitcoin-70713303b639-x86_64-apple-darwin.tar.gz
    213c2b462b300659fcf46537c67ceac879f3d5e850c988bb172bb6514dac7701c0  guix-build-70713303b639/output/x86_64-linux-gnu/SHA256SUMS.part
    222d9cc4effcc041f87fb6054e56a206694ccf133c32ae62dc4bb6f2107a589beb  guix-build-70713303b639/output/x86_64-linux-gnu/bitcoin-70713303b639-x86_64-linux-gnu-debug.tar.gz
    23b3d11e2a55ae7cf03f601527816052214596e2270190f89a151eac4e8796c465  guix-build-70713303b639/output/x86_64-linux-gnu/bitcoin-70713303b639-x86_64-linux-gnu.tar.gz
    24225ec52f051ec7410b29f30b9c36898f330fb5d94267f242b39a18711b4bbe37  guix-build-70713303b639/output/x86_64-w64-mingw32/SHA256SUMS.part
    258f022cecbedf22324778983b9d8b7351d24a1d51297e7124f06bf82cc5490bbd  guix-build-70713303b639/output/x86_64-w64-mingw32/bitcoin-70713303b639-win64-debug.zip
    260243301dcff8850146901e77b0e58659594fb7108193004c11fa46d5ded439e9  guix-build-70713303b639/output/x86_64-w64-mingw32/bitcoin-70713303b639-win64-setup-unsigned.exe
    2797938f0053cf1f361817d8bb750461a809f05983ea7d030d61222c53053e91e7  guix-build-70713303b639/output/x86_64-w64-mingw32/bitcoin-70713303b639-win64-unsigned.tar.gz
    288e205188361743d291fe4317741a05b7d205c6a7df22c07338a1aaad49159507  guix-build-70713303b639/output/x86_64-w64-mingw32/bitcoin-70713303b639-win64.zip
    
  57. fanquake merged this on Oct 28, 2024
  58. fanquake closed this on Oct 28, 2024

  59. hebasto deleted the branch on Oct 28, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-11-21 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me