From 13bbdf216560a7495f18babbf378a06cbb25ad06 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Wed, 4 Dec 2024 13:29:24 +0100 Subject: [PATCH] Set v6 default payload compression to w19T0.zstdio Keep the compression for source packages untouched to keep maximum forward compatibility for those. This also enables multi-threaded compression per default. Resolves: #3312 --- build/pack.cc | 6 +++++- macros.in | 6 ++++-- tests/rpmquery.at | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/build/pack.cc b/build/pack.cc index d4e92ef16e..162ea5bd68 100644 --- a/build/pack.cc +++ b/build/pack.cc @@ -286,7 +286,11 @@ static char *getIOFlags(Package pkg) /* If not configured or bogus, fall back to gz */ if (rpmio_flags[0] != 'w') { free(rpmio_flags); - rpmio_flags = xstrdup("w9.gzdio"); + if (pkg->rpmformat >= 6 && !headerIsSource(pkg->header)) { + rpmio_flags = xstrdup("w19T0.zstdio"); + } else { + rpmio_flags = xstrdup("w9.gzdio"); + } } s = strchr(rpmio_flags, '.'); if (s) { diff --git a/macros.in b/macros.in index 613ed5756a..6e16b7b6d8 100644 --- a/macros.in +++ b/macros.in @@ -370,7 +370,7 @@ Supplements: (%{name} = %{version}-%{release} and langpacks-%{1})\ #%packager # Compression type and level for source/binary package payloads. -# "w9.gzdio" gzip level 9 (default). +# "w9.gzdio" gzip level 9 (v4 and srpm default) # "w9.bzdio" bzip2 level 9. # "w6.xzdio" xz level 6, xz's default. # "w7T16.xzdio" xz level 7 using 16 threads @@ -379,11 +379,13 @@ Supplements: (%{name} = %{version}-%{release} and langpacks-%{1})\ # "w6.lzdio" lzma-alone level 6, lzma's default # "w3.zstdio" zstd level 3, zstd's default # "w19T8.zstdio" zstd level 19 using 8 threads -# "w7T0.zstdio" zstd level 7 using %{getncpus} threads +# "w19T0.zstdio" zstd level 19 using %{getncpus} threads +# (v6 default) # "w.ufdio" uncompressed # #%_source_payload w9.gzdio #%_binary_payload w9.gzdio +#%_binary_payload w19T0.zstdio # Algorithm to use for generating file checksum digests on build. # If not specified or 0, MD5 is used. diff --git a/tests/rpmquery.at b/tests/rpmquery.at index 25d698e8da..32bc5ac5f8 100644 --- a/tests/rpmquery.at +++ b/tests/rpmquery.at @@ -1382,6 +1382,16 @@ runroot rpm -qp --filemime /build/RPMS/noarch/filetypes-1.0-1.noarch.rpm | sed - ], []) +RPMTEST_CHECK([ +runroot rpm -qp --requires /build/RPMS/noarch/filetypes-1.0-1.noarch.rpm +], +[0], +[rpmlib(CompressedFileNames) <= 3.0.4-1 +rpmlib(FileDigests) <= 4.6.0-1 +rpmlib(PayloadFilesHavePrefix) <= 4.0-1 +], +[]) + # v6 variants of the same RPMTEST_CHECK([[ runroot rpmbuild -bb --quiet \ @@ -1407,6 +1417,18 @@ runroot rpm -qp --filemime /build/RPMS/noarch/filetypes-1.0-1.noarch.rpm | sed - /opt/myscript.sh text/x-shellscript ], []) + +RPMTEST_CHECK([ +runroot rpm -qp --requires /build/RPMS/noarch/filetypes-1.0-1.noarch.rpm +], +[0], +[rpmlib(CompressedFileNames) <= 3.0.4-1 +rpmlib(FileDigests) <= 4.6.0-1 +rpmlib(LargeFiles) <= 4.12.0-1 +rpmlib(PayloadFilesHavePrefix) <= 4.0-1 +rpmlib(PayloadIsZstd) <= 5.4.18-1 +], +[]) RPMTEST_CLEANUP AT_SETUP([info query output])