1 |
commit: ef11ee8b619f1317a8063d404cba5ee4edbd16d1 |
2 |
Author: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jan 20 13:36:50 2019 +0000 |
4 |
Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jan 20 13:40:34 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef11ee8b |
7 |
|
8 |
sys-power/upower: Consider pending-charge when calculating |
9 |
|
10 |
Thanks-to: Maik |
11 |
Closes: https://bugs.gentoo.org/671570 |
12 |
Package-Manager: Portage-2.3.55, Repoman-2.3.12 |
13 |
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org> |
14 |
|
15 |
.../files/upower-0.99.9-pending-charge1.patch | 33 ++++++++ |
16 |
.../files/upower-0.99.9-pending-charge2.patch | 48 +++++++++++ |
17 |
sys-power/upower/upower-0.99.9-r1.ebuild | 98 ++++++++++++++++++++++ |
18 |
3 files changed, 179 insertions(+) |
19 |
|
20 |
diff --git a/sys-power/upower/files/upower-0.99.9-pending-charge1.patch b/sys-power/upower/files/upower-0.99.9-pending-charge1.patch |
21 |
new file mode 100644 |
22 |
index 00000000000..9ce91c10a66 |
23 |
--- /dev/null |
24 |
+++ b/sys-power/upower/files/upower-0.99.9-pending-charge1.patch |
25 |
@@ -0,0 +1,33 @@ |
26 |
+From a074a5462ab9749ad4aaca52e0202602897660aa Mon Sep 17 00:00:00 2001 |
27 |
+From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= <jprvita@××××××××.com> |
28 |
+Date: Thu, 1 Nov 2018 14:45:28 -0700 |
29 |
+Subject: [PATCH] daemon: Make comment more succinct |
30 |
+ |
31 |
+This will help make it more clear when adding an extra state on the |
32 |
+following commit. It also makes the language consistent between the |
33 |
+different lines. There are no changes on the meaning of these lines nor |
34 |
+any functional changes on this commit. |
35 |
+--- |
36 |
+ src/up-daemon.c | 6 +++--- |
37 |
+ 1 file changed, 3 insertions(+), 3 deletions(-) |
38 |
+ |
39 |
+diff --git a/src/up-daemon.c b/src/up-daemon.c |
40 |
+index 1a5dddc..95fff6b 100644 |
41 |
+--- a/src/up-daemon.c |
42 |
++++ b/src/up-daemon.c |
43 |
+@@ -209,9 +209,9 @@ up_daemon_update_display_battery (UpDaemon *daemon) |
44 |
+ power_supply == FALSE) |
45 |
+ continue; |
46 |
+ |
47 |
+- /* If one battery is charging, then the composite is charging |
48 |
+- * If all batteries are discharging, then the composite is discharging |
49 |
+- * If all batteries are fully charged, then they're all fully charged |
50 |
++ /* If one battery is charging, the composite is charging |
51 |
++ * If all batteries are discharging, the composite is discharging |
52 |
++ * If all batteries are fully charged, the composite is fully charged |
53 |
+ * Everything else is unknown */ |
54 |
+ if (state == UP_DEVICE_STATE_CHARGING) |
55 |
+ state_total = UP_DEVICE_STATE_CHARGING; |
56 |
+-- |
57 |
+2.18.1 |
58 |
+ |
59 |
|
60 |
diff --git a/sys-power/upower/files/upower-0.99.9-pending-charge2.patch b/sys-power/upower/files/upower-0.99.9-pending-charge2.patch |
61 |
new file mode 100644 |
62 |
index 00000000000..a79ebac7ed1 |
63 |
--- /dev/null |
64 |
+++ b/sys-power/upower/files/upower-0.99.9-pending-charge2.patch |
65 |
@@ -0,0 +1,48 @@ |
66 |
+From a074631c0b1748c8a791c4f0dad99da75805a328 Mon Sep 17 00:00:00 2001 |
67 |
+From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Rechi=20Vita?= <jprvita@××××××××.com> |
68 |
+Date: Mon, 15 Oct 2018 17:05:27 -0700 |
69 |
+Subject: [PATCH] daemon: Consider pending-charge when calculating the display |
70 |
+ state |
71 |
+ |
72 |
+Without this change if all batteries in the system are in the |
73 |
+pending-charge state, the display device state is set to unknown, and |
74 |
+its icon to battery-missing-symbolic. |
75 |
+ |
76 |
+This change makes the pending-charge state be considered when |
77 |
+calculating the DisplayDevice state, setting it to pending-charge if at |
78 |
+least one battery in the system is pending-charge and no other is |
79 |
+charging or discharging. |
80 |
+ |
81 |
+Closes: #81 |
82 |
+Closes: #19 |
83 |
+--- |
84 |
+ src/up-daemon.c | 6 +++++- |
85 |
+ 1 file changed, 5 insertions(+), 1 deletion(-) |
86 |
+ |
87 |
+diff --git a/src/up-daemon.c b/src/up-daemon.c |
88 |
+index 95fff6b..690f379 100644 |
89 |
+--- a/src/up-daemon.c |
90 |
++++ b/src/up-daemon.c |
91 |
+@@ -210,14 +210,18 @@ up_daemon_update_display_battery (UpDaemon *daemon) |
92 |
+ continue; |
93 |
+ |
94 |
+ /* If one battery is charging, the composite is charging |
95 |
+- * If all batteries are discharging, the composite is discharging |
96 |
++ * If all batteries are discharging or pending-charge, the composite is discharging |
97 |
+ * If all batteries are fully charged, the composite is fully charged |
98 |
++ * If one battery is pending-charge and no other is charging or discharging, then the composite is pending-charge |
99 |
+ * Everything else is unknown */ |
100 |
+ if (state == UP_DEVICE_STATE_CHARGING) |
101 |
+ state_total = UP_DEVICE_STATE_CHARGING; |
102 |
+ else if (state == UP_DEVICE_STATE_DISCHARGING && |
103 |
+ state_total != UP_DEVICE_STATE_CHARGING) |
104 |
+ state_total = UP_DEVICE_STATE_DISCHARGING; |
105 |
++ else if (state == UP_DEVICE_STATE_PENDING_CHARGE && |
106 |
++ (state_total == UP_DEVICE_STATE_UNKNOWN || state_total == UP_DEVICE_STATE_PENDING_CHARGE)) |
107 |
++ state_total = UP_DEVICE_STATE_PENDING_CHARGE; |
108 |
+ else if (state == UP_DEVICE_STATE_FULLY_CHARGED && |
109 |
+ state_total == UP_DEVICE_STATE_UNKNOWN) |
110 |
+ state_total = UP_DEVICE_STATE_FULLY_CHARGED; |
111 |
+-- |
112 |
+2.18.1 |
113 |
+ |
114 |
|
115 |
diff --git a/sys-power/upower/upower-0.99.9-r1.ebuild b/sys-power/upower/upower-0.99.9-r1.ebuild |
116 |
new file mode 100644 |
117 |
index 00000000000..c154b148365 |
118 |
--- /dev/null |
119 |
+++ b/sys-power/upower/upower-0.99.9-r1.ebuild |
120 |
@@ -0,0 +1,98 @@ |
121 |
+# Copyright 1999-2019 Gentoo Authors |
122 |
+# Distributed under the terms of the GNU General Public License v2 |
123 |
+ |
124 |
+EAPI=7 |
125 |
+inherit systemd xdg-utils |
126 |
+ |
127 |
+DESCRIPTION="D-Bus abstraction for enumerating power devices, querying history and statistics" |
128 |
+HOMEPAGE="https://upower.freedesktop.org/" |
129 |
+ |
130 |
+# No tarball released, use the same commit as Fedora |
131 |
+#SRC_URI="https://${PN}.freedesktop.org/releases/${P}.tar.xz" |
132 |
+COMMIT="2282c7c0e53fb31816b824c9d1f547e8" |
133 |
+SRC_URI="https://gitlab.freedesktop.org/upower/upower/uploads/${COMMIT}/${P}.tar.xz" |
134 |
+ |
135 |
+LICENSE="GPL-2" |
136 |
+SLOT="0/3" # based on SONAME of libupower-glib.so |
137 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd" |
138 |
+ |
139 |
+# gtk-doc files are not available as prebuilt in the tarball |
140 |
+IUSE="doc +introspection ios kernel_FreeBSD kernel_linux selinux" |
141 |
+ |
142 |
+COMMON_DEPS=" |
143 |
+ >=dev-libs/dbus-glib-0.100 |
144 |
+ >=dev-libs/glib-2.34:2 |
145 |
+ sys-apps/dbus:= |
146 |
+ introspection? ( dev-libs/gobject-introspection:= ) |
147 |
+ kernel_linux? ( |
148 |
+ virtual/libusb:1 |
149 |
+ virtual/libgudev:= |
150 |
+ virtual/udev |
151 |
+ ios? ( |
152 |
+ >=app-pda/libimobiledevice-1:= |
153 |
+ >=app-pda/libplist-1:= |
154 |
+ ) |
155 |
+ ) |
156 |
+" |
157 |
+RDEPEND=" |
158 |
+ ${COMMON_DEPS} |
159 |
+ selinux? ( sec-policy/selinux-devicekit ) |
160 |
+" |
161 |
+DEPEND="${COMMON_DEPS} |
162 |
+ doc? ( dev-util/gtk-doc ) |
163 |
+ dev-libs/libxslt |
164 |
+ app-text/docbook-xsl-stylesheets |
165 |
+ dev-util/intltool |
166 |
+ >=sys-devel/gettext-0.17 |
167 |
+ virtual/pkgconfig |
168 |
+" |
169 |
+ |
170 |
+QA_MULTILIB_PATHS="usr/lib/${PN}/.*" |
171 |
+ |
172 |
+DOCS=( AUTHORS HACKING NEWS README ) |
173 |
+ |
174 |
+PATCHES=( |
175 |
+ # daemon: Consider pending-charge when calculating the display state |
176 |
+ # (from 'master') |
177 |
+ "${FILESDIR}/${P}-pending-charge1.patch" |
178 |
+ "${FILESDIR}/${P}-pending-charge2.patch" |
179 |
+) |
180 |
+ |
181 |
+src_prepare() { |
182 |
+ default |
183 |
+ xdg_environment_reset |
184 |
+ sed -i -e '/DISABLE_DEPRECATED/d' configure || die |
185 |
+} |
186 |
+ |
187 |
+src_configure() { |
188 |
+ local backend |
189 |
+ |
190 |
+ if use kernel_linux ; then |
191 |
+ backend=linux |
192 |
+ elif use kernel_FreeBSD ; then |
193 |
+ backend=freebsd |
194 |
+ else |
195 |
+ backend=dummy |
196 |
+ fi |
197 |
+ |
198 |
+ local myeconfargs=( |
199 |
+ --disable-static |
200 |
+ --disable-tests |
201 |
+ --enable-man-pages |
202 |
+ --libexecdir="${EPREFIX}"/usr/lib/${PN} |
203 |
+ --localstatedir="${EPREFIX}"/var |
204 |
+ --with-backend=${backend} |
205 |
+ --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" |
206 |
+ --with-systemdutildir="$(systemd_get_utildir)" |
207 |
+ $(use_enable doc gtk-doc) |
208 |
+ $(use_enable introspection) |
209 |
+ $(use_with ios idevice) |
210 |
+ ) |
211 |
+ econf "${myeconfargs[@]}" |
212 |
+} |
213 |
+ |
214 |
+src_install() { |
215 |
+ default |
216 |
+ find "${ED}" -name '*.la' -delete || die |
217 |
+ keepdir /var/lib/upower #383091 |
218 |
+} |