refactor(scripts): one implementation of per-architecture library selection - #2350
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Selecting the per-architecture slice of a vendored static library existed in five places that disagreed with each other. It is now one function in
scripts/lib/macos.sh, the library #2336 introduced.What was there
build-release.shcarried four near-identical functions, 159 lines between them:prepare_mariadbcd Libs, thin the universal onlyprepare_libpqprepare_libmongocprepare_hiredisand
scripts/ci/prepare-libs.shdid a barecp "Libs/${lib}_${ARCH}.a"with no fallback at all. So the release path and the CI step took different sources for the same library, and two of the four could not use a per-architecture file even when one existed.build-release.shdrops from 693 lines to 529.A regression I introduced and then caught by running it
The shared function first keeps a library that is already correct, which the originals expressed as:
That is a substring test, and a universal library contains
arm64, so it matches. Faithful tobuild-release.sh, but not toci/prepare-libs.sh, whose unconditionalcpalways produced a thin library. Porting the substring form would have left fat libraries in place and quietly changed the release to link those.Running it is what showed this: after the first version,
prepare-libs.sh arm64reportedlibpq.a x86_64 arm64. The check is now an exact architecture match, so both callers produce a thin library, which is what the release path has always effectively had.Verified
scripts/ci/prepare-libs.shwas run for real, both ways:Running it twice for the same architecture is a no-op, and a missing library fails naming it rather than leaving a half-prepared tree.
Libs/was restored afterwards and re-verified against the checksum baseline committed in git.The extracted function was diffed against the original
prepare_hiredisoperation by operation: same three branches in the same order, the only textual difference being$LIBS_DIRin place of a relativeLibs/, which also makes it independent of the caller's working directory.build-release.shitself is not run here, because it signs and notarizes.https://claude.ai/code/session_013MEaba8K1HQcyDNeq5wEFk