diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2018-02-10 14:58:11 -0600 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2018-02-16 16:52:26 +0000 |
commit | f783b8c1938da409d480bf73d845c1bc92eb1507 (patch) | |
tree | 6966ae5b4b994de5bbffd00a92730e24f0804958 | |
parent | 5ad5a2ebf5264f5b5dd4bf1fb6e3fe5effc591cf (diff) | |
download | aports-f783b8c1938da409d480bf73d845c1bc92eb1507.tar.gz aports-f783b8c1938da409d480bf73d845c1bc92eb1507.tar.bz2 aports-f783b8c1938da409d480bf73d845c1bc92eb1507.tar.xz |
main/upower: modernise, tidy
The patches were not being applied in prepare().
They are already upstream in 0.99.6, so remove them.
-rw-r--r-- | main/upower/APKBUILD | 38 | ||||
-rw-r--r-- | main/upower/daemon-fix-get_critical_action.patch | 28 | ||||
-rw-r--r-- | main/upower/lib-Fix-memory-leak-in-up_client_get_devices.patch | 33 | ||||
-rw-r--r-- | main/upower/lib-add-propererror-and-cancellable-handling-to-UpClient.patch | 184 | ||||
-rw-r--r-- | main/upower/linux-Fix-possible-double-free.patch | 44 |
5 files changed, 14 insertions, 313 deletions
diff --git a/main/upower/APKBUILD b/main/upower/APKBUILD index 490d40bd1c..84076255cd 100644 --- a/main/upower/APKBUILD +++ b/main/upower/APKBUILD @@ -1,30 +1,20 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=upower pkgver=0.99.6 -pkgrel=0 +pkgrel=1 pkgdesc="Power Management Services" url="http://upower.freedesktop.org" arch="all" license="GPL-2.0-or-later" depends="" subpackages="$pkgname-dev $pkgname-doc $pkgname-lang" -makedepends="linux-headers gtk+-dev libgudev-dev libusb-dev polkit-dev dbus-glib-dev libxslt - gobject-introspection-dev docbook-xsl" +makedepends="linux-headers gtk+-dev libgudev-dev libusb-dev polkit-dev + dbus-glib-dev libxslt gobject-introspection-dev docbook-xsl" source="http://upower.freedesktop.org/releases/upower-$pkgver.tar.xz - lib-Fix-memory-leak-in-up_client_get_devices.patch - linux-Fix-possible-double-free.patch - - daemon-fix-get_critical_action.patch - lib-add-propererror-and-cancellable-handling-to-UpClient.patch " -_builddir="$srcdir"/$pkgname-$pkgver -prepare() { - cd "$_builddir" -} - build() { - cd "$srcdir/$pkgname-$pkgver" + cd "$builddir" DATADIRNAME=share ./configure \ --build=$CBUILD \ --host=$CHOST \ @@ -32,18 +22,18 @@ build() { --sysconfdir=/etc \ --localstatedir=/var \ --libexecdir=/usr/lib/upower \ - --disable-static \ - || return 1 - make || return 1 + --disable-static + make +} + +check() { + cd "$builddir" + make check } package() { - cd "$_builddir" - make DESTDIR="$pkgdir" install || return 1 + cd "$builddir" + make DESTDIR="$pkgdir" install } -sha512sums="7e7256491ecb5d3f04abf41f05a761b79761c8868a1aedadfc5085c3b9cf15f6099c1494596e6a24b0951511bc7cac074e93ebb2b84abb9fb7a4374483052d3f upower-0.99.6.tar.xz -d18e4c6119e32297f612fa110e01de342381f38c8be42d4fd5322eb17a2cb172c1cb8bf09e0a25e0ef6b76edb82b6748c9c8fd02f44341f51ecd09141ea432fd lib-Fix-memory-leak-in-up_client_get_devices.patch -13656064551a9b9e40fe3560098319182e980d2ab48134959f9f642a6c42cb0283b3bd00052ef26834ffea5c3a2108b66fd127e165b2167a43064ccd4ba526b0 linux-Fix-possible-double-free.patch -9f2718c7fb7ea77d07fe463d3eecae14e40cc2da71c500e2d747c52bbe2f645632cd7ee8289a7f1b8b252b3eb9d5d568ddcd74e00e5fd9985861514895847006 daemon-fix-get_critical_action.patch -678298e420ce0eb8f9ca65ca0806b856b4d7f3634a70a029dcb9a391a457dcb91b2a5c8bbe7f3054e45a36f33458daedb10e6be11e970bd818ecf42e3587a76e lib-add-propererror-and-cancellable-handling-to-UpClient.patch" +sha512sums="7e7256491ecb5d3f04abf41f05a761b79761c8868a1aedadfc5085c3b9cf15f6099c1494596e6a24b0951511bc7cac074e93ebb2b84abb9fb7a4374483052d3f upower-0.99.6.tar.xz" diff --git a/main/upower/daemon-fix-get_critical_action.patch b/main/upower/daemon-fix-get_critical_action.patch deleted file mode 100644 index 6afe9b7a98..0000000000 --- a/main/upower/daemon-fix-get_critical_action.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 28cee8e2845b094488c337c4ecfa84ada0b6be60 Mon Sep 17 00:00:00 2001 -From: Martin Pitt <martin.pitt@ubuntu.com> -Date: Tue, 23 Feb 2016 09:51:07 +0100 -Subject: daemon: fix get_critical_action() - -Fix copy&paste error from e7e9156f that called the wrong _complete_ function -for up_daemon_get_critical_action(). - -https://bugs.freedesktop.org/show_bug.cgi?id=94262 - -diff --git a/src/up-daemon.c b/src/up-daemon.c -index be14cbe..e95f904 100644 ---- a/src/up-daemon.c -+++ b/src/up-daemon.c -@@ -435,8 +435,8 @@ up_daemon_get_critical_action (UpExportedDaemon *skeleton, - GDBusMethodInvocation *invocation, - UpDaemon *daemon) - { -- up_exported_daemon_complete_get_display_device (skeleton, invocation, -- up_backend_get_critical_action (daemon->priv->backend)); -+ up_exported_daemon_complete_get_critical_action (skeleton, invocation, -+ up_backend_get_critical_action (daemon->priv->backend)); - return TRUE; - } - --- -cgit v0.10.2 - diff --git a/main/upower/lib-Fix-memory-leak-in-up_client_get_devices.patch b/main/upower/lib-Fix-memory-leak-in-up_client_get_devices.patch deleted file mode 100644 index 3418b04168..0000000000 --- a/main/upower/lib-Fix-memory-leak-in-up_client_get_devices.patch +++ /dev/null @@ -1,33 +0,0 @@ -From fe37183fba649b999af3f66b9e0b0d70a054426c Mon Sep 17 00:00:00 2001 -From: Bastien Nocera <hadess@hadess.net> -Date: Wed, 17 Jun 2015 10:52:12 +0200 -Subject: lib: Fix memory leak in up_client_get_devices() - -When up_client_get_devices() fails to contact the D-Bus daemon, don't -leak the newly created array. - -diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c -index 48d99a0..4780aa5 100644 ---- a/libupower-glib/up-client.c -+++ b/libupower-glib/up-client.c -@@ -95,8 +95,6 @@ up_client_get_devices (UpClient *client) - - g_return_val_if_fail (UP_IS_CLIENT (client), NULL); - -- array = g_ptr_array_new (); -- - if (up_client_glue_call_enumerate_devices_sync (client->priv->proxy, - &devices, - NULL, -@@ -106,6 +104,8 @@ up_client_get_devices (UpClient *client) - return NULL; - } - -+ array = g_ptr_array_new (); -+ - for (i = 0; devices[i] != NULL; i++) { - UpDevice *device; - const char *object_path = devices[i]; --- -cgit v0.10.2 - diff --git a/main/upower/lib-add-propererror-and-cancellable-handling-to-UpClient.patch b/main/upower/lib-add-propererror-and-cancellable-handling-to-UpClient.patch deleted file mode 100644 index 47e2f47993..0000000000 --- a/main/upower/lib-add-propererror-and-cancellable-handling-to-UpClient.patch +++ /dev/null @@ -1,184 +0,0 @@ -From 932a6a39e35754be571e1274aec4730fd42dba13 Mon Sep 17 00:00:00 2001 -From: Martin Pitt <martin.pitt@ubuntu.com> -Date: Wed, 18 May 2016 09:22:43 +0200 -Subject: lib: Add proper error and cancellable handling to UpClient - constructor - -A GObject's _init() should never fail or block, but this is currently the case -as up_client_init() connects to upowerd on D-Bus. Convert this to the GInitable -interface and provide a new constructor up_client_new_full() which accepts a -GCancellable and GError, so that clients can do proper error handling -and reporting. - -This changes up_client_new() to return NULL when connecting to upowerd fails. -This provides a more well-defined behaviour in this case as clients can check -for this and our methods stop segfaulting as they have checks like - - g_return_val_if_fail (UP_IS_CLIENT (client), ...) - -Previously we returned a valid object, but trying to call any method on it -segfaulted due to the NULL D-Bus proxy, so client code had no chance to check -whether the UpClient object was really valid. - -https://bugs.freedesktop.org/show_bug.cgi?id=95350 - -diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c -index 5b2218f..adc0b9b 100644 ---- a/libupower-glib/up-client.c -+++ b/libupower-glib/up-client.c -@@ -39,9 +39,10 @@ - #include "up-daemon-generated.h" - #include "up-device.h" - --static void up_client_class_init (UpClientClass *klass); --static void up_client_init (UpClient *client); --static void up_client_finalize (GObject *object); -+static void up_client_class_init (UpClientClass *klass); -+static void up_client_initable_iface_init (GInitableIface *iface); -+static void up_client_init (UpClient *client); -+static void up_client_finalize (GObject *object); - - #define UP_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_CLIENT, UpClientPrivate)) - -@@ -73,7 +74,8 @@ enum { - static guint signals [UP_CLIENT_LAST_SIGNAL] = { 0 }; - static gpointer up_client_object = NULL; - --G_DEFINE_TYPE (UpClient, up_client, G_TYPE_OBJECT) -+G_DEFINE_TYPE_WITH_CODE (UpClient, up_client, G_TYPE_OBJECT, -+ G_IMPLEMENT_INTERFACE(G_TYPE_INITABLE, up_client_initable_iface_init)) - - /** - * up_client_get_devices: -@@ -434,11 +436,10 @@ up_client_class_init (UpClientClass *klass) - * up_client_init: - * @client: This class instance - */ --static void --up_client_init (UpClient *client) -+static gboolean -+up_client_initable_init (GInitable *initable, GCancellable *cancellable, GError **error) - { -- GError *error = NULL; -- -+ UpClient *client = UP_CLIENT (initable); - client->priv = UP_CLIENT_GET_PRIVATE (client); - - /* connect to main interface */ -@@ -446,13 +447,10 @@ up_client_init (UpClient *client) - G_DBUS_PROXY_FLAGS_NONE, - "org.freedesktop.UPower", - "/org/freedesktop/UPower", -- NULL, -- &error); -- if (client->priv->proxy == NULL) { -- g_warning ("Couldn't connect to proxy: %s", error->message); -- g_error_free (error); -- return; -- } -+ cancellable, -+ error); -+ if (client->priv->proxy == NULL) -+ return FALSE; - - /* all callbacks */ - g_signal_connect (client->priv->proxy, "device-added", -@@ -461,6 +459,23 @@ up_client_init (UpClient *client) - G_CALLBACK (up_device_removed_cb), client); - g_signal_connect (client->priv->proxy, "notify", - G_CALLBACK (up_client_notify_cb), client); -+ -+ return TRUE; -+} -+ -+static void -+up_client_initable_iface_init (GInitableIface *iface) -+{ -+ iface->init = up_client_initable_init; -+} -+ -+/* -+ * up_client_init: -+ * @client: This class instance -+ */ -+static void -+up_client_init (UpClient *client) -+{ - } - - /* -@@ -482,23 +497,52 @@ up_client_finalize (GObject *object) - } - - /** -- * up_client_new: -+ * up_client_new_full: -+ * @cancellable: (allow-none): A #GCancellable or %NULL. -+ * @error: Return location for error or %NULL. - * -- * Creates a new #UpClient object. -+ * Creates a new #UpClient object. If connecting to upowerd on D-Bus fails, -+ % this returns %NULL and sets @error. - * -- * Return value: a new UpClient object. -+ * Return value: a new UpClient object, or %NULL on failure. - * -- * Since: 0.9.0 -+ * Since: 0.99.5 - **/ - UpClient * --up_client_new (void) -+up_client_new_full (GCancellable *cancellable, GError **error) - { - if (up_client_object != NULL) { - g_object_ref (up_client_object); - } else { -- up_client_object = g_object_new (UP_TYPE_CLIENT, NULL); -- g_object_add_weak_pointer (up_client_object, &up_client_object); -+ up_client_object = g_initable_new (UP_TYPE_CLIENT, cancellable, error, NULL); -+ if (up_client_object) -+ g_object_add_weak_pointer (up_client_object, &up_client_object); - } - return UP_CLIENT (up_client_object); - } - -+/** -+ * up_client_new: -+ * -+ * Creates a new #UpClient object. If connecting to upowerd on D-Bus fails, -+ * this returns %NULL and prints out a warning with the error message. -+ * Consider using up_client_new_full() instead which allows you to handle errors -+ * and cancelling long operations yourself. -+ * -+ * Return value: a new UpClient object, or %NULL on failure. -+ * -+ * Since: 0.9.0 -+ **/ -+UpClient * -+up_client_new (void) -+{ -+ GError *error = NULL; -+ UpClient *client; -+ client = up_client_new_full (NULL, &error); -+ if (client == NULL) { -+ g_warning ("Couldn't connect to proxy: %s", error->message); -+ g_error_free (error); -+ } -+ return client; -+} -+ -diff --git a/libupower-glib/up-client.h b/libupower-glib/up-client.h -index 79c2d9e..5b9af3c 100644 ---- a/libupower-glib/up-client.h -+++ b/libupower-glib/up-client.h -@@ -72,6 +72,7 @@ typedef struct - /* general */ - GType up_client_get_type (void); - UpClient *up_client_new (void); -+UpClient *up_client_new_full (GCancellable *cancellable, GError **error); - - /* sync versions */ - UpDevice * up_client_get_display_device (UpClient *client); --- -cgit v0.10.2 - diff --git a/main/upower/linux-Fix-possible-double-free.patch b/main/upower/linux-Fix-possible-double-free.patch deleted file mode 100644 index d63cf4d11d..0000000000 --- a/main/upower/linux-Fix-possible-double-free.patch +++ /dev/null @@ -1,44 +0,0 @@ -From c9b2e177267b623850b3deedb1242de7d2e413ee Mon Sep 17 00:00:00 2001 -From: Bastien Nocera <hadess@hadess.net> -Date: Fri, 26 Jun 2015 14:07:13 +0200 -Subject: linux: Fix possible double-free - -When reopening the lockdown daemon with upower as the client, don't -double-free if the user says "No" to trusting the laptop. - -https://bugzilla.redhat.com/show_bug.cgi?id=1231763 - -diff --git a/src/linux/up-device-idevice.c b/src/linux/up-device-idevice.c -index 9722774..6ab1bf8 100644 ---- a/src/linux/up-device-idevice.c -+++ b/src/linux/up-device-idevice.c -@@ -74,7 +74,7 @@ start_poll_cb (UpDeviceIdevice *idevice) - UpDevice *device = UP_DEVICE (idevice); - idevice_t dev = NULL; - lockdownd_client_t client = NULL; -- char *uuid; -+ char *uuid = NULL; - - g_object_get (G_OBJECT (idevice), "serial", &uuid, NULL); - g_assert (uuid); -@@ -83,7 +83,7 @@ start_poll_cb (UpDeviceIdevice *idevice) - if (idevice_new (&dev, uuid) != IDEVICE_E_SUCCESS) - goto out; - -- g_free (uuid); -+ g_clear_pointer (&uuid, g_free); - - if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake (dev, &client, "upower")) - goto out; -@@ -111,7 +111,7 @@ start_poll_cb (UpDeviceIdevice *idevice) - out: - g_clear_pointer (&client, lockdownd_client_free); - g_clear_pointer (&dev, idevice_free); -- g_free (uuid); -+ g_clear_pointer (&uuid, g_free); - return G_SOURCE_CONTINUE; - } - --- -cgit v0.10.2 - |