Skip to content

Commit

Permalink
Set v6 default payload compression to w19T0.zstdio
Browse files Browse the repository at this point in the history
Keep the compression for source packages untouched to keep maximum
forward compatibility for those.

This also enables multi-threaded compression per default.

Resolves: #3312
  • Loading branch information
ffesti committed Dec 4, 2024
1 parent aa72243 commit 13bbdf2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
6 changes: 5 additions & 1 deletion build/pack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions macros.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
22 changes: 22 additions & 0 deletions tests/rpmquery.at
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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])
Expand Down

0 comments on commit 13bbdf2

Please sign in to comment.