diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-11-11 12:04:20 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-11-11 12:04:20 +0000 |
commit | 1c829fb0f939d9417b3b16b2637885a826516516 (patch) | |
tree | d82a0ae2dc06d00f975cfffd14a8c576d7e2fb8e /usr.sbin/pkg_add/OpenBSD/Update.pm | |
parent | bdb3c585ad77981c01fa06d17090eac21f6cd3c1 (diff) |
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...
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Update.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 16 |
1 files changed, 7 insertions, 9 deletions
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 <espie@openbsd.org> # @@ -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) { |