From 1c829fb0f939d9417b3b16b2637885a826516516 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Wed, 11 Nov 2009 12:04:20 +0000 Subject: progressmeter puts STDOUT in autoflush if -t, so that it can display to it instead of piping a lot of stuff to STDERR. Go through state->print for most messages, so they will NOT do weird things with the progressmeter. Use a ->say shortcut which does the same thing that perl 5.10 say does... --- usr.sbin/pkg_add/OpenBSD/Update.pm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'usr.sbin/pkg_add/OpenBSD/Update.pm') diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 261656fa470..757a76a424d 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.92 2009/11/11 11:18:24 espie Exp $ +# $OpenBSD: Update.pm,v 1.93 2009/11/11 12:04:19 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie # @@ -44,14 +44,12 @@ sub process_handle my ($self, $set, $h, $state) = @_; my $pkgname = $h->pkgname; if (defined $h->{update}) { - $state->progress->clear; - print "Update to $pkgname already found\n"; + $state->say("Update to $pkgname already found"); return 0; } if ($pkgname =~ m/^(?:\.libs\d*|partial)\-/o) { - $state->progress->clear; - print "Not updating $pkgname, remember to clean it\n"; + $state->say("Not updating $pkgname, remember to clean it"); return 0; } my @search = (); @@ -112,8 +110,7 @@ sub process_handle } if (@$l == 1) { if ($state->{defines}->{pkgpath}) { - $state->progress->clear; - print "Directly updating $pkgname -> ", $l->[0]->name, "\n"; + $state->say("Directly updating $pkgname -> ", $l->[0]->name); $self->add_updateset($set, $h, $l->[0]); return 1; } @@ -121,12 +118,13 @@ sub process_handle !$plist->uses_old_libs && !$state->{defines}->{installed}) { my $msg = "No need to update $pkgname"; $state->progress->message($msg); - print "$msg\n" if $state->{beverbose}; + $state->say($msg) if $state->{beverbose}; return 0; } } - $state->print("Candidates for updating $pkgname -> ", join(' ', map {$_->name} @$l), "\n"); + $state->say("Candidates for updating $pkgname -> ", + join(' ', map {$_->name} @$l)); my $r = $state->choose_location($pkgname, $l); if (defined $r) { -- cgit v1.2.3