On Tue, Sep 22, 2026 at 11:32:24AM -0400, Neal Gompa wrote:
> The %clean section is obsolete because we already define a default
> %clean stage in RPM itself since rpm 4.8 in 2009:
> https://github.com/rpm-software-management/rpm/commit/3fc58248d23d6f720942e5cbf4f92db246a802f0
>
> And modern default %clean handles all the weird multi-buildroot stuff
> that is now supported since RPM 4.20. Using --noclean turns all that
> stuff off, and can result in broken build results.
One of the reasons for introducing per-package build directories in 4.20 was to
make cleanup straightforward (since each package built gets its own directory
under %{_top_builddir}). What the default %cleanup stage (called "rmbuild" in
the rpmbuild output nowadays) does is just removing that directory (and perhaps
restoring some permissions in order to do that).
AIUI, Mock does every build in a separate chroot (that it cleans up by itself)
and so skipping the rmbuild phase shouldn't really matter.
As for the %clean section in spec files, that's indeed obsolete anyway. Doing a
quick query in my local Fedora spec collection reveals 15 specs that still have
that section. I haven't seen them all, but some just do the really obsolete and
redundant stuff like "rm -rf $RPM_BUILD_ROOT".
One special use case for %clean that I've known about is systemd.spec where the
section is used to clean up the source tree in --build-in-place mode, to remove
some known build artifacts (such as the *.list files created by find-debuginfo)
that would otherwise pollute the source tree on repeated builds. But that will
soon be (hopefully) fixed upstream [1] and shouldn't matter to Mock anyway.
[1] https://github.com/rpm-software-management/rpm/pull/4293
--
Michal Domonkos / RPM.org / Red Hat
--
_______________________________________________
devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it:
https://forge.fedoraproject.org/infra/tickets/issues/new