Skip to content

Conversation

@ekohl
Copy link
Member

@ekohl ekohl commented Nov 22, 2025

In a fresh environment you need the foreman-build package, but you can't build that without foreman itself. This uses RPM conditionals to only build the foreman-build and foreman-plugin packages.

It moves the macro definition next to the mkdir statement to have fewer if statements.

To use this you need to define the with option at the chroot level. I've opened theforeman/obal#419 for that and working on the end-to-end pieces. Once that's merged you can use:

obal copr-project foreman-copr -e bootstrap=true
obal release foreman
obal copr-project foreman-copr

This is useful if you want to fully bootstrap it from scratch in your own user. It can also be used to start building a new OS (version) or architecture but then it needs some manual tweaking.

@ekohl ekohl requested a review from a team as a code owner November 22, 2025 16:01
@ekohl
Copy link
Member Author

ekohl commented Nov 22, 2025

This may be an effect of the conditionals I use. Needs some further investigation.

[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec:875: W: macro-in-%changelog %generate_buildrequires
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec:875: W: macro-in-%changelog %prep
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/

This is allowed in RPM 4.20+ but I guess the version used here is older:

foreman/foreman.spec: E: specfile-error warning: extra tokens at the end of %endif directive in line 358:  %endif # without bootstrap
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error warning: extra tokens at the end of %endif directive in line 505:  %endif # without bootstrap
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error warning: extra tokens at the end of %endif directive in line 521:  %endif # without bootstrap
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error warning: extra tokens at the end of %endif directive in line 548:  %endif # without bootstrap
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error warning: extra tokens at the end of %endif directive in line 647:  %endif # without bootstrap
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error warning: extra tokens at the end of %endif directive in line 736:  %endif # without bootstrap
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error
[2025-11-22T16:02:12.874Z]         /home/jenkins/workspace/foreman-packaging-rpm-copr-pr-test/packages/foreman/foreman/foreman.spec: E: specfile-error warning: extra tokens at the end of %endif directive in line 856:  %endif # without bootstrap

@ogajduse
Copy link
Member

The two warnings we see are caused by

* Tue Sep 30 2025 Odilon Sousa <osousa@redhat.com> - 3.17.0-0.2.develop
- Update %generate_buildrequires macro section after the %prep phase

We could modify that changelog entry to dismiss the warnings.

To fix the errors, we either need to upgrade the RPM or we put that comment on the line above or below the conditional. Is there any other way?

Copy link
Member

@ogajduse ogajduse left a comment

Choose a reason for hiding this comment

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

Structurally LGTM

@ekohl ekohl force-pushed the rpm/develop-bootstap-foreman branch from cd8fd32 to 999ea95 Compare November 29, 2025 16:30
@ekohl
Copy link
Member Author

ekohl commented Nov 29, 2025

Rebased to clean the rpmlint warning and also changed the endif statements to be compatible with EL9 RPM.

@ekohl ekohl force-pushed the rpm/develop-bootstap-foreman branch from 999ea95 to a547aa5 Compare November 29, 2025 17:29
@ekohl
Copy link
Member Author

ekohl commented Nov 29, 2025

I didn't want to add a separate changelog just for the removal of % signs, but also didn't want to squish it into the other commit so I left it out again.

Edit: it's back; I messed up the original changelog entry but that's fixed now.

@ekohl ekohl force-pushed the rpm/develop-bootstap-foreman branch from a547aa5 to 80644ed Compare November 29, 2025 17:33
@ekohl ekohl force-pushed the rpm/develop-bootstap-foreman branch from 80644ed to 4db1a52 Compare December 18, 2025 17:04
In a fresh environment you need the foreman-build package, but you can't
build that without foreman itself. This uses RPM conditionals[1] to only
build the foreman-build and foreman-plugin packages.

It moves the macro definition next to the mkdir statement to have fewer
if statements.

[1]: https://rpm-software-management.github.io/rpm/manual/conditionalbuilds.html
This introduces a single variable to configure the buildroot as either
bootstrapping or not.

Recommended way of using it:

    obal copr-project foreman-copr -e bootstrap=true
    obal release foreman
    obal copr-project foreman-copr

Then build all the required packages.
@ekohl ekohl force-pushed the rpm/develop-bootstap-foreman branch from 4db1a52 to 524a24c Compare December 19, 2025 15:29
@evgeni
Copy link
Member

evgeni commented Jan 7, 2026

How did a build from this PR end up in the staging repo?!

https://stagingyum.theforeman.org/foreman/nightly/el9/x86_64/foreman-3.18.0-0.3.develop.el9.noarch.rpm has

* Sat Nov 22 2025 Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl> - 3.18.0-0.3.develop
- Allow bootstrapping the package

in the changelog

@ekohl
Copy link
Member Author

ekohl commented Jan 7, 2026

Because I messed up a command and my user has the permissions. I deleted the copr build, will see about nightly too. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants