Accepting request 1097218 from GNOME:Next

- Update to version 238:
  * Fix newline stripping
  * Add g_udev_device_get_current_tags()
  * Add a number of tests, and devel docs
  * Fix devhelp not being able to find the docs
  * Skip locale test with locale isn't available
- Drop patches fixed upstream:
  * 71b2fda04dd71c637361e8ead103980ad6f27ed5.patch
  * 4216ecd4513bd4c8af73543817a51d6f72f166cc.patch

OBS-URL: https://build.opensuse.org/request/show/1097218
OBS-URL: https://build.opensuse.org/package/show/Base:System/libgudev?expand=0&rev=22
This commit is contained in:
Marcus Meissner 2023-07-15 12:12:35 +00:00 committed by Git OBS Bridge
parent 164c41280c
commit fdb774a8bb
6 changed files with 17 additions and 303 deletions

View File

@ -1,75 +0,0 @@
From 4216ecd4513bd4c8af73543817a51d6f72f166cc Mon Sep 17 00:00:00 2001
From: Artturi <artturin@artturin.com>
Date: Mon, 11 Jul 2022 08:35:09 +0000
Subject: [PATCH] build: let meson handle gir, vala, gtk-doc dependencies
---
gudev/meson.build | 2 +-
meson.build | 23 ++++++-----------------
2 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/gudev/meson.build b/gudev/meson.build
index fd06a11..e904203 100644
--- a/gudev/meson.build
+++ b/gudev/meson.build
@@ -97,7 +97,7 @@ pkg.generate(
]
)
-if introspection_dep.found()
+if gir_dep.found()
libgudev_gir = gnome.generate_gir(
libgudev,
sources: libgudev_sources + libgudev_public_h,
diff --git a/meson.build b/meson.build
index eae2c80..f547a6d 100644
--- a/meson.build
+++ b/meson.build
@@ -42,9 +42,6 @@ cc = meson.get_compiler('c')
glib_req = '>= 2.38.0'
libudev_req = '>= 199'
-introspection_req = '>= 1.31.1'
-vapigen_req = '>= 0.38.0'
-gtk_doc_req = '>= 1.18'
glib_dep = dependency('glib-2.0', version: glib_req)
gobject_dep = dependency('gobject-2.0', version: glib_req)
@@ -58,20 +55,12 @@ umockdev_dep = dependency(
required: get_option('tests')
)
-introspection_dep = dependency(
- 'gobject-introspection-1.0', version: introspection_req,
- required: get_option('introspection')
-)
-
-vapigen_dep = dependency(
- 'vapigen', version: vapigen_req,
- required: get_option('vapi')
-)
+gir_dep = find_program('g-ir-scanner', required: get_option('introspection'))
+vapigen_dep = find_program('vapigen', required : get_option('vapi'))
-gtk_doc_dep = dependency(
- 'gtk-doc', version: gtk_doc_req,
- required: get_option('gtk_doc')
-)
+if vapigen_dep.found()
+ assert(gir_dep.found(), 'vapi requires introspection')
+endif
# Configurations
config_h = configuration_data()
@@ -95,7 +84,7 @@ if get_option('gtk_doc')
endif
summary('Documentation', get_option('gtk_doc'), section: 'Build')
-summary('Introspection', introspection_dep.found(), section: 'Build')
+summary('Introspection', gir_dep.found(), section: 'Build')
summary('Vala API', vapigen_dep.found(), section: 'Build')
summary('Tests', umockdev_dep.found(), section: 'Build')
--
GitLab

View File

@ -1,220 +0,0 @@
From 71b2fda04dd71c637361e8ead103980ad6f27ed5 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Mon, 30 May 2022 16:52:36 +0200
Subject: [PATCH] gudev: Fix newline stripping by always reading using udev
libudev will strip trailing newline characters ("\r\n") when reading
sysfs attributes. The uncached reading functions however bypassed the
udev mechanism unnecessarily and then added their own cache on top.
Setting the value to NULL clears the internal cache in systemd. As such,
we can simply do this and then fall back to the normal implementation to
implement the _uncached version of the sysfs attribute getters.
---
gudev/gudevdevice.c | 106 ++++++--------------------------------------
1 file changed, 13 insertions(+), 93 deletions(-)
diff --git a/gudev/gudevdevice.c b/gudev/gudevdevice.c
index 38473dd..112c89e 100644
--- a/gudev/gudevdevice.c
+++ b/gudev/gudevdevice.c
@@ -78,7 +78,6 @@ struct _GUdevDevicePrivate
gchar **tags;
GHashTable *prop_strvs;
GHashTable *sysfs_attr_strvs;
- GHashTable *sysfs_attr;
};
G_DEFINE_TYPE_WITH_CODE (GUdevDevice, g_udev_device, G_TYPE_OBJECT, G_ADD_PRIVATE(GUdevDevice))
@@ -102,9 +101,6 @@ g_udev_device_finalize (GObject *object)
if (device->priv->sysfs_attr_strvs != NULL)
g_hash_table_unref (device->priv->sysfs_attr_strvs);
- if (device->priv->sysfs_attr != NULL)
- g_hash_table_unref (device->priv->sysfs_attr);
-
if (G_OBJECT_CLASS (g_udev_device_parent_class)->finalize != NULL)
(* G_OBJECT_CLASS (g_udev_device_parent_class)->finalize) (object);
}
@@ -131,10 +127,6 @@ _g_udev_device_new (struct udev_device *udevice)
device = G_UDEV_DEVICE (g_object_new (G_UDEV_TYPE_DEVICE, NULL));
device->priv->udevice = udev_device_ref (udevice);
- device->priv->sysfs_attr = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- g_free);
return device;
}
@@ -773,14 +765,8 @@ const gchar *
g_udev_device_get_sysfs_attr (GUdevDevice *device,
const gchar *name)
{
- const char *attr;
-
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL);
g_return_val_if_fail (name != NULL, NULL);
-
- attr = g_hash_table_lookup (device->priv->sysfs_attr, name);
- if (attr)
- return attr;
return udev_device_get_sysattr_value (device->priv->udevice, name);
}
@@ -1030,18 +1016,11 @@ const gchar *
g_udev_device_get_sysfs_attr_uncached (GUdevDevice *device,
const gchar *name)
{
- g_autofree char *path = NULL;
- char *contents = NULL;
-
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL);
g_return_val_if_fail (name != NULL, NULL);
- path = g_build_filename (udev_device_get_syspath (device->priv->udevice), name, NULL);
- if (!g_file_get_contents (path, &contents, NULL, NULL))
- return NULL;
- g_hash_table_insert (device->priv->sysfs_attr, g_strdup (name), contents);
-
- return contents;
+ udev_device_set_sysattr_value (device->priv->udevice, name, NULL);
+ return g_udev_device_get_sysfs_attr (device, name);
}
/**
@@ -1060,20 +1039,11 @@ gint
g_udev_device_get_sysfs_attr_as_int_uncached (GUdevDevice *device,
const gchar *name)
{
- gint result;
- const gchar *s;
-
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0);
g_return_val_if_fail (name != NULL, 0);
- result = 0;
- s = g_udev_device_get_sysfs_attr_uncached (device, name);
- if (s == NULL)
- goto out;
-
- result = strtol (s, NULL, 0);
-out:
- return result;
+ udev_device_set_sysattr_value (device->priv->udevice, name, NULL);
+ return g_udev_device_get_sysfs_attr_as_int (device, name);
}
/**
@@ -1092,20 +1062,11 @@ guint64
g_udev_device_get_sysfs_attr_as_uint64_uncached (GUdevDevice *device,
const gchar *name)
{
- guint64 result;
- const gchar *s;
-
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0);
g_return_val_if_fail (name != NULL, 0);
- result = 0;
- s = g_udev_device_get_sysfs_attr_uncached (device, name);
- if (s == NULL)
- goto out;
-
- result = g_ascii_strtoull (s, NULL, 0);
-out:
- return result;
+ udev_device_set_sysattr_value (device->priv->udevice, name, NULL);
+ return g_udev_device_get_sysfs_attr_as_uint64 (device, name);
}
/**
@@ -1124,20 +1085,11 @@ gdouble
g_udev_device_get_sysfs_attr_as_double_uncached (GUdevDevice *device,
const gchar *name)
{
- gdouble result;
- const gchar *s;
-
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0);
g_return_val_if_fail (name != NULL, 0.0);
- result = 0.0;
- s = g_udev_device_get_sysfs_attr_uncached (device, name);
- if (s == NULL)
- goto out;
-
- result = g_ascii_strtod (s, NULL);
-out:
- return result;
+ udev_device_set_sysattr_value (device->priv->udevice, name, NULL);
+ return g_udev_device_get_sysfs_attr_as_double (device, name);
}
/**
@@ -1157,29 +1109,11 @@ gboolean
g_udev_device_get_sysfs_attr_as_boolean_uncached (GUdevDevice *device,
const gchar *name)
{
- gboolean result;
- const gchar *raw;
- g_autofree char *truncated = NULL;
- const char *s;
-
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
- result = FALSE;
- raw = g_udev_device_get_sysfs_attr_uncached (device, name);
- if (raw == NULL)
- goto out;
-
- truncated = truncate_at_linefeed (raw);
- s = truncated ?: raw;
- if (strcmp (s, "1") == 0 ||
- g_ascii_strcasecmp (s, "true") == 0 ||
- g_ascii_strcasecmp (s, "y") == 0) {
- result = TRUE;
- }
-
- out:
- return result;
+ udev_device_set_sysattr_value (device->priv->udevice, name, NULL);
+ return g_udev_device_get_sysfs_attr_as_boolean (device, name);
}
/**
@@ -1204,27 +1138,13 @@ const gchar * const *
g_udev_device_get_sysfs_attr_as_strv_uncached (GUdevDevice *device,
const gchar *name)
{
- gchar **result;
- const gchar *s;
-
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL);
g_return_val_if_fail (name != NULL, NULL);
- result = NULL;
- s = g_udev_device_get_sysfs_attr_uncached (device, name);
- if (s == NULL)
- goto out;
+ g_hash_table_remove (device->priv->sysfs_attr_strvs, name);
- result = split_at_whitespace (s);
- if (result == NULL)
- goto out;
-
- if (device->priv->sysfs_attr_strvs == NULL)
- device->priv->sysfs_attr_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev);
- g_hash_table_insert (device->priv->sysfs_attr_strvs, g_strdup (name), result);
-
-out:
- return (const gchar* const *) result;
+ udev_device_set_sysattr_value (device->priv->udevice, name, NULL);
+ return g_udev_device_get_sysfs_attr_as_strv (device, name);
}
/**
--
GitLab

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0d06b21170d20c93e4f0534dbb9b0a8b4f1119ffb00b4031aaeb5b9148b686aa
size 29060

BIN
libgudev-238.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Thu Jul 6 14:09:34 UTC 2023 - Bjørn Lie <bjorn.lie@gmail.com>
- Update to version 238:
* Fix newline stripping
* Add g_udev_device_get_current_tags()
* Add a number of tests, and devel docs
* Fix devhelp not being able to find the docs
* Skip locale test with locale isn't available
- Drop patches fixed upstream:
* 71b2fda04dd71c637361e8ead103980ad6f27ed5.patch
* 4216ecd4513bd4c8af73543817a51d6f72f166cc.patch
-------------------------------------------------------------------
Thu Apr 20 07:28:19 UTC 2023 - Bjørn Lie <bjorn.lie@gmail.com>

View File

@ -17,7 +17,7 @@
Name: libgudev
Version: 237
Version: 238
Release: 0
Summary: Library that provides GObject bindings for libudev
License: LGPL-2.1-or-later
@ -25,10 +25,6 @@ Group: Development/Libraries/GNOME
URL: https://wiki.gnome.org/Projects/libgudev
Source0: https://download.gnome.org/sources/libgudev/%{version}/%{name}-%{version}.tar.xz
Source99: baselibs.conf
# PATCH-FIX-UPSTREAM 71b2fda04dd71c637361e8ead103980ad6f27ed5.patch -- gudev: Fix newline stripping by always reading using udev
Patch: https://gitlab.gnome.org/GNOME/libgudev/-/commit/71b2fda04dd71c637361e8ead103980ad6f27ed5.patch
# PATCH-FIX-UPSTREAM 4216ecd4513bd4c8af73543817a51d6f72f166cc.patch -- build: let meson handle gir, vala, gtk-doc dependencies
Patch2: https://gitlab.gnome.org/GNOME/libgudev/-/commit/4216ecd4513bd4c8af73543817a51d6f72f166cc.patch
# For testsuite, uses fr_FR.UTF-8
BuildRequires: glibc-locale