1 Commits

4 changed files with 207 additions and 4 deletions

View File

@@ -0,0 +1,102 @@
Subject: Add osinfo_firmware_is_recommended()
From: Charles Arnold carnold@suse.com Mon Feb 9 10:29:46 2026 -0700
Date: Mon Feb 9 22:48:58 2026 +0100:
Git: 2229c890d4ee1dcae59fa60aec7b7f6a058e3189
The function allows an OS to declare efi as recommended for
its security features while still supporting legacy bios.
Tools like virt-manager may then query the database for this
attribute and default to the recommended firmware if specified.
Signed-off-by: Charles Arnold <carnold@suse.com>
diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index ae5fee3..a47fbc7 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -646,6 +646,12 @@ LIBOSINFO_1.10.0 {
osinfo_tree_matches;
} LIBOSINFO_1.8.0;
+LIBOSINFO_1.13.0 {
+ global:
+
+ osinfo_firmware_is_recommended;
+} LIBOSINFO_1.10.0;
+
/* Symbols in next release...
LIBOSINFO_0.0.2 {
diff --git a/osinfo/osinfo_firmware.c b/osinfo/osinfo_firmware.c
index c397c70..3be35ad 100644
--- a/osinfo/osinfo_firmware.c
+++ b/osinfo/osinfo_firmware.c
@@ -214,3 +214,19 @@ gboolean osinfo_firmware_is_supported(OsinfoFirmware *firmware)
return osinfo_entity_get_param_value_boolean(OSINFO_ENTITY(firmware),
OSINFO_FIRMWARE_PROP_SUPPORTED);
}
+
+/**
+ * osinfo_firmware_is_recommended:
+ * @firmware: an #OsinfoFirmware instance
+ *
+ * Whether the @firmware is recommended or not
+ *
+ * Returns: TRUE if recommended, FALSE otherwise.
+ *
+ * Since: 1.13.0
+ */
+gboolean osinfo_firmware_is_recommended(OsinfoFirmware *firmware)
+{
+ return osinfo_entity_get_param_value_boolean(OSINFO_ENTITY(firmware),
+ OSINFO_FIRMWARE_PROP_RECOMMENDED);
+}
diff --git a/osinfo/osinfo_firmware.h b/osinfo/osinfo_firmware.h
index 5959788..d7379d9 100644
--- a/osinfo/osinfo_firmware.h
+++ b/osinfo/osinfo_firmware.h
@@ -36,8 +36,10 @@ OSINFO_DECLARE_TYPE_WITH_PRIVATE_AND_CLASS(OsinfoFirmware,
#define OSINFO_FIRMWARE_PROP_ARCHITECTURE "architecture"
#define OSINFO_FIRMWARE_PROP_TYPE "type"
#define OSINFO_FIRMWARE_PROP_SUPPORTED "supported"
+#define OSINFO_FIRMWARE_PROP_RECOMMENDED "recommended"
OsinfoFirmware *osinfo_firmware_new(const gchar *id, const gchar *architecture, const gchar *type);
const gchar *osinfo_firmware_get_architecture(OsinfoFirmware *firmware);
const gchar *osinfo_firmware_get_firmware_type(OsinfoFirmware *firmware);
gboolean osinfo_firmware_is_supported(OsinfoFirmware *firmware);
+gboolean osinfo_firmware_is_recommended(OsinfoFirmware *firmware);
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index b3fd453..0775167 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -1350,7 +1350,9 @@ static OsinfoFirmware *osinfo_loader_firmware(OsinfoLoader *loader,
gchar *arch = (gchar *)xmlGetProp(root, BAD_CAST "arch");
gchar *type = (gchar *)xmlGetProp(root, BAD_CAST "type");
gchar *supported = (gchar *)xmlGetProp(root, BAD_CAST "supported");
+ gchar *recommended = (gchar *)xmlGetProp(root, BAD_CAST "recommended");
gboolean is_supported = TRUE;
+ gboolean is_recommended = FALSE;
OsinfoFirmware *firmware = osinfo_firmware_new(id, arch, type);
xmlFree(arch);
@@ -1361,10 +1363,19 @@ static OsinfoFirmware *osinfo_loader_firmware(OsinfoLoader *loader,
xmlFree(supported);
}
+ if (recommended != NULL) {
+ is_recommended = g_str_equal(recommended, "true");
+ xmlFree(recommended);
+ }
+
osinfo_entity_set_param_boolean(OSINFO_ENTITY(firmware),
OSINFO_FIRMWARE_PROP_SUPPORTED,
is_supported);
+ osinfo_entity_set_param_boolean(OSINFO_ENTITY(firmware),
+ OSINFO_FIRMWARE_PROP_RECOMMENDED,
+ is_recommended);
+
return firmware;
}

View File

@@ -0,0 +1,84 @@
From 0adf38535637ec668e658d43f04f60f11f51574f Mon Sep 17 00:00:00 2001
From: Roman Bogorodskiy <bogorodskiy@gmail.com>
Date: Thu, 10 Apr 2025 13:54:02 +0200
Subject: [PATCH] loader: don't use libxml2 deprecated APIs
Address the following items:
- Deprecated direct access to buf's content
- Mismatching error function signature
- Deprecated direct access to ctxt's lastError
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
---
osinfo/osinfo_loader.c | 42 +++++++++++++++++++++++-------------------
1 file changed, 23 insertions(+), 19 deletions(-)
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 0a9004af..b3fd4535 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -354,7 +354,7 @@ osinfo_loader_doc(const char *xpath,
xmlXPathFreeObject(obj);
OSINFO_LOADER_SET_ERROR(err, "Cannot format stylesheet");
}
- ret = g_strdup((char *)buf->content);
+ ret = g_strdup((char *)xmlBufferContent(buf));
xmlBufferFree(buf);
xmlXPathFreeObject(obj);
@@ -1902,28 +1902,32 @@ static void osinfo_loader_root(OsinfoLoader *loader,
}
static void
-catchXMLError(void *ctx, const char *msg ATTRIBUTE_UNUSED, ...)
+catchXMLError(void *ctx, const char *msg, ...)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
+ const xmlError *xmlErr = NULL;
+ g_autofree gchar *xmlmsg = NULL;
- if (ctxt && ctxt->_private) {
- GError **err = ctxt->_private;
- if (!error_is_set(err)) {
- gchar *xmlmsg;
- if (ctxt->lastError.file) {
- xmlmsg = g_strdup_printf("%s:%d: %s",
- ctxt->lastError.file,
- ctxt->lastError.line,
- ctxt->lastError.message);
- } else {
- xmlmsg = g_strdup_printf("at line %d: %s",
- ctxt->lastError.line,
- ctxt->lastError.message);
- }
- OSINFO_LOADER_SET_ERROR(ctxt->_private, xmlmsg);
- g_free(xmlmsg);
- }
+ if (!ctxt || !ctxt->_private)
+ return;
+
+ if (error_is_set(ctxt->_private))
+ return;
+
+ if (!(xmlErr = xmlCtxtGetLastError(ctx)))
+ return;
+
+ if (xmlErr->file) {
+ xmlmsg = g_strdup_printf("%s:%d: %s",
+ xmlErr->file,
+ xmlErr->line,
+ xmlErr->message);
+ } else {
+ xmlmsg = g_strdup_printf("at line %d: %s",
+ xmlErr->line,
+ xmlErr->message);
}
+ OSINFO_LOADER_SET_ERROR(ctxt->_private, xmlmsg);
}
static void osinfo_loader_process_xml(OsinfoLoader *loader,
--
GitLab

View File

@@ -1,3 +1,17 @@
-------------------------------------------------------------------
Tue Feb 10 11:06:34 MST 2026 - carnold@suse.com
- jsc#PED-14636 - UEFI as default for new VMs
Add-osinfo_firmware_is_recommended.patch
-------------------------------------------------------------------
Tue Sep 23 11:55:47 UTC 2025 - pgajdos@suse.com
- fix build with new libxml2
- added patches
https://gitlab.com/libosinfo/libosinfo/-/commit/0adf38535637ec668e658d43f04f60f11f51574f
* libosinfo-libxml2-2.14.patch
-------------------------------------------------------------------
Mon Dec 2 11:20:36 MST 2024 - carnold@suse.com
@@ -305,7 +319,7 @@ Tue Aug 15 10:53:05 MDT 2017 - carnold@suse.com
* Don't include private headers in gir/vapi generation
-------------------------------------------------------------------
Mon Dec 12 15:56:28 MDT 2016 - carnold@suse.com
Mon Dec 12 15:56:28 MST 2016 - carnold@suse.com
- Update to version 1.0.0 (bsc#1013983)
Changes in this release include:

View File

@@ -1,7 +1,7 @@
#
# spec file for package libosinfo
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2026 SUSE LLC and contributors
# Copyright (c) 2011 Dominique Leuenberger, Amsterdam, The Netherlands.
#
# All modifications and additions to the file contributed by third parties
@@ -25,8 +25,11 @@ Release: 0
Summary: Operating system and hypervisor information management library
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: Development/Libraries/C and C++
URL: https://releases.pagure.org/libosinfo
Source0: %{url}/%{name}-%{version}.tar.xz
URL: https://gitlab.com/libosinfo/libosinfo
Source0: https://releases.pagure.org/libosinfo/%{name}-%{version}.tar.xz
# https://gitlab.com/libosinfo/libosinfo/-/commit/0adf38535637ec668e658d43f04f60f11f51574f
Patch0: libosinfo-libxml2-2.14.patch
Patch1: Add-osinfo_firmware_is_recommended.patch
BuildRequires: gtk-doc
BuildRequires: hwdata