diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-06-09 08:13:20 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-06-09 08:13:20 +0000 |
commit | a1c3ce92d8746e5cb544a14329e1bd0d91ab0624 (patch) | |
tree | 0da52aee8efd99b2fca781b9a5c06138170c73f5 /usr.sbin | |
parent | ba752ba29cd01e2c98ab76e540d6daf77a044531 (diff) |
replace confusing (n to go) message with #done/#total annotations.
e.g.,
Checking packages|No change in apr-util-mt-1.2.10p4 (26/1530)
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/AddDelete.pm | 14 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Delete.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgAdd.pm | 10 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgDelete.pm | 14 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Tracker.pm | 14 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 6 |
7 files changed, 32 insertions, 36 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index 3c46f682b62..7c6b695ad4b 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddDelete.pm,v 1.24 2010/06/09 07:26:01 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.25 2010/06/09 08:13:19 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -194,15 +194,7 @@ sub ntogo_string { my ($self, $offset) = @_; - my $todo = $self->{todo} // 0; - $offset //= 0; - $todo += $offset; - - if ($todo > 0) { - return " ($todo to go)"; - } else { - return ""; - } + return $self->todo($offset // 0); } sub vstat @@ -328,7 +320,7 @@ sub print $object = "Parameters"; } - $state->say($what." ".$object.$state->ntogo_string); + $state->say($what." #1 (#2)", $object, $state->ntogo_string); if ($state->defines('carp')) { require Carp; Carp::cluck("currently here"); diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index b38b260820a..e569d174e14 100644 --- a/usr.sbin/pkg_add/OpenBSD/Delete.pm +++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Delete.pm,v 1.102 2010/06/09 07:26:01 espie Exp $ +# $OpenBSD: Delete.pm,v 1.103 2010/06/09 08:13:19 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -118,7 +118,7 @@ sub delete_package $state->vstat->synchronize; delete_plist($plist, $state); - $state->{todo}--; + $state->{done}++; $state->progress->next($state->ntogo); } diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm index 5e839e0c294..eee87fb9737 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgAdd.pm,v 1.2 2010/06/09 07:26:01 espie Exp $ +# $OpenBSD: PkgAdd.pm,v 1.3 2010/06/09 08:13:19 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -81,8 +81,8 @@ sub build_deptree sub todo { - my $state = shift; - return $state->tracker->sets_todo; + my ($state, $offset) = @_; + return $state->tracker->sets_todo($offset); } sub deptree_header @@ -386,11 +386,11 @@ sub try_merging OpenBSD::Handle->create_old($m, $state)); } if ($state->updater->process_set($s, $state)) { - $state->say("Merging #1#2", $s->print, $state->ntogo); + $state->say("Merging #1 (#2)", $s->print, $state->ntogo); $set->merge($state->tracker, $s); return 1; } else { - $state->errsay("NOT MERGING: can't find update for #1#2", + $state->errsay("NOT MERGING: can't find update for #1 (#2)", $s->print, $state->ntogo); return 0; } diff --git a/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm b/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm index 41c8697fbcd..2a2d88333ef 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm @@ -1,6 +1,6 @@ #!/usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgDelete.pm,v 1.2 2010/06/09 07:26:01 espie Exp $ +# $OpenBSD: PkgDelete.pm,v 1.3 2010/06/09 08:13:19 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -26,8 +26,8 @@ our @ISA = qw(OpenBSD::AddDelete::State); sub todo { - my $state = shift; - return $state->{todo}; + my ($state, $offset) = @_; + return sprintf("%u/%u", $state->{done} - $offset, $state->{total}); } package OpenBSD::PkgDelete; @@ -130,12 +130,16 @@ sub main } else { $state->status->what("Deleting"); } + $state->{total} = scalar @todo; DELETE: for my $pkgname (@todo) { - $state->{todo} = scalar @todo - scalar keys %done; - next if $done{$pkgname}; + if ($done{$pkgname}) { + $state->{total}--; + next; + } unless (is_installed($pkgname)) { $state->errsay("#1 was not installed", $pkgname); $done{$pkgname} = 1; + $state->{total}--; $removed++; next; } diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm index f50f0f82553..32f29f4d4c9 100644 --- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm +++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Term.pm,v 1.7 2010/06/06 07:27:03 espie Exp $ +# $OpenBSD: Term.pm,v 1.8 2010/06/09 08:13:19 espie Exp $ # # Copyright (c) 2004-2007 Marc Espie <espie@openbsd.org> # @@ -230,8 +230,8 @@ sub next my ($self, $todo) = @_; $self->clear; - $todo //= ''; - print "\r$self->{header}: ok$todo\n"; + $todo //= 'ok'; + print "\r$self->{header}: $todo\n"; } sub ntogo diff --git a/usr.sbin/pkg_add/OpenBSD/Tracker.pm b/usr.sbin/pkg_add/OpenBSD/Tracker.pm index 78ffe09b130..56ddf812f28 100644 --- a/usr.sbin/pkg_add/OpenBSD/Tracker.pm +++ b/usr.sbin/pkg_add/OpenBSD/Tracker.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Tracker.pm,v 1.20 2010/05/10 09:17:55 espie Exp $ +# $OpenBSD: Tracker.pm,v 1.21 2010/06/09 08:13:19 espie Exp $ # # Copyright (c) 2009 Marc Espie <espie@openbsd.org> # @@ -40,17 +40,17 @@ sub new sub sets_todo { - my $self = shift; - - return scalar keys %{$self->{todo}}; + my ($self, $offset) = @_; + return sprintf("%u/%u", (scalar keys %{$self->{done}})-$offset, + scalar keys %{$self->{total}}); } + sub handle_set { my ($self, $set) = @_; + $self->{total}->{$set} = 1; if ($set->{finished}) { - delete $self->{todo}->{$set}; - } else { - $self->{todo}->{$set} = 1; + $self->{done}->{$set} = 1; } } diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 0a54ac58659..3a29572226e 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.137 2010/06/09 07:26:01 espie Exp $ +# $OpenBSD: Update.pm,v 1.138 2010/06/09 08:13:19 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org> # @@ -71,7 +71,7 @@ sub add_location sub progress_message { my ($self, $state, $msg) = @_; - $msg .= $state->ntogo; + $msg .= " (".$state->ntogo.")"; $state->progress->message($msg); $state->say($msg) if $state->verbose >= 2; } @@ -193,7 +193,7 @@ sub process_handle } return undef; } - $state->say("Update candidates: #1 -> #2", $pkgname, + $state->say("Update candidates: #1 -> #2 (#3)", $pkgname, join(' ', map {$_->name} @$l), $state->ntogo) if $state->verbose; my $r = $state->choose_location($pkgname, $l); |