Gentoo Archives: gentoo-commits

From: Alexandre Restovtsev <tetromino@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gnome:master commit in: gnome-extra/gnome-system-monitor/files/, gnome-extra/gnome-system-monitor/
Date: Tue, 26 Jul 2011 09:02:11
Message-Id: 5a5a7ebae55139c11f6ccae001e633dc2d95744a.tetromino@gentoo
1 commit: 5a5a7ebae55139c11f6ccae001e633dc2d95744a
2 Author: Alexandre Rostovtsev <tetromino <AT> gmail <DOT> com>
3 AuthorDate: Tue Jul 26 07:51:25 2011 +0000
4 Commit: Alexandre Restovtsev <tetromino <AT> gmail <DOT> com>
5 CommitDate: Tue Jul 26 07:51:25 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=5a5a7eba
7
8 gnome-extra/gnome-system-monitor: 3.0.1 → 3.0.1-r1
9
10 Add patches from upstream git master (not present in the gnome-3-0
11 branch, unfortunately) fixing the maximum nice value on Linux and an
12 overflow in the network history totals counters on 32-bit architectures.
13
14 ---
15 ...or-3.0.1-32-bit-network-totals-overflow-1.patch | 68 +++++++++
16 ...or-3.0.1-32-bit-network-totals-overflow-2.patch | 150 ++++++++++++++++++++
17 ...or-3.0.1-32-bit-network-totals-overflow-3.patch | 102 +++++++++++++
18 .../gnome-system-monitor-3.0.1-linux-nice.patch | 21 +++
19 ...ebuild => gnome-system-monitor-3.0.1-r1.ebuild} | 12 ++-
20 5 files changed, 352 insertions(+), 1 deletions(-)
21
22 diff --git a/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-32-bit-network-totals-overflow-1.patch b/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-32-bit-network-totals-overflow-1.patch
23 new file mode 100644
24 index 0000000..156845f
25 --- /dev/null
26 +++ b/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-32-bit-network-totals-overflow-1.patch
27 @@ -0,0 +1,68 @@
28 +From 3ea7303181e80e188e72a4fcd98b9970fe554b3b Mon Sep 17 00:00:00 2001
29 +From: Chris Kühl <chrisk@×××××××××.com>
30 +Date: Sat, 16 Apr 2011 23:07:20 +0000
31 +Subject: Added SI prefix tera to network counter
32 +
33 +https://bugzilla.gnome.org/show_bug.cgi?id=639212
34 +---
35 +diff --git a/src/util.cpp b/src/util.cpp
36 +index 90073fe..234e6fc 100644
37 +--- a/src/util.cpp
38 ++++ b/src/util.cpp
39 +@@ -149,10 +149,12 @@ procman_make_label_for_mmaps_or_ofiles(const char *format,
40 + gchar*
41 + procman::format_size(guint64 size, guint64 max_size, bool want_bits)
42 + {
43 ++
44 + enum {
45 + K_INDEX,
46 + M_INDEX,
47 +- G_INDEX
48 ++ G_INDEX,
49 ++ T_INDEX
50 + };
51 +
52 + struct Format {
53 +@@ -160,16 +162,18 @@ procman::format_size(guint64 size, guint64 max_size, bool want_bits)
54 + const char* string;
55 + };
56 +
57 +- const Format all_formats[2][3] = {
58 +- { { 1UL << 10, N_("%.1f KiB") },
59 +- { 1UL << 20, N_("%.1f MiB") },
60 +- { 1UL << 30, N_("%.1f GiB") } },
61 +- { { 1000, N_("%.1f kbit") },
62 +- { 1000000, N_("%.1f Mbit") },
63 +- { 1000000000, N_("%.1f Gbit") } }
64 ++ const Format all_formats[2][4] = {
65 ++ { { 1UL << 10, N_("%.1f KiB") },
66 ++ { 1UL << 20, N_("%.1f MiB") },
67 ++ { 1UL << 30, N_("%.1f GiB") },
68 ++ { 1UL << 40, N_("%.1f TiB") } },
69 ++ { { 1000, N_("%.1f kbit") },
70 ++ { 1000000, N_("%.1f Mbit") },
71 ++ { 1000000000, N_("%.1f Gbit") },
72 ++ { 1000000000000, N_("%.1f Tbit") } }
73 + };
74 +
75 +- const Format (&formats)[3] = all_formats[want_bits ? 1 : 0];
76 ++ const Format (&formats)[4] = all_formats[want_bits ? 1 : 0];
77 +
78 + if (want_bits) {
79 + size *= 8;
80 +@@ -194,9 +198,12 @@ procman::format_size(guint64 size, guint64 max_size, bool want_bits)
81 + } else if (max_size < formats[G_INDEX].factor) {
82 + factor = formats[M_INDEX].factor;
83 + format = formats[M_INDEX].string;
84 +- } else {
85 ++ } else if (max_size < formats[T_INDEX].factor) {
86 + factor = formats[G_INDEX].factor;
87 + format = formats[G_INDEX].string;
88 ++ } else {
89 ++ factor = formats[T_INDEX].factor;
90 ++ format = formats[T_INDEX].string;
91 + }
92 +
93 + return g_strdup_printf(_(format), size / (double)factor);
94 +--
95 +cgit v0.9
96
97 diff --git a/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-32-bit-network-totals-overflow-2.patch b/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-32-bit-network-totals-overflow-2.patch
98 new file mode 100644
99 index 0000000..4fdc57a
100 --- /dev/null
101 +++ b/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-32-bit-network-totals-overflow-2.patch
102 @@ -0,0 +1,150 @@
103 +From c7275791a89623ad1edc820a6ef16faae37a18aa Mon Sep 17 00:00:00 2001
104 +From: Chris Kühl <chrisk@×××××××××.com>
105 +Date: Sun, 17 Apr 2011 22:31:00 +0000
106 +Subject: Fix network totals overflow on 32-bit machines.
107 +
108 +https://bugzilla.gnome.org/show_bug.cgi?id=639212
109 +---
110 +diff --git a/src/load-graph.cpp b/src/load-graph.cpp
111 +index 57bca17..a6d2a7e 100644
112 +--- a/src/load-graph.cpp
113 ++++ b/src/load-graph.cpp
114 +@@ -368,16 +368,16 @@ get_memory (LoadGraph *g)
115 + }
116 +
117 + static void
118 +-net_scale (LoadGraph *g, unsigned din, unsigned dout)
119 ++net_scale (LoadGraph *g, guint64 din, guint64 dout)
120 + {
121 + g->data[0][0] = 1.0f * din / g->net.max;
122 + g->data[0][1] = 1.0f * dout / g->net.max;
123 +
124 +- unsigned dmax = std::max(din, dout);
125 ++ guint64 dmax = std::max(din, dout);
126 + g->net.values[g->net.cur] = dmax;
127 + g->net.cur = (g->net.cur + 1) % LoadGraph::NUM_POINTS;
128 +
129 +- unsigned new_max;
130 ++ guint64 new_max;
131 + // both way, new_max is the greatest value
132 + if (dmax >= g->net.max)
133 + new_max = dmax;
134 +@@ -389,7 +389,7 @@ net_scale (LoadGraph *g, unsigned din, unsigned dout)
135 + // Round network maximum
136 + //
137 +
138 +- const unsigned bak_max(new_max);
139 ++ const guint64 bak_max(new_max);
140 +
141 + if (ProcData::get_instance()->config.network_in_bits) {
142 + // TODO: fix logic to give a nice scale with bits
143 +@@ -399,7 +399,7 @@ net_scale (LoadGraph *g, unsigned din, unsigned dout)
144 + new_max = 1.1 * new_max;
145 + // make sure max is not 0 to avoid / 0
146 + // default to 125 bytes == 1kbit
147 +- new_max = std::max(new_max, 125U);
148 ++ new_max = std::max(new_max, 125UL);
149 +
150 + } else {
151 + // round up to get some extra space
152 +@@ -407,7 +407,7 @@ net_scale (LoadGraph *g, unsigned din, unsigned dout)
153 + new_max = 1.1 * new_max;
154 + // make sure max is not 0 to avoid / 0
155 + // default to 1 KiB
156 +- new_max = std::max(new_max, 1024U);
157 ++ new_max = std::max(new_max, 1024UL);
158 +
159 + // decompose new_max = coef10 * 2**(base10 * 10)
160 + // where coef10 and base10 are integers and coef10 < 2**10
161 +@@ -415,16 +415,16 @@ net_scale (LoadGraph *g, unsigned din, unsigned dout)
162 + // e.g: ceil(100.5 KiB) = 101 KiB = 101 * 2**(1 * 10)
163 + // where base10 = 1, coef10 = 101, pow2 = 16
164 +
165 +- unsigned pow2 = std::floor(log2(new_max));
166 +- unsigned base10 = pow2 / 10;
167 +- unsigned coef10 = std::ceil(new_max / double(1UL << (base10 * 10)));
168 ++ guint64 pow2 = std::floor(log2(new_max));
169 ++ guint64 base10 = pow2 / 10.0;
170 ++ guint64 coef10 = std::ceil(new_max / double(1UL <<(base10 * 10)));
171 + g_assert(new_max <= (coef10 * (1UL << (base10 * 10))));
172 +
173 + // then decompose coef10 = x * 10**factor10
174 + // where factor10 is integer and x < 10
175 + // so we new_max has only 1 significant digit
176 +
177 +- unsigned factor10 = std::pow(10.0, std::floor(std::log10(coef10)));
178 ++ guint64 factor10 = std::pow(10.0, std::floor(std::log10(coef10)));
179 + coef10 = std::ceil(coef10 / double(factor10)) * factor10;
180 +
181 + // then make coef10 divisible by num_bars
182 +@@ -432,12 +432,12 @@ net_scale (LoadGraph *g, unsigned din, unsigned dout)
183 + coef10 = coef10 + (g->num_bars() - coef10 % g->num_bars());
184 + g_assert(coef10 % g->num_bars() == 0);
185 +
186 +- new_max = coef10 * (1UL << (base10 * 10));
187 +- procman_debug("bak %u new_max %u pow2 %u coef10 %u", bak_max, new_max, pow2, coef10);
188 ++ new_max = coef10 * (1UL << guint64(base10 * 10));
189 ++ procman_debug("bak %lu new_max %lu pow2 %lu coef10 %lu", bak_max, new_max, pow2, coef10);
190 + }
191 +
192 + if (bak_max > new_max) {
193 +- procman_debug("overflow detected: bak=%u new=%u", bak_max, new_max);
194 ++ procman_debug("overflow detected: bak=%lu new=%lu", bak_max, new_max);
195 + new_max = bak_max;
196 + }
197 +
198 +@@ -446,7 +446,7 @@ net_scale (LoadGraph *g, unsigned din, unsigned dout)
199 + if ((0.8 * g->net.max) < new_max && new_max <= g->net.max)
200 + return;
201 +
202 +- const float scale = 1.0f * g->net.max / new_max;
203 ++ const double scale = 1.0f * g->net.max / new_max;
204 +
205 + for (size_t i = 0; i < LoadGraph::NUM_POINTS; i++) {
206 + if (g->data[i][0] >= 0.0f) {
207 +@@ -455,7 +455,7 @@ net_scale (LoadGraph *g, unsigned din, unsigned dout)
208 + }
209 + }
210 +
211 +- procman_debug("rescale dmax = %u max = %u new_max = %u", dmax, g->net.max, new_max);
212 ++ procman_debug("rescale dmax = %lu max = %lu new_max = %lu", dmax, g->net.max, new_max);
213 +
214 + g->net.max = new_max;
215 +
216 +@@ -471,7 +471,7 @@ get_net (LoadGraph *g)
217 + guint32 i;
218 + guint64 in = 0, out = 0;
219 + GTimeVal time;
220 +- unsigned din, dout;
221 ++ guint64 din, dout;
222 +
223 + ifnames = glibtop_get_netlist(&netlist);
224 +
225 +@@ -510,9 +510,9 @@ get_net (LoadGraph *g)
226 + g->net.time.tv_sec != 0) {
227 + float dtime;
228 + dtime = time.tv_sec - g->net.time.tv_sec +
229 +- (float) (time.tv_usec - g->net.time.tv_usec) / G_USEC_PER_SEC;
230 +- din = static_cast<unsigned>((in - g->net.last_in) / dtime);
231 +- dout = static_cast<unsigned>((out - g->net.last_out) / dtime);
232 ++ (double) (time.tv_usec - g->net.time.tv_usec) / G_USEC_PER_SEC;
233 ++ din = static_cast<guint64>((in - g->net.last_in) / dtime);
234 ++ dout = static_cast<guint64>((out - g->net.last_out) / dtime);
235 + } else {
236 + /* Don't calc anything if new data is less than old (interface
237 + removed, counters reset, ...) or if it is the first time */
238 +diff --git a/src/load-graph.h b/src/load-graph.h
239 +index d90cf38..9b43c86 100644
240 +--- a/src/load-graph.h
241 ++++ b/src/load-graph.h
242 +@@ -87,7 +87,7 @@ struct LoadGraph {
243 + struct {
244 + guint64 last_in, last_out;
245 + GTimeVal time;
246 +- unsigned int max;
247 ++ guint64 max;
248 + unsigned values[NUM_POINTS];
249 + size_t cur;
250 + } net;
251 +--
252 +cgit v0.9
253
254 diff --git a/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-32-bit-network-totals-overflow-3.patch b/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-32-bit-network-totals-overflow-3.patch
255 new file mode 100644
256 index 0000000..d3ac4d9
257 --- /dev/null
258 +++ b/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-32-bit-network-totals-overflow-3.patch
259 @@ -0,0 +1,102 @@
260 +From 843cc40119d36873f9670975c7815fbd38481093 Mon Sep 17 00:00:00 2001
261 +From: Chris Kühl <chrisk@×××××××××.com>
262 +Date: Thu, 12 May 2011 21:43:31 +0000
263 +Subject: Fix for issues on 32-bit machines.
264 +
265 +https://bugzilla.gnome.org/show_bug.cgi?id=649842
266 +---
267 +diff --git a/src/load-graph.cpp b/src/load-graph.cpp
268 +index a6d2a7e..9291179 100644
269 +--- a/src/load-graph.cpp
270 ++++ b/src/load-graph.cpp
271 +@@ -399,7 +399,7 @@ net_scale (LoadGraph *g, guint64 din, guint64 dout)
272 + new_max = 1.1 * new_max;
273 + // make sure max is not 0 to avoid / 0
274 + // default to 125 bytes == 1kbit
275 +- new_max = std::max(new_max, 125UL);
276 ++ new_max = std::max(new_max, G_GUINT64_CONSTANT(125));
277 +
278 + } else {
279 + // round up to get some extra space
280 +@@ -407,7 +407,7 @@ net_scale (LoadGraph *g, guint64 din, guint64 dout)
281 + new_max = 1.1 * new_max;
282 + // make sure max is not 0 to avoid / 0
283 + // default to 1 KiB
284 +- new_max = std::max(new_max, 1024UL);
285 ++ new_max = std::max(new_max, G_GUINT64_CONSTANT(1024));
286 +
287 + // decompose new_max = coef10 * 2**(base10 * 10)
288 + // where coef10 and base10 are integers and coef10 < 2**10
289 +@@ -417,8 +417,8 @@ net_scale (LoadGraph *g, guint64 din, guint64 dout)
290 +
291 + guint64 pow2 = std::floor(log2(new_max));
292 + guint64 base10 = pow2 / 10.0;
293 +- guint64 coef10 = std::ceil(new_max / double(1UL <<(base10 * 10)));
294 +- g_assert(new_max <= (coef10 * (1UL << (base10 * 10))));
295 ++ guint64 coef10 = std::ceil(new_max / double(G_GUINT64_CONSTANT(1) << (base10 * 10)));
296 ++ g_assert(new_max <= (coef10 * (G_GUINT64_CONSTANT(1) << (base10 * 10))));
297 +
298 + // then decompose coef10 = x * 10**factor10
299 + // where factor10 is integer and x < 10
300 +@@ -431,13 +431,16 @@ net_scale (LoadGraph *g, guint64 din, guint64 dout)
301 + if (coef10 % g->num_bars() != 0)
302 + coef10 = coef10 + (g->num_bars() - coef10 % g->num_bars());
303 + g_assert(coef10 % g->num_bars() == 0);
304 +-
305 +- new_max = coef10 * (1UL << guint64(base10 * 10));
306 +- procman_debug("bak %lu new_max %lu pow2 %lu coef10 %lu", bak_max, new_max, pow2, coef10);
307 ++ new_max = coef10 * (G_GUINT64_CONSTANT(1) << guint64(base10 * 10));
308 ++ procman_debug("bak %" G_GUINT64_FORMAT " new_max %" G_GUINT64_FORMAT
309 ++ "pow2 %" G_GUINT64_FORMAT " coef10 %" G_GUINT64_FORMAT,
310 ++ bak_max, new_max, pow2, coef10);
311 + }
312 +
313 + if (bak_max > new_max) {
314 +- procman_debug("overflow detected: bak=%lu new=%lu", bak_max, new_max);
315 ++ procman_debug("overflow detected: bak=%" G_GUINT64_FORMAT
316 ++ " new=%" G_GUINT64_FORMAT,
317 ++ bak_max, new_max);
318 + new_max = bak_max;
319 + }
320 +
321 +@@ -455,7 +458,10 @@ net_scale (LoadGraph *g, guint64 din, guint64 dout)
322 + }
323 + }
324 +
325 +- procman_debug("rescale dmax = %lu max = %lu new_max = %lu", dmax, g->net.max, new_max);
326 ++ procman_debug("rescale dmax = %" G_GUINT64_FORMAT
327 ++ " max = %" G_GUINT64_FORMAT
328 ++ " new_max = %" G_GUINT64_FORMAT,
329 ++ dmax, g->net.max, new_max);
330 +
331 + g->net.max = new_max;
332 +
333 +diff --git a/src/util.cpp b/src/util.cpp
334 +index 234e6fc..7183ff4 100644
335 +--- a/src/util.cpp
336 ++++ b/src/util.cpp
337 +@@ -163,14 +163,14 @@ procman::format_size(guint64 size, guint64 max_size, bool want_bits)
338 + };
339 +
340 + const Format all_formats[2][4] = {
341 +- { { 1UL << 10, N_("%.1f KiB") },
342 +- { 1UL << 20, N_("%.1f MiB") },
343 +- { 1UL << 30, N_("%.1f GiB") },
344 +- { 1UL << 40, N_("%.1f TiB") } },
345 +- { { 1000, N_("%.1f kbit") },
346 +- { 1000000, N_("%.1f Mbit") },
347 +- { 1000000000, N_("%.1f Gbit") },
348 +- { 1000000000000, N_("%.1f Tbit") } }
349 ++ { { G_GUINT64_CONSTANT(1) << 10, N_("%.1f KiB") },
350 ++ { G_GUINT64_CONSTANT(1) << 20, N_("%.1f MiB") },
351 ++ { G_GUINT64_CONSTANT(1) << 30, N_("%.1f GiB") },
352 ++ { G_GUINT64_CONSTANT(1) << 40, N_("%.1f TiB") } },
353 ++ { { G_GUINT64_CONSTANT(1000), N_("%.1f kbit") },
354 ++ { G_GUINT64_CONSTANT(1000000), N_("%.1f Mbit") },
355 ++ { G_GUINT64_CONSTANT(1000000000), N_("%.1f Gbit") },
356 ++ { G_GUINT64_CONSTANT(1000000000000), N_("%.1f Tbit") } }
357 + };
358 +
359 + const Format (&formats)[4] = all_formats[want_bits ? 1 : 0];
360 +--
361 +cgit v0.9
362
363 diff --git a/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-linux-nice.patch b/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-linux-nice.patch
364 new file mode 100644
365 index 0000000..55d4e41
366 --- /dev/null
367 +++ b/gnome-extra/gnome-system-monitor/files/gnome-system-monitor-3.0.1-linux-nice.patch
368 @@ -0,0 +1,21 @@
369 +From 7c493352b24fb6d0d8b003f25043b070244eeb2e Mon Sep 17 00:00:00 2001
370 +From: Chris Kühl <chrisk@×××××××××.com>
371 +Date: Fri, 15 Apr 2011 09:18:10 +0000
372 +Subject: Make maximum nice value 19 instead of 20 on Linux.
373 +
374 +---
375 +diff --git a/src/procdialogs.h b/src/procdialogs.h
376 +index eba3212..61decf8 100644
377 +--- a/src/procdialogs.h
378 ++++ b/src/procdialogs.h
379 +@@ -26,7 +26,7 @@
380 + /* These are the actual range of settable values. Values outside this range
381 + are scaled back to these limits. So show these limits in the slider
382 + */
383 +-#ifdef linux
384 ++#ifdef __linux__
385 + #define RENICE_VAL_MIN -20
386 + #define RENICE_VAL_MAX 19
387 + #else /* ! linux */
388 +--
389 +cgit v0.9
390
391 diff --git a/gnome-extra/gnome-system-monitor/gnome-system-monitor-3.0.1.ebuild b/gnome-extra/gnome-system-monitor/gnome-system-monitor-3.0.1-r1.ebuild
392 similarity index 72%
393 rename from gnome-extra/gnome-system-monitor/gnome-system-monitor-3.0.1.ebuild
394 rename to gnome-extra/gnome-system-monitor/gnome-system-monitor-3.0.1-r1.ebuild
395 index 6590d05..6162a1e 100644
396 --- a/gnome-extra/gnome-system-monitor/gnome-system-monitor-3.0.1.ebuild
397 +++ b/gnome-extra/gnome-system-monitor/gnome-system-monitor-3.0.1-r1.ebuild
398 @@ -5,7 +5,7 @@
399 EAPI="3"
400 GCONF_DEBUG="no"
401
402 -inherit gnome2
403 +inherit eutils gnome2
404
405 DESCRIPTION="The Gnome System Monitor"
406 HOMEPAGE="http://www.gnome.org/"
407 @@ -37,3 +37,13 @@ pkg_setup() {
408 --disable-schemas-compile
409 --disable-scrollkeeper"
410 }
411 +
412 +src_prepare() {
413 + # Add some useful patches from upstream git master
414 + # Use the correct maximum nice value on Linux
415 + epatch "${FILESDIR}/${PN}-3.0.1-linux-nice.patch"
416 + # Don't overflow the network history totals counters on 32-bit machines
417 + epatch "${FILESDIR}/${PN}"-3.0.1-32-bit-network-totals-overflow-{1,2,3}.patch
418 +
419 + gnome2_src_prepare
420 +}