Use %{buildsubdir} in %_package_note_file if defined

Thanks to this the file is (in the common case) created in the unpacked
build directory, and not one level up. I.e.
/builddir/build/BUILD/lirc-0.10.0/.package_note-lirc-0.10.0-34.fc36.x86_64
instead of /builddir/build/BUILD/.package_note-lirc-0.10.0-34.fc36.x86_64.ld.
This is nicer esp. for 'fedpkg local' builds, where the dist-git directory is
used as the build dir.

When there are multiple %setup calls, the *last* extracted directory
becomes %{buildsubdir}. This might be confusing, but it shouldn't cause
problems for this use.

Suggested in https://bugzilla.redhat.com/show_bug.cgi?id=2043092#c21.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-01-21 16:34:39 +01:00
parent d32fe6caa2
commit b7381d643d

View File

@ -1,7 +1,7 @@
# Add an ELF note with information about the package the code was compiled for.
# See https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects
# for details.
%_package_note_file %{_builddir}/.package_note-%{name}-%{version}-%{release}.%{_arch}.ld
%_package_note_file %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.package_note-%{name}-%{version}-%{release}.%{_arch}.ld
%_package_note_flags %{?_package_note_file:%{?name:%["%_target_cpu" == "noarch"?"":"-Wl,-dT,%{_package_note_file}"]}}