Ville Skyttä wrote:
The above looks ok on first sight, and would look even better if
%buildroot was defined as
%{_tmppath}/%{name}-%{version}-%{release}-%{_target_cpu} which I'd
assume to take care of the multiarch simultaneous build issue and not
really obfuscate things at all.
Too bad it doesn't work very well, for "BuildArch: noarch" packages,
%{buildroot} ends up ending with -noarch here as expected, but
$RPM_BUILD_ROOT ends with -x86_64. And for example many scripts
in /usr/lib/rpm operate on $RPM_BUILD_ROOT. On the other hand, explicit
--target to rpmbuild affects both consistently, so I suppose BuildArch
(not limited to noarch) in specfiles kicks in too late to affect
$RPM_BUILD_ROOT. Reproducer: try rpmbuild -bp with this specfile and
the above %buildroot definition in macros somewhere:
---
Name: foo
...
BuildArch: noarch
%description
%prep
echo %{buildroot}
echo $RPM_BUILD_ROOT
---
/var/tmp/foo-1-1-noarch
/var/tmp/foo-1-1-x86_64
Yuck, though, in practice mostly harmless, since we enforce the consistent
use (ie, not mixing) of either %buildroot or $RPM_BUILD_ROOT.
-- Rex