pkg

Check-in [7a7b93b651]
Login

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

Overview
Comment:When fetching outside a TTY still give some feedback if not running in quiet
Timelines: family | ancestors | descendants | both | trunk | gsoc2013
Files: files | file ages | folders
SHA1: 7a7b93b65182d19b4557a5b7254d733944c9231a
User & Date: bryan@shatow.net 2014-06-11 16:33:38
Context
2014-06-11
16:50
Pkg cache: Fix symlinks not being updated. Do this atomically with rename(2). check-in: 5aa88d42b2 user: bryan@shatow.net tags: trunk, gsoc2013
16:33
When fetching outside a TTY still give some feedback if not running in quiet check-in: 7a7b93b651 user: bryan@shatow.net tags: trunk, gsoc2013
16:27
Updating/Fetching: Don't print progress bar if STDOUT is not a tty, STDIN doesn't matter here check-in: c985c21479 user: bryan@shatow.net tags: trunk, gsoc2013
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/event.c.

353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373

374
375


376
377
378

379


380
381
382
383
384
385
386
		if (quiet || !isatty(STDOUT_FILENO))
			break;
		printf("\rRemoving entries %d/%d", ev->e_upd_remove.done, ev->e_upd_remove.total);
		if (ev->e_upd_remove.total == ev->e_upd_remove.done)
			printf("\n");
		break;
	case PKG_EVENT_FETCHING:
		if (quiet || !isatty(STDOUT_FILENO))
			break;
		if (fetched == 0) {
			filename = strrchr(ev->e_fetching.url, '/');
			if (filename != NULL) {
				filename++;
			} else {
				/*
				 * We failed at being smart, so display
				 * the entire url.
				 */
				filename = ev->e_fetching.url;
			}
			strlcpy(url, filename, sizeof(url));

			start_progress_meter(url, ev->e_fetching.total,
			    &fetched);


		}
		fetched = ev->e_fetching.done;
		if (ev->e_fetching.done == ev->e_fetching.total) {

			stop_progress_meter();


			fetched = 0;
		}
		break;
	case PKG_EVENT_INSTALL_BEGIN:
		if (quiet)
			break;
		else {







|













>
|
|
>
>



>
|
>
>







353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
		if (quiet || !isatty(STDOUT_FILENO))
			break;
		printf("\rRemoving entries %d/%d", ev->e_upd_remove.done, ev->e_upd_remove.total);
		if (ev->e_upd_remove.total == ev->e_upd_remove.done)
			printf("\n");
		break;
	case PKG_EVENT_FETCHING:
		if (quiet)
			break;
		if (fetched == 0) {
			filename = strrchr(ev->e_fetching.url, '/');
			if (filename != NULL) {
				filename++;
			} else {
				/*
				 * We failed at being smart, so display
				 * the entire url.
				 */
				filename = ev->e_fetching.url;
			}
			strlcpy(url, filename, sizeof(url));
			if (isatty(STDOUT_FILENO))
				start_progress_meter(url, ev->e_fetching.total,
				    &fetched);
			else
				printf("Fetching %s...", url);
		}
		fetched = ev->e_fetching.done;
		if (ev->e_fetching.done == ev->e_fetching.total) {
			if (isatty(STDOUT_FILENO))
				stop_progress_meter();
			else
				printf(" done\n");
			fetched = 0;
		}
		break;
	case PKG_EVENT_INSTALL_BEGIN:
		if (quiet)
			break;
		else {