Rpmbuild appends -build suffix to source dirs in BUILD directory

I build a number of RPM packages for Redhat, Rocky and SUSE.

Starting with Leap-16, when I run rpmbuild the unpacked source in the BUILD dir now appends -build to the dir name so
package-source1.2 now becomes
pacakge-source1.2-build

this breaks all my existing spec files.
is there a way to revert to the old behaviour, without the -build suffix?

@zedaardv Hi and welcome to the Forum :smile:
AFAIK, that is an internal change in rpm/rpmbuild, are you setting the buildroot variable in your spec file(s)?

It executes a Executing(%mkbuilddir): before %prep now…

  • Leap 15.6;
[   42s] + exec rpmbuild -ba --define '_srcdefattr (-,root,root)' --nosignature --define '_build_create_debug 1' --define 'disturl obs://build.opensuse.org/X11:Wayland/15.6/af73894ef9b95c3c5db0ea7d22ecf1a4-ashell' /home/abuild/rpmbuild/SOURCES/ashell.spec
[   42s] setting SOURCE_DATE_EPOCH=1779278400
[   42s] Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.zqkNT4
[   42s] + umask 022
[   42s] + cd /home/abuild/rpmbuild/BUILD
[   42s] + cd /home/abuild/rpmbuild/BUILD
[   42s] + rm -rf ashell-0.8.0+466
  • Leap 16.0;
[   20s] + exec rpmbuild -ba --define '_srcdefattr (-,root,root)' --nosignature --define '_build_create_debug 1' --define 'disturl obs://build.opensuse.org/X11:Wayland/16.0/af73894ef9b95c3c5db0ea7d22ecf1a4-ashell' /home/abuild/rpmbuild/SOURCES/ashell.spec
[   20s] using SOURCE_DATE_EPOCH with value 1779297916 as build time
[   20s] Executing(%mkbuilddir): /usr/bin/bash -e /var/tmp/rpm-tmp.HNoxSa
[   20s] Executing(%prep): /usr/bin/bash -e /var/tmp/rpm-tmp.x25TbA
[   20s] + umask 022
[   20s] + cd /home/abuild/rpmbuild/BUILD/ashell-0.8.0+466-build
[   20s] + cd /home/abuild/rpmbuild/BUILD/ashell-0.8.0+466-build
[   20s] + rm -rf ashell-0.8.0+466

Thanks.
I use my own macro files for definitions like buildroot.
I the reference them in my spec files.

If this is a change in rpmbuild, redhat/rocky 10 still behave as expected.

Is the %mkbuilddir then responsible for this change, and if so, can I override it?

This has changed with version 4.20 i think. Redhat 10 is still using 4.19.
Just a untested guess you could try someting like :

%define _builddir  %{_topdir}/BUILD
%define builddir   %{_topdir}/BUILD
%define mkbuilddir %nil

Sorry unfortunately it doesn’t work that way.