app-arch/zstd: Sync with Gentoo

It's from Gentoo commit 01b483bfd328f94bc0d718fdcf0ed8a56166fcb1.
This commit is contained in:
Flatcar Buildbot 2023-09-25 07:10:34 +00:00 committed by Krzesimir Nowak
parent 3103ed0d6e
commit 6fb75b716d
8 changed files with 0 additions and 543 deletions

View File

@ -1,4 +1 @@
DIST zstd-1.4.9.tar.gz 1834843 BLAKE2B 907f492bd023db9459bdc292a0bc4d1b6336d92dd7041eb2b36668589c20fcb98c411b85d78f92cd16d9b4a000d9c4125b5f966a5ca777034ae78210e639315b SHA512 f529db9c094f9ae26428bf1fdfcc91c6d783d400980e0f0d802d2cf13c2be2931465ef568907e03841ff76a369a1447e7371f8799d8526edb9a513ba5c6db133
DIST zstd-1.5.2.tar.gz 1950967 BLAKE2B 9d474e9fdcf7e5eb09d1f606712b05ca3001e8f6f7451254d8dba3f429101048532fd9c84a5b9083ae90d0457e9e1b1d48256581a1697e7db19b09d73595f070 SHA512 e107508a41fca50845cc2494e64adaba93efb95a2fa486fc962510a8ba4b2180d93067cae9870f119e88e5e8b28a046bc2240b0b23cdd8933d1fb1a6a9668c1e
DIST zstd-1.5.4.gh.tar.gz 2161536 BLAKE2B ffc5fcbbdf4ab04bc14b5037308bf4e879d4cbaaf863462ea1e8af3f1b86b935ee6036e49298c83ac42b00472c003e32c263c977f0ae7d64f31d9ae63c5c28cb SHA512 2896a6dd6b60cc251720356babcbab6018c874eb2149121b26e28041496fc355a9cb5fd1b39c91558fcfbafb789b3d721264a0f9b5734f893d5f3cdf97016394
DIST zstd-1.5.5.tar.gz 2368543 BLAKE2B 7680e27a0adacfb809d9fc81e06d3f99bf74df30374d3b5cb2d58f667dd1b7d5c41697e608592709e17c0e32277f20a6d615edee409b5d7cdcb15da2799a2350 SHA512 99109ec0e07fa65c2101c9cb36be56b672bbd0ee69d265f924718e61f9192ae8385c8d9e4d0c318be9edfa6d849fd3d60e5f164fa120961449429ea3c5dab6b6

View File

@ -1,115 +0,0 @@
https://github.com/facebook/zstd/issues/3523
https://github.com/facebook/zstd/pull/3541
From 50e8f55e7d5928af9c3411afdb4fbedb4d8f770d Mon Sep 17 00:00:00 2001
From: "W. Felix Handte" <w@felixhandte.com>
Date: Thu, 9 Mar 2023 12:46:37 -0500
Subject: [PATCH 1/3] Fix Python 3.6 Incompatibility in CLI Tests
--- a/tests/cli-tests/run.py
+++ b/tests/cli-tests/run.py
@@ -535,7 +535,8 @@ def _run_script(self, script: str, cwd: str) -> None:
subprocess.run(
args=[script],
stdin=subprocess.DEVNULL,
- capture_output=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
cwd=cwd,
env=env,
check=True,
From c4c3e11958aed4dc99ec22e3d31c405217575a8c Mon Sep 17 00:00:00 2001
From: "W. Felix Handte" <w@felixhandte.com>
Date: Thu, 9 Mar 2023 12:47:40 -0500
Subject: [PATCH 2/3] Avoid Calling `setvbuf()` on Null File Pointer
--- a/programs/fileio.c
+++ b/programs/fileio.c
@@ -644,18 +644,24 @@ FIO_openDstFile(FIO_ctx_t* fCtx, FIO_prefs_t* const prefs,
#endif
if (f == NULL) {
DISPLAYLEVEL(1, "zstd: %s: %s\n", dstFileName, strerror(errno));
+ } else {
+ /* An increased buffer size can provide a significant performance
+ * boost on some platforms. Note that providing a NULL buf with a
+ * size that's not 0 is not defined in ANSI C, but is defined in an
+ * extension. There are three possibilities here:
+ * 1. Libc supports the extended version and everything is good.
+ * 2. Libc ignores the size when buf is NULL, in which case
+ * everything will continue as if we didn't call `setvbuf()`.
+ * 3. We fail the call and execution continues but a warning
+ * message might be shown.
+ * In all cases due execution continues. For now, I believe that
+ * this is a more cost-effective solution than managing the buffers
+ * allocations ourselves (will require an API change).
+ */
+ if (setvbuf(f, NULL, _IOFBF, 1 MB)) {
+ DISPLAYLEVEL(2, "Warning: setvbuf failed for %s\n", dstFileName);
+ }
}
- /* An increased buffer size can provide a significant performance boost on some platforms.
- * Note that providing a NULL buf with a size that's not 0 is not defined in ANSI C, but is defined
- * in an extension. There are three possibilities here -
- * 1. Libc supports the extended version and everything is good.
- * 2. Libc ignores the size when buf is NULL, in which case everything will continue as if we didn't
- * call `setvbuf`.
- * 3. We fail the call and execution continues but a warning message might be shown.
- * In all cases due execution continues. For now, I believe that this is a more cost-effective
- * solution than managing the buffers allocations ourselves (will require an API change). */
- if(setvbuf(f, NULL, _IOFBF, 1 MB))
- DISPLAYLEVEL(2, "Warning: setvbuf failed for %s\n", dstFileName);
return f;
}
}
From 957a0ae52d0f49eccd260a22ceb5f5dfed064e9f Mon Sep 17 00:00:00 2001
From: "W. Felix Handte" <w@felixhandte.com>
Date: Thu, 9 Mar 2023 12:48:11 -0500
Subject: [PATCH 3/3] Add CLI Test
--- /dev/null
+++ b/tests/cli-tests/file-stat/compress-file-to-dir-without-write-perm.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# motivated by issue #3523
+
+datagen > file
+mkdir out
+chmod 000 out
+
+zstd file -q --trace-file-stat -o out/file.zst
+zstd -tq out/file.zst
+
+chmod 777 out
--- /dev/null
+++ b/tests/cli-tests/file-stat/compress-file-to-dir-without-write-perm.sh.stderr.exact
@@ -0,0 +1,26 @@
+Trace:FileStat: > UTIL_isLink(file)
+Trace:FileStat: < 0
+Trace:FileStat: > UTIL_isConsole(2)
+Trace:FileStat: < 0
+Trace:FileStat: > UTIL_getFileSize(file)
+Trace:FileStat: > UTIL_stat(-1, file)
+Trace:FileStat: < 1
+Trace:FileStat: < 65537
+Trace:FileStat: > UTIL_stat(-1, file)
+Trace:FileStat: < 1
+Trace:FileStat: > UTIL_isDirectoryStat()
+Trace:FileStat: < 0
+Trace:FileStat: > UTIL_stat(-1, file)
+Trace:FileStat: < 1
+Trace:FileStat: > UTIL_isSameFile(file, out/file.zst)
+Trace:FileStat: > UTIL_stat(-1, file)
+Trace:FileStat: < 1
+Trace:FileStat: > UTIL_stat(-1, out/file.zst)
+Trace:FileStat: < 0
+Trace:FileStat: < 0
+Trace:FileStat: > UTIL_isRegularFile(out/file.zst)
+Trace:FileStat: > UTIL_stat(-1, out/file.zst)
+Trace:FileStat: < 0
+Trace:FileStat: < 0
+zstd: out/file.zst: Permission denied
+zstd: can't stat out/file.zst : Permission denied -- ignored

View File

@ -1,61 +0,0 @@
https://bugs.gentoo.org/894058
https://github.com/facebook/zstd/pull/3497
From cc94fac7c879c47984bba7d60d5ce0c9834ff4c7 Mon Sep 17 00:00:00 2001
From: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>
Date: Fri, 10 Feb 2023 19:30:30 -0500
Subject: [PATCH] Use correct types in LZMA comp/decomp
Bytef and uInt are zlib types, not available when zlib is disabled
Fixes: 1598e6c634ac ("Async write for decompression")
Fixes: cc0657f27d81 ("AsyncIO compression part 2 - added async read and asyncio to compression code (#3022)")
---
programs/fileio.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/programs/fileio.c b/programs/fileio.c
index 9a8300cdd8..d3ed9217d5 100644
--- a/programs/fileio.c
+++ b/programs/fileio.c
@@ -1173,8 +1173,8 @@ FIO_compressLzmaFrame(cRess_t* ress,
}
writeJob =AIO_WritePool_acquireJob(ress->writeCtx);
- strm.next_out = (Bytef*)writeJob->buffer;
- strm.avail_out = (uInt)writeJob->bufferSize;
+ strm.next_out = (BYTE*)writeJob->buffer;
+ strm.avail_out = writeJob->bufferSize;
strm.next_in = 0;
strm.avail_in = 0;
@@ -1201,7 +1201,7 @@ FIO_compressLzmaFrame(cRess_t* ress,
writeJob->usedBufferSize = compBytes;
AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob);
outFileSize += compBytes;
- strm.next_out = (Bytef*)writeJob->buffer;
+ strm.next_out = (BYTE*)writeJob->buffer;
strm.avail_out = writeJob->bufferSize;
} }
if (srcFileSize == UTIL_FILESIZE_UNKNOWN)
@@ -2316,8 +2316,8 @@ FIO_decompressLzmaFrame(dRess_t* ress,
}
writeJob = AIO_WritePool_acquireJob(ress->writeCtx);
- strm.next_out = (Bytef*)writeJob->buffer;
- strm.avail_out = (uInt)writeJob->bufferSize;
+ strm.next_out = (BYTE*)writeJob->buffer;
+ strm.avail_out = writeJob->bufferSize;
strm.next_in = (BYTE const*)ress->readCtx->srcBuffer;
strm.avail_in = ress->readCtx->srcBufferLoaded;
@@ -2345,7 +2345,7 @@ FIO_decompressLzmaFrame(dRess_t* ress,
writeJob->usedBufferSize = decompBytes;
AIO_WritePool_enqueueAndReacquireWriteJob(&writeJob);
outFileSize += decompBytes;
- strm.next_out = (Bytef*)writeJob->buffer;
+ strm.next_out = (BYTE*)writeJob->buffer;
strm.avail_out = writeJob->bufferSize;
} }
if (ret == LZMA_STREAM_END) break;

View File

@ -1,67 +0,0 @@
https://github.com/facebook/zstd/pull/3490
From 183a18a45c1d69f8c42b9fcd25e6d28f9b3d75bb Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@archlinux.org>
Date: Fri, 10 Feb 2023 00:28:47 -0500
Subject: [PATCH 1/2] meson: correctly specify the dependency relationship for
playtests
It depends on the zstd program being built, and passes it as an env
variable. Just like datagen. But for datagen, we explicitly depend on
it, while for zstd, we assume it's built as part of "all".
This can be wrong in two cases:
- when running individual tests, meson can (re)build just what is needed
for that one test
- a later patch will handle building zstd but not by default
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -162,7 +162,7 @@ if host_machine_os != os_windows
playTests_sh,
args: opt,
env: ['ZSTD_BIN=' + zstd.full_path(), 'DATAGEN_BIN=./datagen'],
- depends: [datagen],
+ depends: [datagen, zstd],
suite: suite,
workdir: meson.current_build_dir(),
timeout: 2800) # Timeout should work on HDD drive
From 97ab0e2ab60fdda78f610032408df104de20b9f1 Mon Sep 17 00:00:00 2001
From: Eli Schwartz <eschwartz@archlinux.org>
Date: Thu, 9 Feb 2023 23:55:09 -0500
Subject: [PATCH 2/2] meson: always build the zstd binary when tests are
enabled
We need to run it for the tests, even if programs are disabled. So if
they are disabled, create a build rule for the program, but don't
install it. Just make it available for the test itself.
--- a/meson.build
+++ b/meson.build
@@ -132,7 +132,7 @@ endif
subdir('lib')
-if bin_programs
+if bin_programs or bin_tests
subdir('programs')
endif
--- a/programs/meson.build
+++ b/programs/meson.build
@@ -72,7 +72,14 @@ zstd = executable('zstd',
c_args: zstd_c_args,
dependencies: zstd_deps,
export_dynamic: export_dynamic_on_windows, # Since Meson 0.45.0
- install: true)
+ build_by_default: bin_programs,
+ install: bin_programs)
+
+if not bin_programs
+ # we generate rules to build the programs, but don't install anything
+ # so do not continue to installing scripts and manpages
+ subdir_done()
+endif
zstd_frugal_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'),
join_paths(zstd_rootdir, 'programs/timefn.c'),

View File

@ -1,69 +0,0 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit flag-o-matic multilib-minimal toolchain-funcs
DESCRIPTION="zstd fast compression library"
HOMEPAGE="https://facebook.github.io/zstd/"
SRC_URI="https://github.com/facebook/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="|| ( BSD GPL-2 )"
SLOT="0/1"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="lz4 static-libs +threads"
RDEPEND="app-arch/xz-utils
lz4? ( app-arch/lz4 )"
DEPEND="${RDEPEND}"
src_prepare() {
default
multilib_copy_sources
# Workaround #713940 / https://github.com/facebook/zstd/issues/2045
# where upstream build system does not add -pthread for Makefile-based
# build system.
use threads && append-flags $(test-flags-CCLD -pthread)
}
mymake() {
emake \
CC="$(tc-getCC)" \
CXX="$(tc-getCXX)" \
AR="$(tc-getAR)" \
PREFIX="${EPREFIX}/usr" \
LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
"${@}"
}
multilib_src_compile() {
local libzstd_targets=( libzstd{,.a}$(usex threads '-mt' '') )
mymake -C lib ${libzstd_targets[@]} libzstd.pc
if multilib_is_native_abi ; then
mymake HAVE_LZ4="$(usex lz4 1 0)" zstd
mymake -C contrib/pzstd
fi
}
multilib_src_install() {
mymake -C lib DESTDIR="${D}" install
if multilib_is_native_abi ; then
mymake -C programs DESTDIR="${D}" install
mymake -C contrib/pzstd DESTDIR="${D}" install
fi
}
multilib_src_install_all() {
einstalldocs
if ! use static-libs; then
find "${ED}" -name "*.a" -delete || die
fi
}

View File

@ -1,69 +0,0 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit multilib-minimal toolchain-funcs usr-ldscript
DESCRIPTION="zstd fast compression library"
HOMEPAGE="https://facebook.github.io/zstd/"
SRC_URI="https://github.com/facebook/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="|| ( BSD GPL-2 )"
SLOT="0/1"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="lz4 static-libs"
RDEPEND="
app-arch/xz-utils
sys-libs/zlib
lz4? ( app-arch/lz4 )
"
DEPEND="${RDEPEND}"
src_prepare() {
default
multilib_copy_sources
}
mymake() {
emake \
CC="$(tc-getCC)" \
CXX="$(tc-getCXX)" \
AR="$(tc-getAR)" \
PREFIX="${EPREFIX}/usr" \
LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
V=1 \
"${@}"
}
multilib_src_compile() {
local libzstd_targets=( libzstd{,.a}-mt )
mymake -C lib ${libzstd_targets[@]} libzstd.pc
if multilib_is_native_abi ; then
mymake HAVE_LZ4="$(usex lz4 1 0)" zstd
mymake -C contrib/pzstd
fi
}
multilib_src_install() {
mymake -C lib DESTDIR="${D}" install
if multilib_is_native_abi ; then
mymake -C programs DESTDIR="${D}" install
gen_usr_ldscript -a zstd
mymake -C contrib/pzstd DESTDIR="${D}" install
fi
}
multilib_src_install_all() {
einstalldocs
if ! use static-libs; then
find "${ED}" -name "*.a" -delete || die
fi
}

View File

@ -1,79 +0,0 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit meson-multilib usr-ldscript
DESCRIPTION="zstd fast compression library"
HOMEPAGE="https://facebook.github.io/zstd/"
# Drop .gh on next bump (>1.5.4), it's only here as we switched to release
# tarball.
SRC_URI="https://github.com/facebook/zstd/releases/download/v${PV}/${P}.tar.gz -> ${P}.gh.tar.gz"
S="${WORKDIR}"/${P}/build/meson
LICENSE="|| ( BSD GPL-2 )"
SLOT="0/1"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="+lzma lz4 static-libs test zlib"
RESTRICT="!test? ( test )"
RDEPEND="
lzma? ( app-arch/xz-utils )
lz4? ( app-arch/lz4:= )
zlib? ( sys-libs/zlib )
"
DEPEND="${RDEPEND}"
MESON_PATCHES=(
# Workaround until Valgrind bugfix lands
"${FILESDIR}"/${PN}-1.5.4-no-find-valgrind.patch
# Allow building tests w/o programs (useful for multilib)
"${FILESDIR}"/${PN}-1.5.4-tests-no-programs.patch
)
PATCHES=(
# Fix build w/o zlib, bug #894058
"${FILESDIR}"/${P}-fix-no-zlib-build.patch
)
src_prepare() {
cd "${WORKDIR}"/${P} || die
default
cd "${S}" || die
eapply "${MESON_PATCHES[@]}"
}
multilib_src_configure() {
local native_file="${T}"/meson.${CHOST}.${ABI}.ini.local
# This replaces the no-find-valgrind patch once bugfix lands in a meson
# release + we can BDEPEND on it (https://github.com/mesonbuild/meson/pull/11372)
cat >> ${native_file} <<-EOF || die
[binaries]
valgrind='valgrind-falseified'
EOF
local emesonargs=(
-Ddefault_library=$(multilib_native_usex static-libs both shared)
$(meson_native_true bin_programs)
$(meson_native_true bin_contrib)
$(meson_use test bin_tests)
$(meson_native_use_feature zlib)
$(meson_native_use_feature lzma)
$(meson_native_use_feature lz4)
--native-file "${native_file}"
)
meson_src_configure
}
multilib_src_install() {
meson_src_install
multilib_is_native_abi && gen_usr_ldscript -a zstd
}

View File

@ -1,80 +0,0 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit meson-multilib usr-ldscript
DESCRIPTION="zstd fast compression library"
HOMEPAGE="https://facebook.github.io/zstd/"
# Drop .gh on next bump (>1.5.4), it's only here as we switched to release
# tarball.
SRC_URI="https://github.com/facebook/zstd/releases/download/v${PV}/${P}.tar.gz -> ${P}.gh.tar.gz"
S="${WORKDIR}"/${P}/build/meson
LICENSE="|| ( BSD GPL-2 )"
SLOT="0/1"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
IUSE="+lzma lz4 static-libs test zlib"
RESTRICT="!test? ( test )"
RDEPEND="
lzma? ( app-arch/xz-utils )
lz4? ( app-arch/lz4:= )
zlib? ( sys-libs/zlib )
"
DEPEND="${RDEPEND}"
MESON_PATCHES=(
# Workaround until Valgrind bugfix lands
"${FILESDIR}"/${PN}-1.5.4-no-find-valgrind.patch
# Allow building tests w/o programs (useful for multilib)
"${FILESDIR}"/${PN}-1.5.4-tests-no-programs.patch
)
PATCHES=(
# Fix build w/o zlib, bug #894058
"${FILESDIR}"/${P}-fix-no-zlib-build.patch
"${FILESDIR}"/${P}-crash-no-directory.patch
)
src_prepare() {
cd "${WORKDIR}"/${P} || die
default
cd "${S}" || die
eapply "${MESON_PATCHES[@]}"
}
multilib_src_configure() {
local native_file="${T}"/meson.${CHOST}.${ABI}.ini.local
# This replaces the no-find-valgrind patch once bugfix lands in a meson
# release + we can BDEPEND on it (https://github.com/mesonbuild/meson/pull/11372)
cat >> ${native_file} <<-EOF || die
[binaries]
valgrind='valgrind-falseified'
EOF
local emesonargs=(
-Ddefault_library=$(multilib_native_usex static-libs both shared)
$(meson_native_true bin_programs)
$(meson_native_true bin_contrib)
$(meson_use test bin_tests)
$(meson_native_use_feature zlib)
$(meson_native_use_feature lzma)
$(meson_native_use_feature lz4)
--native-file "${native_file}"
)
meson_src_configure
}
multilib_src_install() {
meson_src_install
multilib_is_native_abi && gen_usr_ldscript -a zstd
}