* [gentoo-commits] repo/gentoo:master commit in: dev-libs/libkdumpfile/files/, dev-libs/libkdumpfile/
@ 2024-08-27 21:04 Sam James
0 siblings, 0 replies; only message in thread
From: Sam James @ 2024-08-27 21:04 UTC (permalink / raw
To: gentoo-commits
commit: 5fa70534e895c7a9b14bfca589fd862711a5cdff
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 27 20:43:39 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 27 21:03:38 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5fa70534
dev-libs/libkdumpfile: new package, add 0.5.4
Hopefully we can drop the deprecated Python bindings here in future
but they're needed by drgn for now.
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-libs/libkdumpfile/Manifest | 1 +
.../files/libkdumpfile-0.5.4-32-bit-tests.patch | 73 ++++++++++++++++++++++
.../files/libkdumpfile-0.5.4-c99.patch | 48 ++++++++++++++
...dumpfile-0.5.4-disabled-compression-tests.patch | 68 ++++++++++++++++++++
dev-libs/libkdumpfile/libkdumpfile-0.5.4.ebuild | 71 +++++++++++++++++++++
dev-libs/libkdumpfile/metadata.xml | 11 ++++
6 files changed, 272 insertions(+)
diff --git a/dev-libs/libkdumpfile/Manifest b/dev-libs/libkdumpfile/Manifest
new file mode 100644
index 000000000000..14ac192613b4
--- /dev/null
+++ b/dev-libs/libkdumpfile/Manifest
@@ -0,0 +1 @@
+DIST libkdumpfile-0.5.4.tar.bz2 623108 BLAKE2B 17a425c2a0545f60574255d5ec139f60a59dd2c9c047a89f9d021afe31cae959c691b550d9ad4e10c88a11f5f1bab1a4d94dab025060dcd2598837442281b3b9 SHA512 6cdd77e3460b324f4e0641fc8f4cf1dcd8b7de4ec82a37ca11e4edfa7730f90305c2724825f8b1cf8ac2e8ad104fee1b6a36775287b084db802ae2f44a55cd85
diff --git a/dev-libs/libkdumpfile/files/libkdumpfile-0.5.4-32-bit-tests.patch b/dev-libs/libkdumpfile/files/libkdumpfile-0.5.4-32-bit-tests.patch
new file mode 100644
index 000000000000..4b5c0cb4c8fc
--- /dev/null
+++ b/dev-libs/libkdumpfile/files/libkdumpfile-0.5.4-32-bit-tests.patch
@@ -0,0 +1,73 @@
+https://github.com/ptesarik/libkdumpfile/commit/16c73b83a78c1bfb55f3e9823b09fce549c8ec11
+
+From 16c73b83a78c1bfb55f3e9823b09fce549c8ec11 Mon Sep 17 00:00:00 2001
+From: Petr Tesarik <petr@tesarici.cz>
+Date: Thu, 23 May 2024 13:01:17 +0200
+Subject: [PATCH] Fix file cache test for 32-bit architectures
+
+If 64-bit file offsets are selected with _FILE_OFFSET_BITS on a 32-bit
+architecture, the default mmap() call takes a 64-bit off_t, but dlsym()
+returns a pointer to a function that takes a 32-bit off_t.
+
+To fix it:
+
+- always call original mmap64() if it is available,
+- use XSTRINGIFY(mmap) instead of "mmap".
+
+The latter is needed, because some systems define mmap as a macro which
+expands to another identifier.
+
+Fixes: #80
+Signed-off-by: Petr Tesarik <petr@tesarici.cz>
+---
+ configure.ac | 2 ++
+ src/kdumpfile/test-fcache.c | 13 ++++++++++++-
+ 3 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 04d1c6fa..93ebb39d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -61,6 +61,8 @@ AC_CHECK_SIZEOF(long)
+ AC_CHECK_SIZEOF(off_t)
+ AC_SUBST(SIZEOF_OFF_T, $ac_cv_sizeof_off_t)
+
++AC_CHECK_FUNCS(mmap64)
++
+ dnl This makes sure pkg.m4 is available.
+ m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
+
+diff --git a/src/kdumpfile/test-fcache.c b/src/kdumpfile/test-fcache.c
+index 1ed57447..604ed540 100644
+--- a/src/kdumpfile/test-fcache.c
++++ b/src/kdumpfile/test-fcache.c
+@@ -64,9 +64,20 @@ static char *mmapbuf;
+
+ static int failmmap;
+
++#ifdef HAVE_MMAP64
++
++#define STR_MMAP XSTRINGIFY(mmap64)
++static void* (*orig_mmap)(void *addr, size_t length, int prot, int flags,
++ int fd, off64_t offset);
++
++#else
++
++#define STR_MMAP XSTRINGIFY(mmap)
+ static void* (*orig_mmap)(void *addr, size_t length, int prot, int flags,
+ int fd, off_t offset);
+
++#endif
++
+ void *
+ mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset)
+ {
+@@ -445,7 +456,7 @@ main(int argc, char **argv)
+ return TEST_ERR;
+ }
+
+- orig_mmap = dlsym(RTLD_NEXT, "mmap");
++ orig_mmap = dlsym(RTLD_NEXT, STR_MMAP);
+ if (!orig_mmap) {
+ fprintf(stderr, "Cannot get original mmap() address: %s\n",
+ dlerror());
diff --git a/dev-libs/libkdumpfile/files/libkdumpfile-0.5.4-c99.patch b/dev-libs/libkdumpfile/files/libkdumpfile-0.5.4-c99.patch
new file mode 100644
index 000000000000..959af60454ef
--- /dev/null
+++ b/dev-libs/libkdumpfile/files/libkdumpfile-0.5.4-c99.patch
@@ -0,0 +1,48 @@
+https://github.com/ptesarik/libkdumpfile/commit/3682f5cad70146ab35d05af251d4461ef650b4b5
+
+From 3682f5cad70146ab35d05af251d4461ef650b4b5 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Thu, 4 Jan 2024 12:36:53 +0100
+Subject: [PATCH] Python 3 does not have a tp_print member in PyTypeObject
+
+This avoids an int-conversion compiler error with current
+compilers:
+
+./kdumpfile.c:1449:9: error: initialization of 'long int' from 'int (*)(PyObject *, FILE *, int)' {aka 'int (*)(struct _object *, FILE *, int)'} makes integer from pointer without a cast
+ 1449 | attr_dir_print, /* tp_print*/
+ | ^~~~~~~~~~~~~~
+
+
+In Python 3.11, the field at this position is called tp_vectorcall_offset
+and has type Py_ssize_t, hence the error.
+--- a/python/kdumpfile.c
++++ b/python/kdumpfile.c
+@@ -1143,7 +1143,6 @@ attr_dir_repr(PyObject *_self)
+ Py_XDECREF(colon);
+ return result;
+ }
+-#endif
+
+ static int
+ attr_dir_print(PyObject *_self, FILE *fp, int flags)
+@@ -1214,6 +1213,7 @@ attr_dir_print(PyObject *_self, FILE *fp, int flags)
+ kdump_attr_iter_end(ctx, &iter);
+ return -1;
+ }
++#endif
+
+ static PyObject *
+ attr_iterkey_new(PyObject *_self)
+@@ -1446,7 +1446,11 @@ static PyTypeObject attr_dir_object_type =
+ sizeof(char), /* tp_itemsize*/
+ /* methods */
+ attr_dir_dealloc, /* tp_dealloc*/
++#if PY_MAJOR_VERSION < 3
+ attr_dir_print, /* tp_print*/
++#else
++ 0,
++#endif
+ 0, /* tp_getattr*/
+ 0, /* tp_setattr*/
+ 0, /* tp_compare*/
+
diff --git a/dev-libs/libkdumpfile/files/libkdumpfile-0.5.4-disabled-compression-tests.patch b/dev-libs/libkdumpfile/files/libkdumpfile-0.5.4-disabled-compression-tests.patch
new file mode 100644
index 000000000000..5748a27e1e81
--- /dev/null
+++ b/dev-libs/libkdumpfile/files/libkdumpfile-0.5.4-disabled-compression-tests.patch
@@ -0,0 +1,68 @@
+https://github.com/ptesarik/libkdumpfile/commit/d529a573ab2cdbda501309e377007812e6de3351
+
+From d529a573ab2cdbda501309e377007812e6de3351 Mon Sep 17 00:00:00 2001
+From: Stephen Brennan <stephen.s.brennan@oracle.com>
+Date: Fri, 19 Jan 2024 11:52:24 -0800
+Subject: [PATCH] tests: skip tests which apply to disabled compression
+
+If configured --without-libzstd, for example, the diskdump-basic-zstd
+test will return an ERROR code, causing "make check" to fail. Even using
+XFAIL_TESTS will not resolve the error, because the return code is
+ERROR, not FAIL.
+
+Instead, conditionally include the tests based on whether we are
+compiling with each compression format. This way, we don't test
+unsupported features.
+
+Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
+---
+ m4/compression.m4 | 1 +
+ tests/Makefile.am | 17 +++++++++++++----
+ 2 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/m4/compression.m4 b/m4/compression.m4
+index 6755ef13..8cb7ce2d 100644
+--- a/m4/compression.m4
++++ b/m4/compression.m4
+@@ -32,4 +32,5 @@ AC_SUBST([$2][_REQUIRES])
+ AC_SUBST([$2][_CFLAGS])
+ AC_SUBST([$2][_LIBS])
+ AC_SUBST([$2][_PC_LIBS])
++AM_CONDITIONAL(HAVE_$2, test "x$have_$1" = xyes)
+ ])
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 0c03b20b..8ac90b39 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -196,10 +196,6 @@ test_scripts = \
+ diskdump-empty-s390x \
+ diskdump-empty-x86_64 \
+ diskdump-basic-raw \
+- diskdump-basic-zlib \
+- diskdump-basic-lzo \
+- diskdump-basic-snappy \
+- diskdump-basic-zstd \
+ diskdump-flat-raw \
+ diskdump-multiread \
+ diskdump-excluded \
+@@ -331,6 +327,19 @@ test_scripts = \
+ xlat-xen-x86_64-4.6-bigmem \
+ zero-size
+
++if HAVE_ZSTD
++test_scripts += diskdump-basic-zstd
++endif
++if HAVE_ZLIB
++test_scripts += diskdump-basic-zlib
++endif
++if HAVE_LZO
++test_scripts += diskdump-basic-lzo
++endif
++if HAVE_SNAPPY
++test_scripts += diskdump-basic-snappy
++endif
++
+ dist_check_DATA = \
+ addrmap-single-begin.expect \
+ addrmap-single-middle.expect \
+
diff --git a/dev-libs/libkdumpfile/libkdumpfile-0.5.4.ebuild b/dev-libs/libkdumpfile/libkdumpfile-0.5.4.ebuild
new file mode 100644
index 000000000000..fe48a9f877fc
--- /dev/null
+++ b/dev-libs/libkdumpfile/libkdumpfile-0.5.4.ebuild
@@ -0,0 +1,71 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+inherit autotools python-r1
+
+DESCRIPTION="Kernel coredump file access"
+HOMEPAGE="https://github.com/ptesarik/libkdumpfile"
+SRC_URI="https://github.com/ptesarik/libkdumpfile/releases/download/v${PV}/${P}.tar.bz2"
+
+LICENSE="|| ( LGPL-3+ GPL-2+ )"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="lzo snappy zlib zstd"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="
+ ${PYTHON_DEPS}
+ lzo? ( dev-libs/lzo )
+ snappy? ( app-arch/snappy:= )
+ zlib? ( sys-libs/zlib )
+ zstd? ( app-arch/zstd:= )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-c99.patch
+ "${FILESDIR}"/${P}-disabled-compression-tests.patch
+ "${FILESDIR}"/${P}-32-bit-tests.patch
+)
+
+src_prepare() {
+ default
+
+ # Can drop on next release >0.5.4
+ eautoreconf
+}
+
+src_configure() {
+ # We could make Python optional in future as libkdumpfile's
+ # builtin Python bindings appear deprecated in favour of another
+ # CFFI-based approach, but given we're adding libkdumpfile for
+ # dev-debug/drgn right now which uses *these*, let's not bother.
+ local ECONF_SOURCE=${S}
+ local myeconfargs=(
+ $(use_with lzo lzo2)
+ $(use_with snappy)
+ $(use_with zlib)
+ $(use_with zstd libzstd)
+ )
+
+ python_foreach_impl run_in_build_dir econf "${myeconfargs[@]}"
+}
+
+src_compile() {
+ python_foreach_impl run_in_build_dir default
+}
+
+src_test() {
+ python_foreach_impl run_in_build_dir default
+}
+
+src_install() {
+ python_foreach_impl run_in_build_dir default
+ python_foreach_impl python_optimize
+ einstalldocs
+ find "${D}" -name '*.la' -delete || die
+}
diff --git a/dev-libs/libkdumpfile/metadata.xml b/dev-libs/libkdumpfile/metadata.xml
new file mode 100644
index 000000000000..57d3a905a40e
--- /dev/null
+++ b/dev-libs/libkdumpfile/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>sam@gentoo.org</email>
+ <name>Sam James</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">ptesarik/libkdumpfile</remote-id>
+ </upstream>
+</pkgmetadata>
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-08-27 21:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 21:04 [gentoo-commits] repo/gentoo:master commit in: dev-libs/libkdumpfile/files/, dev-libs/libkdumpfile/ Sam James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox