sys-libs/libnvme: Sync with Gentoo

It's from Gentoo commit fbdcbbdc767bfccbe12726cc54df9473e6152706.
This commit is contained in:
Flatcar Buildbot 2024-07-01 07:19:38 +00:00 committed by Mathieu Tortuyaux
parent 97358a9bd5
commit ed461f337b
No known key found for this signature in database
GPG Key ID: AC5CCFB52545D9B8
4 changed files with 141 additions and 1 deletions

View File

@ -1,2 +1,3 @@
DIST libnvme-1.7.1.tar.gz 604220 BLAKE2B b02bf0914be73f5877f418bebdbed31dfb019484fb9f6e169c3474d90306706b8e787003a472f13bedb72e90eff39a30ba35df252a3cdf4ea08a362c3f9e221b SHA512 aea986ae35eafa17482e07015228d5a7d529d41148f4cee9e4619adc2460abb5460d60cd91177462cbcaf2e94e5870026ff9e45548f91d9f90b65a6268eb3abb
DIST libnvme-1.8.tar.gz 629032 BLAKE2B cba5215983fa14e485156cf68613a7acca07b7e0fdac41663ebf2246c9f6fd6d1bfcebc7c1457ab4217705769ebea382e85726eb302fd9af6f6b85cec7b2e14d SHA512 ba0cec72fd6c9bb29b29c4342be7b25aec1f31157a094ad387a1105cbd1961ab600e1448a2462d8be2af91d5251b2970d6d06d4871ce96604c5be204d6096bcb
DIST libnvme-1.9.tar.gz 657952 BLAKE2B e9d655709770f7c1d9c916cc9539b8ea096b0d5bf6b12079c2db494f070c98b6c388e2a79ed27a4932994a00d44da93fa3119ee224c48d40347a483548397349 SHA512 39a3346805143f93a17d00cfcb6fb75f82154658db6079134c09dfa989995ac5de79b1ce1ac091b4e997523d3216829ce9eac44110c9f59f9fd21636529c8b25

View File

@ -0,0 +1,59 @@
https://github.com/linux-nvme/libnvme/pull/838
From b3ca2923affce631bc302f0fdce565093ffe1b5b Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 4 May 2024 10:59:16 +0100
Subject: [PATCH] Use C99 types for uint32_t
<stdint.h> provides `uint32_t`, while `u_int_32` is an unofficial/internal
typedef that glibc happens to provide. This fixes the build on musl.
Bug: https://bugs.gentoo.org/931194
Signed-off-by: Sam James <sam@gentoo.org>
--- a/src/nvme/base64.c
+++ b/src/nvme/base64.c
@@ -7,6 +7,7 @@
* Author: Hannes Reinecke <hare@suse.de>
*/
+#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
@@ -29,7 +30,7 @@ static const char base64_table[65] =
int base64_encode(const unsigned char *src, int srclen, char *dst)
{
int i, bits = 0;
- u_int32_t ac = 0;
+ uint32_t ac = 0;
char *cp = dst;
for (i = 0; i < srclen; i++) {
@@ -64,7 +65,7 @@ int base64_encode(const unsigned char *src, int srclen, char *dst)
*/
int base64_decode(const char *src, int srclen, unsigned char *dst)
{
- u_int32_t ac = 0;
+ uint32_t ac = 0;
int i, bits = 0;
unsigned char *bp = dst;
--- a/src/nvme/linux.c
+++ b/src/nvme/linux.c
@@ -1513,10 +1513,10 @@ unsigned char *nvme_import_tls_key(const char *encoded_key, int *key_len,
return NULL;
}
crc = crc32(crc, decoded_key, decoded_len);
- key_crc = ((u_int32_t)decoded_key[decoded_len]) |
- ((u_int32_t)decoded_key[decoded_len + 1] << 8) |
- ((u_int32_t)decoded_key[decoded_len + 2] << 16) |
- ((u_int32_t)decoded_key[decoded_len + 3] << 24);
+ key_crc = ((uint32_t)decoded_key[decoded_len]) |
+ ((uint32_t)decoded_key[decoded_len + 1] << 8) |
+ ((uint32_t)decoded_key[decoded_len + 2] << 16) |
+ ((uint32_t)decoded_key[decoded_len + 3] << 24);
if (key_crc != crc) {
nvme_msg(NULL, LOG_ERR, "CRC mismatch (key %08x, crc %08x)",
key_crc, crc);

View File

@ -12,7 +12,7 @@ SRC_URI="https://github.com/linux-nvme/libnvme/archive/refs/tags/v${PV}.tar.gz -
LICENSE="LGPL-2.1+"
SLOT="0/1"
KEYWORDS="~alpha amd64 ~arm ~arm64 ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc x86"
KEYWORDS="~alpha amd64 ~arm arm64 ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc x86"
IUSE="dbus +json keyutils python ssl test +uuid"
RESTRICT="!test? ( test )"

View File

@ -0,0 +1,80 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
inherit python-r1 meson
DESCRIPTION="C Library for NVM Express on Linux"
HOMEPAGE="https://github.com/linux-nvme/libnvme"
SRC_URI="https://github.com/linux-nvme/libnvme/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="LGPL-2.1+"
SLOT="0/1"
KEYWORDS="~alpha amd64 ~arm ~arm64 ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc x86"
IUSE="dbus +json keyutils python ssl test +uuid"
RESTRICT="!test? ( test )"
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} )
"
DEPEND="
json? ( dev-libs/json-c:= )
keyutils? ( sys-apps/keyutils:= )
dbus? ( sys-apps/dbus:= )
python? ( ${PYTHON_DEPS} )
ssl? ( >=dev-libs/openssl-1.1:= )
uuid? ( sys-apps/util-linux:= )
"
RDEPEND="
${DEPEND}
"
BDEPEND="
dev-lang/swig
"
PATCHES=(
"${FILESDIR}"/${PN}-1.9-musl-stdint.patch
)
src_configure() {
local emesonargs=(
-Dpython=disabled
$(meson_use test tests)
$(meson_feature json json-c)
$(meson_feature dbus libdbus)
$(meson_feature keyutils)
$(meson_feature ssl openssl)
)
meson_src_configure
}
python_compile() {
local emesonargs=(
-Dpython=enabled
)
meson_src_configure --reconfigure
meson_src_compile
}
src_compile() {
meson_src_compile
if use python; then
python_copy_sources
python_foreach_impl python_compile
fi
}
python_install() {
meson_src_install
use python && python_optimize
}
src_install() {
use python && python_foreach_impl python_install
meson_src_install
}