commit:     271edaee5439e8fb4fb76de8ef9d2c559556bc14
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 18 03:33:32 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 18 03:33:39 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=271edaee

sys-libs/libblockdev: add 3.3.0

We don't do REQUIRED_USE="test? ( python )" to avoid blocking up arch
testing, instead conditionalising some bits on either USE=test or USE=python.

Closes: https://bugs.gentoo.org/941787
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/libblockdev/Manifest                      |   1 +
 .../files/libblockdev-3.3.0-fix-bashism.patch      |  24 ++++
 .../files/libblockdev-3.3.0-tests-nvme.patch       |  29 ++++
 .../files/libblockdev-3.3.0-tests-skip-vdo.patch   |  44 ++++++
 sys-libs/libblockdev/libblockdev-3.3.0.ebuild      | 160 +++++++++++++++++++++
 sys-libs/libblockdev/metadata.xml                  |   1 +
 6 files changed, 259 insertions(+)

diff --git a/sys-libs/libblockdev/Manifest b/sys-libs/libblockdev/Manifest
index ad1f4efdf136..a9fc1ab5c882 100644
--- a/sys-libs/libblockdev/Manifest
+++ b/sys-libs/libblockdev/Manifest
@@ -1,2 +1,3 @@
 DIST libblockdev-2.29.tar.gz 935117 BLAKE2B 
774062459602a6f3730ac6e694b3f535daf0258cc5f509ff138bb8c15f44ff46bdc08e32ae1957909b51a191726cf5e9cb418c0317e5178300687947704cf5e0
 SHA512 
0d9637800b189f3824483010d2ff079da11b15ed0b42c578352a0d3cd9c35dab4e5945a3cc31c17ea6f88637548151fc7cf237ac8e9c98edfc7b7bce1a756e01
 DIST libblockdev-3.1.1.tar.gz 1056270 BLAKE2B 
b3dbdc7226524d544193b609ced8a9fee725268ba2201b639c22103fcae6d047c94fb1b848e489525300242cb235d688934193894a06279a4dc0e0b33dff6e96
 SHA512 
44628d9e68a467f8a5d5e65e12d5d6ffb4d9b953c846acd9f6da257eab5ccd79309651d6b20092fa700fb4340f1f718ceef11141203da676d088824aa9d03481
+DIST libblockdev-3.3.0.tar.gz 1157061 BLAKE2B 
42166d0a370b0370b32992208727ba99ae20ac8eee0243d29954f2f45339563e5ca2531f015f5b02dc73e0b10faa637b12adeec0568e5c3fbbf840ef69741b44
 SHA512 
01a980e64ef628ab0f82626a3501f4c157401b56f0ef6e34f91e9f33cb1fd663eb1f56b3563fdee6cd6b431c118bc9be141226867ea765cc703bf3010f10378f

diff --git a/sys-libs/libblockdev/files/libblockdev-3.3.0-fix-bashism.patch 
b/sys-libs/libblockdev/files/libblockdev-3.3.0-fix-bashism.patch
new file mode 100644
index 000000000000..4157c5ba3ca4
--- /dev/null
+++ b/sys-libs/libblockdev/files/libblockdev-3.3.0-fix-bashism.patch
@@ -0,0 +1,24 @@
+https://github.com/storaged-project/libblockdev/pull/1111
+
+From bc1fa125aed4ba6e12a19bd00bb75be21b96f44a Mon Sep 17 00:00:00 2001
+From: Sam James <[email protected]>
+Date: Wed, 18 Jun 2025 04:27:30 +0100
+Subject: [PATCH] configure.ac: fix bashism
+
+configure scripts run with a #!/bin/sh shebang which means they should work
+with a POSIX shell, so avoid using '+=' which is a bashism.
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -310,7 +310,7 @@ AS_IF([test "x$with_smart" != "xno"],
+ 
+ AS_IF([test "x$with_smart" != "xno"],
+       [SAVED_CFLAGS=$CFLAGS
+-       CFLAGS+=" -I$drivedb_path"
++       CFLAGS="${CFLAGS} -I$drivedb_path"
+        AC_MSG_CHECKING([for drivedb.h presence])
+        AC_COMPILE_IFELSE(
+            [AC_LANG_PROGRAM([

diff --git a/sys-libs/libblockdev/files/libblockdev-3.3.0-tests-nvme.patch 
b/sys-libs/libblockdev/files/libblockdev-3.3.0-tests-nvme.patch
new file mode 100644
index 000000000000..19408ee943ea
--- /dev/null
+++ b/sys-libs/libblockdev/files/libblockdev-3.3.0-tests-nvme.patch
@@ -0,0 +1,29 @@
+https://github.com/storaged-project/libblockdev/commit/96e69ff1d60d343e64731e37c36fa5630f19295c
+
+From 96e69ff1d60d343e64731e37c36fa5630f19295c Mon Sep 17 00:00:00 2001
+From: Tomas Bzatek <[email protected]>
+Date: Mon, 7 Apr 2025 18:26:42 +0200
+Subject: [PATCH] tests: Fix NVMe sanitize log return codes
+
+When calling nvme_get_log_sanitize() on a namespace device through
+io_uring codepath, return codes may differ slightly. This is perfectly
+fine, subject to the kernel implementation. In this case the errno 22
+comes directly from io_uring_wait_cqe().
+---
+ tests/nvme_test.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/nvme_test.py b/tests/nvme_test.py
+index 2ce844c0..72dfcf4e 100644
+--- a/tests/nvme_test.py
++++ b/tests/nvme_test.py
+@@ -283,7 +283,7 @@ def test_sanitize_log(self):
+         with self.assertRaisesRegex(GLib.GError, r".*Failed to open device 
.*': No such file or directory"):
+             BlockDev.nvme_get_sanitize_log("/dev/nonexistent")
+ 
+-        message = r"NVMe Get Log Page - Sanitize Status Log command error: 
Invalid Field in Command: A reserved coded value or an unsupported value in a 
defined field|NVMe Get Log Page - Sanitize Status Log command error: 
unrecognized"
++        message = r"NVMe Get Log Page - Sanitize Status Log command error: 
(Invalid Field in Command: A reserved coded value or an unsupported value in a 
defined field|unrecognized|No such file or directory)"
+         with self.assertRaisesRegex(GLib.GError, message):
+             # Cannot retrieve sanitize log on a nvme target loop devices
+             BlockDev.nvme_get_sanitize_log(self.nvme_dev)
+

diff --git a/sys-libs/libblockdev/files/libblockdev-3.3.0-tests-skip-vdo.patch 
b/sys-libs/libblockdev/files/libblockdev-3.3.0-tests-skip-vdo.patch
new file mode 100644
index 000000000000..d6a3ae77bd7b
--- /dev/null
+++ b/sys-libs/libblockdev/files/libblockdev-3.3.0-tests-skip-vdo.patch
@@ -0,0 +1,44 @@
+https://github.com/storaged-project/libblockdev/commit/08a78e8bb33963f0221af08cb115ecf83ecba74e
+
+From 08a78e8bb33963f0221af08cb115ecf83ecba74e Mon Sep 17 00:00:00 2001
+From: Vojtech Trefny <[email protected]>
+Date: Thu, 27 Feb 2025 07:42:40 +0100
+Subject: [PATCH] tests: Skip LVM VDO tests if 'vdoformat' is not available
+
+LVM VDO still uses the vdoformat binary which might not be
+available everywhere.
+
+Related: https://github.com/storaged-project/udisks/issues/1353
+---
+ tests/lvm_dbus_tests.py | 3 +++
+ tests/lvm_test.py       | 3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/tests/lvm_dbus_tests.py b/tests/lvm_dbus_tests.py
+index 644d3587..f28e0a79 100644
+--- a/tests/lvm_dbus_tests.py
++++ b/tests/lvm_dbus_tests.py
+@@ -2116,6 +2116,9 @@ def setUpClass(cls):
+         if lvm_version < Version("2.3.07"):
+             raise unittest.SkipTest("LVM version 2.3.07 or newer needed for 
LVM VDO.")
+ 
++        if not shutil.which("vdoformat"):
++            raise unittest.SkipTest("vdoformat executable not found in $PATH, 
skipping.")
++
+         super().setUpClass()
+ 
+     def setUp(self):
+diff --git a/tests/lvm_test.py b/tests/lvm_test.py
+index 038e580d..0d7fe56f 100644
+--- a/tests/lvm_test.py
++++ b/tests/lvm_test.py
+@@ -1986,6 +1986,9 @@ def setUpClass(cls):
+         if lvm_version < Version("2.3.07"):
+             raise unittest.SkipTest("LVM version 2.3.07 or newer needed for 
LVM VDO.")
+ 
++        if not shutil.which("vdoformat"):
++            raise unittest.SkipTest("vdoformat executable not found in $PATH, 
skipping.")
++
+         super().setUpClass()
+ 
+     def setUp(self):

diff --git a/sys-libs/libblockdev/libblockdev-3.3.0.ebuild 
b/sys-libs/libblockdev/libblockdev-3.3.0.ebuild
new file mode 100644
index 000000000000..a9e3c3e39b47
--- /dev/null
+++ b/sys-libs/libblockdev/libblockdev-3.3.0.ebuild
@@ -0,0 +1,160 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..13} )
+inherit autotools python-single-r1 xdg-utils
+
+DESCRIPTION="Library for manipulating block devices"
+HOMEPAGE="https://github.com/storaged-project/libblockdev";
+
+if [[ ${PV} == *9999 ]] ; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/storaged-project/libblockdev.git";
+       BDEPEND="
+               dev-build/autoconf-archive
+       "
+else
+       
SRC_URI="https://github.com/storaged-project/${PN}/releases/download/${PV}/${P}.tar.gz";
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~ppc64 ~riscv 
~sparc ~x86"
+fi
+
+LICENSE="LGPL-2+"
+SLOT="0/3" # subslot is SOVERSION
+IUSE="+cryptsetup device-mapper escrow gtk-doc introspection lvm +nvme python 
smart test +tools"
+RESTRICT="!test? ( test )"
+
+# sys-fs/e2fsprogs: required by --with-fs
+# virtual/libudev: required at top-level
+RDEPEND="
+       >=dev-libs/glib-2.42.2
+       dev-libs/libbytesize
+       sys-apps/gptfdisk
+       >=sys-apps/kmod-19
+       >=sys-apps/util-linux-2.27
+       sys-fs/e2fsprogs:=
+       virtual/libudev:=
+       cryptsetup? (
+               >=sys-apps/keyutils-1.5.0:=
+               >=sys-fs/cryptsetup-2.7.0:=
+               escrow? (
+                       >=dev-libs/nss-3.18.0
+                       dev-libs/volume_key
+               )
+       )
+       device-mapper? ( sys-fs/lvm2 )
+       lvm? (
+               sys-fs/lvm2
+               virtual/udev
+       )
+       nvme? ( sys-libs/libnvme )
+       python? (
+               ${PYTHON_DEPS}
+               $(python_gen_cond_dep '
+                       dev-python/pygobject:3[${PYTHON_USEDEP}]
+               ')
+       )
+       tools? (
+               >=sys-block/parted-3.1
+       )
+"
+DEPEND="${RDEPEND}"
+BDEPEND+="
+       dev-build/gtk-doc-am
+       gtk-doc? ( dev-util/gtk-doc )
+       introspection? ( >=dev-libs/gobject-introspection-1.3.0 )
+       test? (
+               ${PYTHON_DEPS}
+               $(python_gen_cond_dep '
+                       dev-libs/libbytesize[python,${PYTHON_USEDEP}]
+                       dev-python/dbus-python[${PYTHON_USEDEP}]
+                       dev-python/pyyaml[${PYTHON_USEDEP}]
+               ')
+               sys-apps/lsb-release
+               sys-block/targetcli-fb
+       )
+"
+
+REQUIRED_USE="
+       python? ( ${PYTHON_REQUIRED_USE} )
+       test? ( ${PYTHON_REQUIRED_USE} )
+       escrow? ( cryptsetup )
+       test? ( introspection lvm )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-3.0.4-add-non-systemd-method-for-distro-info.patch"
+       "${FILESDIR}/${PN}-3.3.0-fix-bashism.patch"
+       "${FILESDIR}/${PN}-3.3.0-tests-skip-vdo.patch"
+       "${FILESDIR}/${PN}-3.3.0-tests-nvme.patch"
+)
+
+pkg_setup() {
+       if use python || use test ; then
+               python-single-r1_pkg_setup
+       fi
+}
+
+src_prepare() {
+       default
+
+       xdg_environment_reset # bug #623992
+
+       # bug #744289
+       find -type f \( -name "Makefile.am" -o -name "configure.ac" \) -print0 \
+               | xargs --null sed "s@ -Werror@@" -i || die
+
+       eautoreconf
+}
+
+src_configure() {
+       local myeconfargs=(
+               --with-btrfs
+               --with-fs
+               --with-part
+               --without-mpath
+               --without-nvdimm
+               # dev-libs/libatasmart is inactive upstream, so we just
+               # have USE=smart control sys-apps/smartmontools use.
+               --without-smart
+
+               $(use_enable introspection)
+               $(use_enable test tests)
+               $(use_with cryptsetup crypto)
+               $(use_with device-mapper dm)
+               $(use_with escrow)
+               $(use_with gtk-doc)
+               $(use_with lvm lvm)
+               $(use_with lvm lvm-dbus)
+               $(use_with nvme)
+               $(use_with python python3)
+               $(use_with smart smartmontools)
+               $(use_with tools)
+       )
+
+       econf "${myeconfargs[@]}"
+}
+
+src_test() {
+       # See http://storaged.org/libblockdev/ch03.html
+       # Largest subset which doesn't require root priviledges
+       "${EPYTHON}" tests/run_tests.py --include-tags extradeps sourceonly || 
die
+}
+
+src_install() {
+       default
+
+       find "${ED}" -type f -name "*.la" -delete || die
+
+       # This is installed even with USE=-lvm, but libbd_lvm are omitted so it
+       # doesn't work at all.
+       if ! use lvm ; then
+               rm -f "${ED}"/usr/bin/lvm-cache-stats || die
+       fi
+
+       # bug #718576
+       if use python ; then
+               python_optimize
+       fi
+}

diff --git a/sys-libs/libblockdev/metadata.xml 
b/sys-libs/libblockdev/metadata.xml
index 9480156e8732..a2844378febd 100644
--- a/sys-libs/libblockdev/metadata.xml
+++ b/sys-libs/libblockdev/metadata.xml
@@ -11,6 +11,7 @@
                <flag name="kbd">Enable kernel block device support.</flag>
                <flag name="lvm">Enable support for Logical Volume Management 
via <pkg>sys-fs/lvm2</pkg>.</flag>
                <flag name="nvme">Add nvme support via 
<pkg>sys-libs/libnvme</pkg></flag>
+               <flag name="smart">Add SMART support via 
<pkg>sys-apps/smartmontools</pkg></flag>
                <flag name="tools">Build tools</flag>
                <flag name="vdo">Enable Virtual Data Optimizer support.</flag>
        </use>

Reply via email to