sys-libs/libblockdev: enable tests

* Patch is test specific so revbump is unnesessary.

Signed-off-by: Alfred Wingate <parona@protonmail.com>
Signed-off-by: Marek Szuba <marecki@gentoo.org>
This commit is contained in:
Alfred Wingate
2023-11-24 18:13:17 +02:00
committed by Marek Szuba
parent b9e72d723a
commit 1d4d1949ad
2 changed files with 40 additions and 7 deletions

View File

@@ -0,0 +1,30 @@
From ec8cab726abe60ba5c7ffcce07905b29c5376163 Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Mon, 13 Nov 2023 16:21:44 +0200
Subject: [PATCH] Add non-systemd method to get distro name and version
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -514,10 +514,16 @@ def get_version():
""" Try to get distro and version
"""
- bus = dbus.SystemBus()
+ try:
+ bus = dbus.SystemBus()
+
+ # get information about the distribution from systemd (hostname1)
+ sys_info = bus.get_object("org.freedesktop.hostname1", "/org/freedesktop/hostname1")
+ except dbus.exceptions.DBusException:
+ import platform
+ info = platform.freedesktop_os_release()
+ return (info["NAME"], info["VERSION_ID"])
- # get information about the distribution from systemd (hostname1)
- sys_info = bus.get_object("org.freedesktop.hostname1", "/org/freedesktop/hostname1")
cpe = str(sys_info.Get("org.freedesktop.hostname1", "OperatingSystemCPEName", dbus_interface=dbus.PROPERTIES_IFACE))
if cpe:
--
2.42.1

View File

@@ -22,9 +22,7 @@ fi
LICENSE="LGPL-2+"
SLOT="0/3" # subslot is SOVERSION
IUSE="+cryptsetup device-mapper escrow gtk-doc introspection lvm +nvme test +tools"
# Tests require root. In a future release, we may be able to run a smaller
# subset with new run_tests.py arguments.
RESTRICT="!test? ( test ) test"
RESTRICT="!test? ( test )"
RDEPEND="
>=dev-libs/glib-2.42.2
@@ -70,7 +68,13 @@ BDEPEND+="
"
REQUIRED_USE="${PYTHON_REQUIRED_USE}
escrow? ( cryptsetup )"
escrow? ( cryptsetup )
test? ( introspection lvm )
"
PATCHES=(
"${FILESDIR}/libblockdev-3.0.4-add-non-systemd-method-for-distro-info.patch"
)
pkg_setup() {
python-single-r1_pkg_setup
@@ -111,9 +115,8 @@ src_configure() {
src_test() {
# See http://storaged.org/libblockdev/ch03.html
# The 'check' target just does Pylint.
# ... but it needs root.
emake test
# Largest subset which doesn't require root priviledges
${EPYTHON} tests/run_tests.py --include-tags extradeps sourceonly || die
}
src_install() {