app-arch/xz-utils: Sync with Gentoo

It's from Gentoo commit 83a27ac5162cf15e1dca6de92f2debe452024d24.
This commit is contained in:
Flatcar Buildbot 2024-04-22 07:10:05 +00:00 committed by Krzesimir Nowak
parent 6b831e2b8d
commit 5053741767

View File

@ -56,9 +56,6 @@ fi
src_prepare() {
default
# Delete known-compromised test data (bug #928134)
rm tests/files/bad-3-corrupt_lzma2.xz tests/files/good-large_compressed.lzma || die
if [[ ${PV} == 9999 ]] ; then
eautopoint
eautoreconf
@ -109,6 +106,7 @@ multilib_src_configure() {
multilib_src_compile() {
# -fprofile-partial-training because upstream note the test suite isn't super comprehensive
# TODO: revisit that now we have the tar/xz loop below?
# See https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html#sec-gcc10-pgo
local pgo_generate_flags=$(usev pgo "-fprofile-update=atomic -fprofile-dir=${T}/${ABI}-pgo -fprofile-generate=${T}/${ABI}-pgo $(test-flags-CC -fprofile-partial-training)")
local pgo_use_flags=$(usev pgo "-fprofile-use=${T}/${ABI}-pgo -fprofile-dir=${T}/${ABI}-pgo $(test-flags-CC -fprofile-partial-training)")
@ -118,6 +116,43 @@ multilib_src_compile() {
if use pgo ; then
emake CFLAGS="${CFLAGS} ${pgo_generate_flags}" -k check
if multilib_is_native_abi ; then
(
shopt -s globstar
tar \
--sort=name --mtime=@2718281828 \
-cf xz-pgo-test-01.tar \
{"${S}","${BUILD_DIR}"}/**/*.[cho] \
{"${S}","${BUILD_DIR}"}/**/*.so* \
{"${S}","${BUILD_DIR}"}/**/**.txt \
{"${S}","${BUILD_DIR}"}/tests/files \
stat --printf="xz-pgo-test-01.tar.tar size: %s\n" xz-pgo-test-01.tar
md5sum xz-pgo-test-01.tar
)
local test_variants=(
# Borrowed from ALT Linux
# https://packages.altlinux.org/en/sisyphus/srpms/xz/specfiles/#line-80
'-0 -C none'
'-2 -C crc32'
'-6 --arm --lzma2 -C crc64'
'-6 --x86 --lzma2=lc=4 -C sha256'
'-7e --format=lzma'
# Our own variants
''
'-9e'
'--x86 --lzma2=preset=9e'
)
local test_variant
for test_variant in "${test_variants[@]}" ; do
"${BUILD_DIR}"/src/xz/xz -c ${test_variant} xz-pgo-test-01.tar | "${BUILD_DIR}"/src/xz/xz -c -d - > /dev/null
assert "Testing '${test_variant}' variant failed"
done
fi
if tc-is-clang; then
llvm-profdata merge "${T}"/${ABI}-pgo --output="${T}"/${ABI}-pgo/default.profdata || die
fi