Initial commit

This commit is contained in:
2025-10-01 17:05:38 +03:00
commit cc9de9f193
5 changed files with 151 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
# Exclude bpm archives
*.bpm
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
URL="https://releases.pagure.org/libosinfo/"
# Get version number from FTP server
VERSION=$(curl -s -L "$URL" | grep -o 'libosinfo-.*.tar.xz' | grep -o -E '[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}' | sort -V | tail -n1)
echo "$VERSION"
+26
View File
@@ -0,0 +1,26 @@
name: libosinfo
description: GObject based library API for managing information about operating systems, hypervisors and the (virtual) hardware devices they can support
version: 1.12.0
revision: 1
url: https://libosinfo.org/
license: GPL2-or-later,LGPL2.1-or-later
architecture: any
type: source
depends:
- gcc-libs
- glib
- glibc
- hwdata
- libsoup
- libxml2
- libxslt
- osinfo-db
make_depends:
- gobject-introspection
- meson
- vala
downloads:
- url: https://releases.pagure.org/libosinfo/libosinfo-${BPM_PKG_VERSION}.tar.xz
extract_to_bpm_source: true
extract_strip_components: 1
checksum: ad8557ece26793da43d26de565e3d68ce2ee6bfb8d0113b7cc7dfe07f6bfc6b6
+83
View File
@@ -0,0 +1,83 @@
From 0adf38535637ec668e658d43f04f60f11f51574f Mon Sep 17 00:00:00 2001
From: Roman Bogorodskiy <[email protected]>
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 <[email protected]>
---
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
+32
View File
@@ -0,0 +1,32 @@
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# The prepare function is executed in the root of the temp directory
# This function is used for putting downloaded files to the correct location or applying patches
prepare() {
cd "$BPM_SOURCE"
patch -Np1 -i "$BPM_WORKDIR"/fix-libxml-2.14.patch
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
meson setup build --prefix=/usr -Denable-gtk-doc=false -Dwith-usb-ids-path=/usr/share/hwdata/usb.ids -Dwith-pci-ids-path=/usr/share/hwdata/pci.ids
meson compile -C build
}
# The check function is executed in the source directory
# This function is used to run tests to verify the package has been compiled correctly
check() {
meson test -C build --print-errorlogs
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
meson install -C build --destdir="$BPM_OUTPUT"
# Install package license
install -Dm644 "$BPM_SOURCE"/COPYING* -t "$BPM_OUTPUT"/usr/share/licenses/libosinfo/
}