Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-power/upower/, sys-power/upower/files/
Date: Fri, 16 Jul 2021 11:27:19
Message-Id: 1626434620.052c810f21548e913e83f9e6d335ec5047a0eba0.asturm@gentoo
1 commit: 052c810f21548e913e83f9e6d335ec5047a0eba0
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 16 10:03:58 2021 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 16 11:23:40 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=052c810f
7
8 sys-power/upower: 0.99.12 version bump
9
10 - EAPI-8 bump
11 - Raise app-pda/libplist minimum version to >=2
12 - Drop virtual/libusb dependency
13 - Add notice about dropped support for old devices
14
15 Reported-by: Joakim Tjernlund <joakim.tjernlund <AT> infinera.com>
16 Closes: https://bugs.gentoo.org/796896
17 Package-Manager: Portage-3.0.20, Repoman-3.0.3
18 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
19
20 sys-power/upower/Manifest | 1 +
21 ....99.12-fix-power_now-energy_rate-readings.patch | 43 +++++++++
22 sys-power/upower/upower-0.99.12.ebuild | 102 +++++++++++++++++++++
23 3 files changed, 146 insertions(+)
24
25 diff --git a/sys-power/upower/Manifest b/sys-power/upower/Manifest
26 index 1a8569d7b78..5c19d802df7 100644
27 --- a/sys-power/upower/Manifest
28 +++ b/sys-power/upower/Manifest
29 @@ -1,2 +1,3 @@
30 DIST upower-0.99.11.tar.xz 430128 BLAKE2B 77604d02a69de98e4c7b268d11d189aa42ace2d62b982fda9bc41131ce383ede32953ada31eae0bbfd1121600af5863924d48c636e60a28f505a6998dcac227c SHA512 67219a0beb98c97ac4512e4fe8ba83fc80a1035d1edb5367dda6911da50c672b047051f2f528e8703be29ab47547d92b6c71a7ef695226a1bdb5bc33e6d18803
31 +DIST upower-0.99.12.tar.xz 423640 BLAKE2B 4c5c6357f0a2f8d721ebae9736912b1871a898c7ce65708626f9a9465cde87036ba6ab8050d97f5b9074d92e2700d8ed1e71b67f43cd6305eb4e89336f1b628f SHA512 9858a0e5f65271522cc5f36b0cd8722a5fb3effba37dbc5b22f08606701d4242ee54329d07460768004a24dc42705a84140ac6d9691afb7f09584b2e61fe3413
32 DIST upower-0.99.9.tar.xz 448408 BLAKE2B 5fa2436f33c94cffb736d8e3fad433acf58954cf06ccd403a0361214be5afc45d79ea279f3c5c48dcd58b92ccaf995777c95987d1749fd8c8c8958317e439570 SHA512 45eb587b0e5ffcce88bad8c56bc5efa30559748913016a55d58313280f5159378e5fbb4a9842c3a6409257bb97822d235f96b03704268b8471455c93eb05fe2f
33
34 diff --git a/sys-power/upower/files/upower-0.99.12-fix-power_now-energy_rate-readings.patch b/sys-power/upower/files/upower-0.99.12-fix-power_now-energy_rate-readings.patch
35 new file mode 100644
36 index 00000000000..c3dd864a6b1
37 --- /dev/null
38 +++ b/sys-power/upower/files/upower-0.99.12-fix-power_now-energy_rate-readings.patch
39 @@ -0,0 +1,43 @@
40 +From 2949136b152e94aa3b57da5130bcb9022724debe Mon Sep 17 00:00:00 2001
41 +From: Philipp Zabel <p.zabel@×××××××××××.de>
42 +Date: Thu, 17 Jun 2021 18:14:53 +0200
43 +Subject: [PATCH] linux: Fix < 0.01 W energy-rate readings from power_now sysfs
44 + property
45 +
46 +Currently, if a power supplies' power_now sysfs file reports discharge
47 +rates < 0.01 W, the code will try to calculate the discharge rate from
48 +the legacy sysfs files. On new kernels where those don't exist, this
49 +produces wrong results.
50 +
51 +For example, on a dual-battery Thinkpad T450s, while the external
52 +battery is discharging, the internal battery reports power_now = 0,
53 +but the corresponding upower energy-rate field incorrectly reads
54 +about 2.3 W.
55 +
56 +This patch fixes the issue by falling back to the legacy code only if
57 +the legacy current_now sysfs file exists.
58 +
59 +Closes: #7, #44
60 +---
61 + src/linux/up-device-supply.c | 5 +++--
62 + 1 file changed, 3 insertions(+), 2 deletions(-)
63 +
64 +diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
65 +index 3ebbd88..4236ce4 100644
66 +--- a/src/linux/up-device-supply.c
67 ++++ b/src/linux/up-device-supply.c
68 +@@ -682,8 +682,9 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply,
69 + state = up_device_supply_get_state (native);
70 +
71 + /* this is the new value in uW */
72 +- energy_rate = fabs (g_udev_device_get_sysfs_attr_as_double_uncached (native, "power_now") / 1000000.0);
73 +- if (energy_rate < 0.01) {
74 ++ if (g_udev_device_has_sysfs_attr (native, "power_now")) {
75 ++ energy_rate = fabs (g_udev_device_get_sysfs_attr_as_double_uncached (native, "power_now") / 1000000.0);
76 ++ } else {
77 + gdouble charge_full;
78 +
79 + /* convert charge to energy */
80 +--
81 +GitLab
82 +
83
84 diff --git a/sys-power/upower/upower-0.99.12.ebuild b/sys-power/upower/upower-0.99.12.ebuild
85 new file mode 100644
86 index 00000000000..7701fb98f1c
87 --- /dev/null
88 +++ b/sys-power/upower/upower-0.99.12.ebuild
89 @@ -0,0 +1,102 @@
90 +# Copyright 1999-2021 Gentoo Authors
91 +# Distributed under the terms of the GNU General Public License v2
92 +
93 +EAPI=8
94 +
95 +inherit systemd xdg-utils
96 +
97 +DESCRIPTION="D-Bus abstraction for enumerating power devices, querying history and statistics"
98 +HOMEPAGE="https://upower.freedesktop.org/"
99 +COMMIT="244f5966c58773bbd3b4c507c549560f"
100 +SRC_URI="https://gitlab.freedesktop.org/upower/upower/uploads/${COMMIT}/${P}.tar.xz"
101 +# No tarball released at the usual location
102 +#SRC_URI="https://${PN}.freedesktop.org/releases/${P}.tar.xz"
103 +
104 +LICENSE="GPL-2"
105 +SLOT="0/3" # based on SONAME of libupower-glib.so
106 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
107 +
108 +# gtk-doc files are not available as prebuilt in the tarball
109 +IUSE="doc +introspection ios kernel_FreeBSD kernel_linux selinux"
110 +
111 +DEPEND="
112 + >=dev-libs/glib-2.38:2
113 + sys-apps/dbus:=
114 + introspection? ( dev-libs/gobject-introspection:= )
115 + kernel_linux? (
116 + dev-libs/libgudev:=
117 + virtual/udev
118 + ios? (
119 + >=app-pda/libimobiledevice-1:=
120 + >=app-pda/libplist-2:=
121 + )
122 + )
123 +"
124 +RDEPEND="${DEPEND}
125 + selinux? ( sec-policy/selinux-devicekit )
126 +"
127 +BDEPEND="
128 + app-text/docbook-xsl-stylesheets
129 + dev-libs/libxslt
130 + >=sys-devel/gettext-0.19.8
131 + virtual/pkgconfig
132 + doc? ( dev-util/gtk-doc )
133 +"
134 +
135 +QA_MULTILIB_PATHS="usr/lib/${PN}/.*"
136 +
137 +DOCS=( AUTHORS HACKING NEWS README )
138 +
139 +PATCHES=( "${FILESDIR}/${P}-fix-power_now-energy_rate-readings.patch" ) # bug 796896
140 +
141 +src_prepare() {
142 + default
143 + xdg_environment_reset
144 + sed -i -e '/DISABLE_DEPRECATED/d' configure || die
145 +}
146 +
147 +src_configure() {
148 + local backend
149 +
150 + if use kernel_linux ; then
151 + backend=linux
152 + elif use kernel_FreeBSD ; then
153 + backend=freebsd
154 + else
155 + backend=dummy
156 + fi
157 +
158 + local myeconfargs=(
159 + --disable-tests
160 + --enable-man-pages
161 + --libexecdir="${EPREFIX}"/usr/lib/${PN}
162 + --localstatedir="${EPREFIX}"/var
163 + --with-backend=${backend}
164 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
165 + --with-systemdutildir="$(systemd_get_utildir)"
166 + $(use_enable doc gtk-doc)
167 + $(use_enable introspection)
168 + $(use_with ios idevice)
169 + )
170 + econf "${myeconfargs[@]}"
171 +}
172 +
173 +src_install() {
174 + default
175 + find "${ED}" -type f -name '*.la' -delete || die
176 + keepdir /var/lib/upower #383091
177 +}
178 +
179 +pkg_postinst() {
180 + if [[ ${REPLACING_VERSIONS} ]] && ver_test ${REPLACING_VERSIONS} -lt 0.99.12; then
181 + elog "Support for Logitech Unifying Receiver battery state readout was"
182 + elog "removed in version 0.99.12, these devices have been directly"
183 + elog "supported by the Linux kernel since version >=3.2."
184 + elog
185 + elog "Support for CSR devices battery state was removed from udev rules"
186 + elog "in version 0.99.12. This concerns the following Logitech products"
187 + elog "from the mid 2000s:"
188 + elog "Mouse/Dual/Keyboard+Mouse Receiver, Freedom Optical, Elite Duo,"
189 + elog "MX700/MX1000, Optical TrackMan, Click! Mouse, Presenter."
190 + fi
191 +}