Repository navigation
fix(tools): handle macro-based and autorelease Release fields in dist_bump - #118
Closed
mrbobbytables wants to merge 1 commit into
Closed
mrbobbytables wants to merge 1 commit into
mrbobbytables wants to merge 1 commit into
Conversation
…_bump
tools/dist_bump.py crashed or rejected specs when Release: used %autorelease
or macros such as %{baserelease} and conditional release macros like %{?gitdate:...}.
Support macro evaluation in spec_release() by:
- Querying rpmspec if available in the execution environment
- Expanding %autorelease / %{autorelease} (including -b <base>)
- Expanding local %global and %define macros referenced in Release:
- Stripping conditional macros (%{?...})
- Preserving strict BumpError failure if an unresolvable macro remains
Fixes projectbluefin#96
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
hanthor
requested changes
Sep 18, 2026
hanthor
left a comment
Member
There was a problem hiding this comment.
Two PRs solve the same Release: problem; I'm going with #100's shape and would rather not merge this one, for these reasons:
- It expands macros with a hand-written parser (
_strip_conditional_macros,%global/%definescraping, a five-pass substitution loop). The nested-brace walker treats%{and%{?as the same opener and counts closers per character, so a value like%{?foo:%{bar}}%{?dist}is handled, but%{expand:...},%[...]expressions and shell%(...)are not, and the failure mode is a wrong string rather than a refusal.rpmspecwhen present is the right instinct, but it isn't in the CI image for this step, so the fallback is what actually runs. %autorelease→"1"is a guess:%autoreleaseon a spec that has been rebuilt is not1, which is exactly the "two strings that do not mean what they appear to" the module's own docstring warns about. #100 skips the bump for that case and says so on stderr.- On today's
main,tools/rebuild_plan.pyexpectsspec_release()to signal "not comparable" (the testtest_an_autorelease_recipe_falls_back_to_the_versionasserts it); returning"1"for%autoreleasebreaks that.
Thanks for taking it on — the macro-in-Release: gap is real and #96 needed the push. Closing once #100 lands.
Generated by Claude Code
Member
|
Closing per the review; #100 is landing with the simpler approach. Generated by Claude Code |
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.
Resolves #96.
Summary of Changes
tools/dist_bump.pyto support macro evaluation and expansion inspec_release():rpmspec -q --srpm --qf %{RELEASE}ifrpmspecis present in the environment%autorelease/%{autorelease}including base releases specified via-b%globaland%definespec macros (such asbaserelease)%{?...}tags)BumpErrorif unhandled macros remain in the evaluated release stringtests/test_dist_bump.pycovering%autorelease, base flags, spec globals, conditionals, and invalid macros.— hive: backend=copilot model=gemini-3.8-flash
🐝 Hive Agent:
contributor| SHA:f8e61dc