Fix brp-llvm-compile-lto-elf parallelism with hardlinks

Deduplicate the files by inode, so each hardlink is only processed
once, thus avoiding race conditions.

Resolves: rhbz#2234024
This commit is contained in:
Nikita Popov 2023-08-25 15:53:58 +02:00
parent 1b3b6ded14
commit d3f5380a6d
2 changed files with 10 additions and 3 deletions

View File

@ -48,5 +48,7 @@ check_convert_bitcode () {
echo "Checking for LLVM bitcode artifacts"
export -f check_convert_bitcode
find "$RPM_BUILD_ROOT" -type f -name "*.[ao]" -print0 | \
xargs -0 -r -n1 -P$NCPUS sh -c "check_convert_bitcode \$@ $CLANG_FLAGS" ARG0
# Deduplicate by device:inode to avoid processing hardlinks in parallel.
find "$RPM_BUILD_ROOT" -type f -name "*.[ao]" -printf "%d:%i %p\n" | \
awk "!seen[$1]++" | cut -d" " -f2- | \
xargs -d"\n" -r -n1 -P$NCPUS sh -c "check_convert_bitcode \$@ $CLANG_FLAGS" ARG0

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config
Version: 201
Version: 202
Release: 1%{?dist}
# No version specified.
License: GPL+
@ -129,6 +129,7 @@ Requires: %{_bindir}/xargs
# for brp-llvm-compile-lto-elf
Requires: (llvm if clang)
Requires: (gawk if clang)
# -fstack-clash-protection and -fcf-protection require GCC 8.
Conflicts: gcc < 8.0.1-0.22
@ -253,6 +254,10 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%doc buildflags.md
%changelog
* Fri Aug 25 2023 Nikita Popov <npopov@redhat.com> - 202-1
- Fix brp-llvm-compile-lto-elf parallelism with hardlinks
- Resolves: rhbz#2234024
* Mon May 08 2023 Nikita Popov <npopov@redhat.com> - 201-1
- Add llvm dependency if clang toolchain used
- Resolves: rhbz#2193406