Skip to content

Conversation

@FrostyX
Copy link
Member

@FrostyX FrostyX commented Nov 25, 2025

Fix #1652

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses an issue where BuildRequires defined by macros were not being installed before the SRPM rebuild, potentially causing the rebuild to fail. The change moves the dependency installation to an earlier stage, which is the right approach. My review includes one suggestion to improve the code's robustness by using a dedicated helper function for path construction.

@FrostyX FrostyX force-pushed the buildrequires-from-macro branch from 81aa378 to e0f6d5f Compare November 27, 2025 22:08
@FrostyX
Copy link
Member Author

FrostyX commented Nov 27, 2025

I updated the PR so that it doesn't install the dependencies based on the copied-in original SRPM but so that we rather rebuild the SRPM twice as @praiskup suggested. This seems to work too.

I wanted to repeat the loop again and again as long as it still installs new dependencies but both self.install_external(requires) and self.installSrpmDeps(rebuilt_srpm) return None so not possible. Unless we change them too.

@praiskup
Copy link
Member

This is a great start, thank you!

Even with dynamic deps, we do not check for return value, but compare lists of installed packages before/after:

if packages_after == packages_before:

Do you think it makes sense in this case? If yes, I'd prefer having a new configuration option to stop the loop at some reasonable level.

@FrostyX
Copy link
Member Author

FrostyX commented Nov 28, 2025

Ah, really cool, thank you! I added the same condition.

I'd prefer having a new configuration option to stop the loop at some reasonable level.

Do you? I can definitely add a configuration option for that, it's not a problem. To me, it doesn't seem like an option you would want to play with. Your call though, its fine by me either way.

@FrostyX FrostyX force-pushed the buildrequires-from-macro branch from bd14fed to a894aa8 Compare November 28, 2025 21:52
@praiskup
Copy link
Member

praiskup commented Dec 1, 2025

Heh, yes, I think we should have the config option. It's absolutely good to have an option to play with :-) but I like consistency, and the loop for dynamic deps also has its config. And considering this change may have side effects, and cause some build failures, people might want to have an option to turn this looping off (loops = 1)?

@praiskup
Copy link
Member

praiskup commented Dec 1, 2025

Would you mind merging #1661 and rebasing on top of it to have all the checks green?

@praiskup
Copy link
Member

praiskup commented Dec 1, 2025

Tested & works. Thank you. Also with centos-6-x86_64. Tested example:

BuildRequires: tcsh
%if %(test -f /bin/tcsh; echo $?) == 0
BuildRequires: star
%endif

@FrostyX FrostyX force-pushed the buildrequires-from-macro branch from a894aa8 to 383466b Compare December 1, 2025 15:00
@FrostyX
Copy link
Member Author

FrostyX commented Dec 1, 2025

Would you mind merging #1661 and rebasing on top of it to have all the checks green?

Sure, I will wait until it has a green check mark and then merge.

Heh, yes, I think we should have the config option.

Do we want to reuse the self.config.get('dynamic_buildrequires_max_loops') or do we want to have a separate one (e.g. macro_buildrequires_max_loops)?

@FrostyX FrostyX force-pushed the buildrequires-from-macro branch from 383466b to 4dfaa2a Compare December 1, 2025 15:38
@praiskup
Copy link
Member

praiskup commented Dec 1, 2025

Preferably, it would be a separate option; consider somebody wants to disable the new looping mechanism (and leave the dynamic deps looping alone). What if we used static_? Macros are typically included in both, synamic and normal (static?) buildrequires.

@FrostyX FrostyX force-pushed the buildrequires-from-macro branch from 4dfaa2a to e76f780 Compare December 1, 2025 20:42
@FrostyX
Copy link
Member Author

FrostyX commented Dec 1, 2025

Updated, PTAL.

Copy link
Member

@praiskup praiskup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice, thank you @FrostyX !

@praiskup praiskup merged commit 951ec75 into rpm-software-management:main Dec 2, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem of BuildRequires defined by a macro that is not defined in minimal buildroot

2 participants