pkg

Check-in [fe21c4fc30]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not break progress by messages printed.
Timelines: family | ancestors | descendants | both | trunk | gsoc2013
Files: files | file ages | folders
SHA1: fe21c4fc306469f079f4292238447bb730f4f809
User & Date: vsevolod@highsecure.ru 2014-06-12 13:54:54
Context
2014-06-12
17:28
pkg-add.8: Add missing period check-in: 6ccfbe9e8f user: bryan@shatow.net tags: trunk, gsoc2013
13:54
Do not break progress by messages printed. check-in: fe21c4fc30 user: vsevolod@highsecure.ru tags: trunk, gsoc2013
13:07
Use uid to check for newer version of a pkg check-in: b32f29f87b user: bapt@FreeBSD.org tags: trunk, gsoc2013
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/event.c.

266
267
268
269
270
271
272











273
274
275
276
277
278
279
...
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
...
322
323
324
325
326
327
328









329
330
331
332
333
334
335
progress_alarm_handler(int signo)
{
	if (max_slots != last_progress_slots && progress_alarm && progress_started) {
		last_progress_slots = -1;
		alarm(1);
	}
}












static void
draw_progressbar(int64_t current, int64_t total)
{
	int slots = nearbyint((double)max_slots * current / (double)total);
	int remain;

................................................................................
			remain --;
		}
		bar[r] = '\0';
		printf("%s] %" PRId64 " / %" PRId64, bar, current, total);
		fflush(stdout);
	}
	if (current >= total) {
		if (progress_alarm)
			putchar('\n');

		last_progress_slots = -1;
		progress_alarm = false;
		progress_started = false;
	}
	else if (!progress_alarm && progress_started) {
		/* Setup auxiliary alarm */
		struct sigaction sa;

		memset(&sa, 0, sizeof(sa));
		sa.sa_handler = progress_alarm_handler;
................................................................................
int
event_callback(void *data, struct pkg_event *ev)
{
	struct pkg *pkg = NULL, *pkg_new, *pkg_old;
	int *debug = data;
	const char *filename;
	struct pkg_event_conflict *cur_conflict;










	switch(ev->type) {
	case PKG_EVENT_ERRNO:
		warnx("%s(%s): %s", ev->e_errno.func, ev->e_errno.arg,
		    strerror(ev->e_errno.no));
		break;
	case PKG_EVENT_ERROR:







>
>
>
>
>
>
>
>
>
>
>







 







|
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>







266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
...
306
307
308
309
310
311
312
313





314
315
316
317
318
319
320
...
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
progress_alarm_handler(int signo)
{
	if (max_slots != last_progress_slots && progress_alarm && progress_started) {
		last_progress_slots = -1;
		alarm(1);
	}
}

static void
stop_progressbar(void)
{
	if (progress_alarm)
		putchar('\n');

	last_progress_slots = -1;
	progress_alarm = false;
	progress_started = false;
}

static void
draw_progressbar(int64_t current, int64_t total)
{
	int slots = nearbyint((double)max_slots * current / (double)total);
	int remain;

................................................................................
			remain --;
		}
		bar[r] = '\0';
		printf("%s] %" PRId64 " / %" PRId64, bar, current, total);
		fflush(stdout);
	}
	if (current >= total) {
		stop_progressbar();





	}
	else if (!progress_alarm && progress_started) {
		/* Setup auxiliary alarm */
		struct sigaction sa;

		memset(&sa, 0, sizeof(sa));
		sa.sa_handler = progress_alarm_handler;
................................................................................
int
event_callback(void *data, struct pkg_event *ev)
{
	struct pkg *pkg = NULL, *pkg_new, *pkg_old;
	int *debug = data;
	const char *filename;
	struct pkg_event_conflict *cur_conflict;

	/*
	 * If a progressbar has been interrupted by another event, then
	 * we need to stop it immediately to avoid bad formatting
	 */
	if (progress_started && ev->type != PKG_EVENT_PROGRESS_TICK) {
		stop_progressbar();
		progress_started = true;
	}

	switch(ev->type) {
	case PKG_EVENT_ERRNO:
		warnx("%s(%s): %s", ev->e_errno.func, ev->e_errno.arg,
		    strerror(ev->e_errno.no));
		break;
	case PKG_EVENT_ERROR: