Accepting request 1083345 from Base:System
OBS-URL: https://build.opensuse.org/request/show/1083345 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libgudev?expand=0&rev=11
This commit is contained in:
commit
8ae4c14ee5
75
4216ecd4513bd4c8af73543817a51d6f72f166cc.patch
Normal file
75
4216ecd4513bd4c8af73543817a51d6f72f166cc.patch
Normal file
@ -0,0 +1,75 @@
|
||||
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
|
||||
|
220
71b2fda04dd71c637361e8ead103980ad6f27ed5.patch
Normal file
220
71b2fda04dd71c637361e8ead103980ad6f27ed5.patch
Normal file
@ -0,0 +1,220 @@
|
||||
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
|
||||
|
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 20 07:28:19 UTC 2023 - Bjørn Lie <bjorn.lie@gmail.com>
|
||||
|
||||
- Add 2 upstream bug fix patches:
|
||||
* 71b2fda04dd71c637361e8ead103980ad6f27ed5.patch: gudev: Fix
|
||||
newline stripping by always reading using udev.
|
||||
* 4216ecd4513bd4c8af73543817a51d6f72f166cc.patch: build: let
|
||||
meson handle gir, vala, gtk-doc dependencies
|
||||
- Use ldconfig_scriptlets macro.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 28 07:31:45 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package libgudev
|
||||
#
|
||||
# Copyright (c) 2022 SUSE LLC
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -25,6 +25,11 @@ 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
|
||||
BuildRequires: meson
|
||||
@ -83,8 +88,7 @@ provides GObject access to udev device information.
|
||||
%check
|
||||
%meson_test
|
||||
|
||||
%post -n libgudev-1_0-0 -p /sbin/ldconfig
|
||||
%postun -n libgudev-1_0-0 -p /sbin/ldconfig
|
||||
%ldconfig_scriptlets -n libgudev-1_0-0
|
||||
|
||||
%files -n libgudev-1_0-0
|
||||
%license COPYING
|
||||
|
Loading…
Reference in New Issue
Block a user