%bcond_with ld_lld %if %{with ld_lld} %global extra_ldflags -fuse-ld=lld %global _package_note_linker lld %endif Name: test Version: 1 Release: 1 Summary: Test package for checking package notes License: MIT BuildRequires: gcc # For %check BuildRequires: binutils BuildRequires: jq %if %{with ld_lld} BuildRequires: lld %endif %description Test package for checking package notes %build echo 'int main(int argc, char **argv) { return 0; }' | %{build_cc} ${CFLAGS} -x c -c - -o main.o %{build_cc} ${LDFLAGS} %{?extra_ldflags} main.o -o main # Package notes not supported with lld, so the the build succeeding is enough. %if %{without ld_lld} %check # avoid any attempt to access the network by readelf export DEBUGINFOD_URLS= readelf --notes ./main | sed -r -n 's/.*Packaging Metadata: (.*)/\1/p' | tee package-note.text test "`cat package-note.text | jq -r '[.type,.name,.version,.architecture]|join(" ")'`" == "rpm %{name} %{version}-%{release} %{_arch}" %endif %changelog * Sat Aug 6 2022 Jane Doe - 1-1 - Dummy