diff options
author | freaj <freaj@riseup.net> | 2015-03-29 19:52:16 +0200 |
---|---|---|
committer | freaj <freaj@riseup.net> | 2015-03-29 19:52:16 +0200 |
commit | 5b682c9ac487da900e2d493a0787e83be2f466f5 (patch) | |
tree | 1be310f097095f8674c9fd929390dfbbf1f5756a /pcr/upower-pm-utils | |
parent | 896520ecb98b8c40777b8dc510a051d2b3908328 (diff) | |
download | abslibre-5b682c9ac487da900e2d493a0787e83be2f466f5.tar.gz abslibre-5b682c9ac487da900e2d493a0787e83be2f466f5.tar.bz2 abslibre-5b682c9ac487da900e2d493a0787e83be2f466f5.zip |
upower-pm-utils: add new package to [pcr]
Diffstat (limited to 'pcr/upower-pm-utils')
5 files changed, 222 insertions, 0 deletions
diff --git a/pcr/upower-pm-utils/PKGBUILD b/pcr/upower-pm-utils/PKGBUILD new file mode 100644 index 000000000..074ee3db6 --- /dev/null +++ b/pcr/upower-pm-utils/PKGBUILD @@ -0,0 +1,64 @@ +# Maintainer : freaj <freaj@riseup.net> +# Maintainer (Manjaro): artoo <artoo@manjaro.org> +# Contributor (Manjaro): Alexey D. <lq07829icatm@rambler.ru> +# Contributor (Manjaro): Jan de Groot <jgc@archlinux.org> + +_pkgname=upower + +pkgname=upower-pm-utils +pkgver=0.9.23 +pkgrel=5 +pkgdesc="Abstraction for enumerating power devices, listening to device events and querying history and statistics" +arch=('i686' 'x86_64') +url="http://upower.freedesktop.org" +license=('GPL') +groups=('eudev-base') +depends=('libusb' 'polkit-consolekit' 'pm-utils' 'dbus-glib' 'libimobiledevice' 'eudev-systemdcompat') +backup=('etc/UPower/UPower.conf') +makedepends=('intltool' 'docbook-xsl' 'gobject-introspection' 'python2') +provides=("upower=${pkgver}") +conflicts=('upower' 'upower-nosystemd') +replaces=('upower' 'upower-nosystemd') +options=('!libtool') +source=($url/releases/upower-${pkgver}.tar.xz + 'upower-pm-utils-0.9.23-clamp_percentage_for_overfull_batt.patch' + 'upower-pm-utils-0.9.23-create-dir-runtime.patch' + 'upower-pm-utils-0.9.23-fix-segfault.patch' + 'upower-pm-utils-0.9.23-always_use_pm-utils_backend.patch') + +prepare(){ + cd "$_pkgname-$pkgver" + + sed -e '/DISABLE_DEPRECATED/d' -i configure + sed -e 's|Cflags: |&-DUPOWER_ENABLE_DEPRECATED |' -i upower-glib.pc.in + + patch -p1 -i $srcdir/upower-pm-utils-0.9.23-create-dir-runtime.patch + patch -p1 -i $srcdir/upower-pm-utils-0.9.23-fix-segfault.patch + patch -p1 -i $srcdir/upower-pm-utils-0.9.23-clamp_percentage_for_overfull_batt.patch + + patch -p1 -i $srcdir/upower-pm-utils-0.9.23-always_use_pm-utils_backend.patch +} + +build() { + cd "$_pkgname-$pkgver" + + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --libexecdir=/usr/lib/upower \ + --disable-static \ + --enable-deprecated + make +} + +package() { + cd "$_pkgname-$pkgver" + make DESTDIR="$pkgdir" install +} + +sha256sums=('433252b0a8e9ab4bed7e17ee3ee5b7cef6d527b1f5401ee32212d82a9682981b' + 'cb6e3a54f0ad2f9317f7954504e99485c1422c5ad96c644baa279510084a0858' + 'a3b845b2714e1fb3620af8f7153f800bb72316145c76aa6a90a2eedc3aebb527' + 'f6908be94d462e9753fe0cfbcd9f36aefc271066cc74e4cfcc57ef966a41a7f6' + 'ceb4d915205dcff2937bb82a3646323712eb548e6a9644e48516f647b180abbe') diff --git a/pcr/upower-pm-utils/upower-pm-utils-0.9.23-always_use_pm-utils_backend.patch b/pcr/upower-pm-utils/upower-pm-utils-0.9.23-always_use_pm-utils_backend.patch new file mode 100644 index 000000000..e8cdfa895 --- /dev/null +++ b/pcr/upower-pm-utils/upower-pm-utils-0.9.23-always_use_pm-utils_backend.patch @@ -0,0 +1,28 @@ +Description: Always use the pm-utils backend for now + Redirecting the suspend / hibernate request to logind requires systemd + to be running, as logind tries to start the suspend.target / + hibernate.target via the D-Bus interface provided by systemd. + The availability of logind does not necessarily imply that systemd is + available since we made logind D-Bus activatable under sysvinit. + Also, the systemd version currently in unstable (v44) is too old and + doesn't provide that functionality yet. + Ubuntu ships a very basic implementation of that D-Bus inferface in + systemd-shim which can be run under sysvinit. But we don't have that + package in Debian (yet). + For now, it's the safest option to just continue using the old + pm-utils backend always. +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718493 +diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c +index b9f75f5..595a1b2 100644 +--- a/src/linux/up-backend.c ++++ b/src/linux/up-backend.c +@@ -51,7 +51,7 @@ + + #ifdef ENABLE_DEPRECATED + +-#define LOGIND_AVAILABLE() (access("/run/systemd/seats/", F_OK) >= 0) ++#define LOGIND_AVAILABLE() (FALSE) + + #define SD_HIBERNATE_COMMAND "gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.Hibernate 'true'" + #define SD_SUSPEND_COMMAND "gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 --method org.freedesktop.login1.Manager.Suspend 'true'" + diff --git a/pcr/upower-pm-utils/upower-pm-utils-0.9.23-clamp_percentage_for_overfull_batt.patch b/pcr/upower-pm-utils/upower-pm-utils-0.9.23-clamp_percentage_for_overfull_batt.patch new file mode 100644 index 000000000..758c06041 --- /dev/null +++ b/pcr/upower-pm-utils/upower-pm-utils-0.9.23-clamp_percentage_for_overfull_batt.patch @@ -0,0 +1,72 @@ +From b8fe9902f3c6c50ca6a23e24fcea99582beebc65 Mon Sep 17 00:00:00 2001 +From: Martin Pitt <martinpitt@gnome.org> +Date: Tue, 22 Oct 2013 08:02:51 +0000 +Subject: linux: Clamp percentage for overfull batteries + +Some batteries report energy > energy_full and a percentage ("capacity" +attribute) > 100%. Clamp these within 0 and 100% for both plausibility as well +as to avoid setting an out-of-range property which would then become 0%. + +https://launchpad.net/bugs/1240673 +--- +diff --git a/src/linux/integration-test b/src/linux/integration-test +index 8489bf3..4be1922 100755 +--- a/src/linux/integration-test ++++ b/src/linux/integration-test +@@ -442,6 +442,39 @@ class Tests(unittest.TestCase): + self.assertEqual(self.get_dbus_property('OnLowBattery'), False) + self.stop_daemon() + ++ def test_battery_overfull(self): ++ '''battery which reports a > 100% percentage for a full battery''' ++ ++ self.testbed.add_device('power_supply', 'BAT0', None, ++ ['type', 'Battery', ++ 'present', '1', ++ 'status', 'Full', ++ 'current_now', '1000', ++ 'charge_now', '11000000', ++ 'charge_full', '10000000', ++ 'charge_full_design', '11000000', ++ 'capacity', '110', ++ 'voltage_now', '12000000'], []) ++ ++ self.start_daemon() ++ devs = self.proxy.EnumerateDevices() ++ self.assertEqual(len(devs), 1) ++ bat0_up = devs[0] ++ ++ # should clamp percentage ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Percentage'), 100.0) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'IsPresent'), True) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'State'), ++ UP_DEVICE_STATE_FULLY_CHARGED) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Energy'), 132.0) ++ # should adjust EnergyFull to reality, not what the battery claims ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'EnergyFull'), 132.0) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'EnergyFullDesign'), 132.0) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Voltage'), 12.0) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'PowerSupply'), True) ++ self.assertEqual(self.get_dbus_dev_property(bat0_up, 'Type'), 2) ++ self.stop_daemon() ++ + def test_battery_temperature(self): + '''battery which reports temperature''' + +diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c +index 8020277..b953d65 100644 +--- a/src/linux/up-device-supply.c ++++ b/src/linux/up-device-supply.c +@@ -708,6 +708,10 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply) + /* get a precise percentage */ + if (sysfs_file_exists (native_path, "capacity")) { + percentage = sysfs_get_double (native_path, "capacity"); ++ if (percentage < 0.0f) ++ percentage = 0.0f; ++ if (percentage > 100.0f) ++ percentage = 100.0f; + /* for devices which provide capacity, but not {energy,charge}_now */ + if (energy < 0.1f && energy_full > 0.0f) + energy = energy_full * percentage / 100; +-- +cgit v0.9.0.2-2-gbebe diff --git a/pcr/upower-pm-utils/upower-pm-utils-0.9.23-create-dir-runtime.patch b/pcr/upower-pm-utils/upower-pm-utils-0.9.23-create-dir-runtime.patch new file mode 100644 index 000000000..b73cbcb5d --- /dev/null +++ b/pcr/upower-pm-utils/upower-pm-utils-0.9.23-create-dir-runtime.patch @@ -0,0 +1,34 @@ +From b9cff29978113aefe3ad18521f383f12ab099a34 Mon Sep 17 00:00:00 2001 +From: Cosimo Cecchi <cosimo@endlessm.com> +Date: Tue, 25 Feb 2014 09:43:04 +0000 +Subject: Create the history directory at runtime + +In addition to build time - this increases compatibilty with OSTree, +which starts out with an empty /var. + +Signed-off-by: Richard Hughes <richard@hughsie.com> +--- +diff --git a/src/up-history.c b/src/up-history.c +index f9d0fdf..795b093 100644 +--- a/src/up-history.c ++++ b/src/up-history.c +@@ -414,6 +414,7 @@ up_history_set_directory (UpHistory *history, const gchar *dir) + { + g_free (history->priv->dir); + history->priv->dir = g_strdup (dir); ++ g_mkdir_with_parents (dir, 0755); + } + + /** +@@ -887,7 +888,8 @@ up_history_init (UpHistory *history) + history->priv->data_time_full = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref); + history->priv->data_time_empty = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref); + history->priv->max_data_age = UP_HISTORY_DEFAULT_MAX_DATA_AGE; +- history->priv->dir = g_build_filename (HISTORY_DIR, NULL); ++ ++ up_history_set_directory (history, HISTORY_DIR); + } + + /** +-- +cgit v0.9.0.2-2-gbebe diff --git a/pcr/upower-pm-utils/upower-pm-utils-0.9.23-fix-segfault.patch b/pcr/upower-pm-utils/upower-pm-utils-0.9.23-fix-segfault.patch new file mode 100644 index 000000000..6afb4f87f --- /dev/null +++ b/pcr/upower-pm-utils/upower-pm-utils-0.9.23-fix-segfault.patch @@ -0,0 +1,24 @@ +From 0d64bbddaa0078ef148d609a3cfad854cf00d7de Mon Sep 17 00:00:00 2001 +From: Martin Pitt <martinpitt@gnome.org> +Date: Fri, 08 Nov 2013 13:59:50 +0000 +Subject: lib: Fix segfault on getting property when daemon is not running + +This fixes "upower --version" when the daemon is not running, and thus the +client proxy is NULL. +--- +diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c +index 35d7b5d..17fb02d 100644 +--- a/libupower-glib/up-client.c ++++ b/libupower-glib/up-client.c +@@ -322,6 +322,9 @@ up_client_get_property (GObject *object, + UpClient *client; + client = UP_CLIENT (object); + ++ if (client->priv->proxy == NULL) ++ return; ++ + switch (prop_id) { + case PROP_DAEMON_VERSION: + g_value_set_string (value, up_client_glue_get_daemon_version (client->priv->proxy)); +-- +cgit v0.9.0.2-2-gbebe |