summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-12-14 09:35:57 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-12-14 09:35:57 +0000
commit0413aabe3aa04641354d2cd9fc5dec011545b36b (patch)
tree0123a29edfdc90d19e9632753529145ff5dc9e3e /usr.sbin
parentd72188ed9853a90657b50d3f34a9f4558d8a44ec (diff)
fuss about install msgs: new method state->ntogo, use it to annotate more
messages with global progress information. Also, when not finding a suitable update, report it if set is not a simple update. Helps in figuring out cases like gstreamer...
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/AddDelete.pm13
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm5
-rw-r--r--usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm7
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm37
-rw-r--r--usr.sbin/pkg_add/pkg_add4
5 files changed, 42 insertions, 24 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
index c8831a2cc78..b27ffb8f521 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.5 2009/12/05 10:08:58 espie Exp $
+# $OpenBSD: AddDelete.pm,v 1.6 2009/12/14 09:35:56 espie Exp $
#
# Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org>
#
@@ -218,6 +218,17 @@ sub init
$self->{progressmeter} = bless {}, "OpenBSD::StubProgress";
}
+sub ntogo
+{
+ my $self = shift;
+
+ if (defined $self->{todo} && $self->{todo} > 0) {
+ return " ($self->{todo} to go)";
+ } else {
+ return "";
+ }
+}
+
sub vstat
{
return shift->{vstat};
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index dd98ca17b4c..0a200664bd4 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.90 2009/12/05 09:26:42 espie Exp $
+# $OpenBSD: Delete.pm,v 1.91 2009/12/14 09:35:56 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -115,7 +115,8 @@ sub delete_package
$state->vstat->synchronize;
delete_plist($plist, $state);
- $state->progress->next($state->{todo}-1);
+ $state->{todo}--;
+ $state->progress->next($state->ntogo);
}
sub unregister_dependencies
diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm
index 63918f53bc8..c20670e7b46 100644
--- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm
+++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: ProgressMeter.pm,v 1.23 2009/12/05 10:12:19 espie Exp $
+# $OpenBSD: ProgressMeter.pm,v 1.24 2009/12/14 09:35:56 espie Exp $
#
# Copyright (c) 2004-2007 Marc Espie <espie@openbsd.org>
#
@@ -155,9 +155,8 @@ sub next
return unless $isatty;
$self->clear;
- $todo //= 0;
- print "$header: ok", $todo > 0 ? " ($todo to go)" : "", "\n";
-
+ $todo //= '';
+ print "$header: ok$todo\n";
}
1;
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index 37eba7e2d29..0d9bdca6be6 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.115 2009/12/13 17:58:55 espie Exp $
+# $OpenBSD: Update.pm,v 1.116 2009/12/14 09:35:56 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -69,6 +69,14 @@ sub add_location
OpenBSD::Handle->from_location($location));
}
+sub progress_message
+{
+ my ($self, $state, $msg) = @_;
+ $msg .= $state->ntogo;
+ $state->progress->message($msg);
+ $state->say($msg) if $state->{beverbose};
+}
+
my $first = 1;
sub process_handle
{
@@ -167,12 +175,10 @@ sub process_handle
if ($oldfound) {
$h->{update_found} = $h;
$h->{keepit} = 1;
- my $msg = "No need to update $pkgname";
- if (defined $state->{todo} && $state->{todo} > 0) {
- $msg .= " ($state->{todo} to go)";
- }
- $state->progress->message($msg);
- $state->say($msg) if $state->{beverbose};
+
+ $self->progress_message($state,
+ "No need to update $pkgname");
+
return 0;
}
return undef;
@@ -182,18 +188,16 @@ sub process_handle
!$plist->uses_old_libs && !$state->{defines}->{installed}) {
$h->{update_found} = $h;
$h->{keepit} = 1;
- my $msg = "No need to update $pkgname";
- if (defined $state->{todo} && $state->{todo} > 0) {
- $msg .= " ($state->{todo} to go)";
- }
- $state->progress->message($msg);
- $state->say($msg) if $state->{beverbose};
+
+ $self->progress_message($state,
+ "No need to update $pkgname");
+
return 0;
}
}
- $state->say("Candidates for updating $pkgname -> ",
- join(' ', map {$_->name} @$l));
+ $state->say("Update candidates: $pkgname -> ",
+ join(' ', map {$_->name} @$l), $state->ntogo);
my $r = $state->choose_location($pkgname, $l);
if (defined $r) {
@@ -274,6 +278,9 @@ sub process_set
}
if ($problem) {
$state->tracker->cant($set) if !$set->{quirks};
+ if ($set->{updates} != 0) {
+ $state->say("Can't update ", $set->print);
+ }
return 0;
} elsif ($set->{updates} == 0) {
$state->tracker->uptodate($set);
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 036cb5b47fa..33aa8428076 100644
--- a/usr.sbin/pkg_add/pkg_add
+++ b/usr.sbin/pkg_add/pkg_add
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_add,v 1.425 2009/12/14 09:13:17 espie Exp $
+# $OpenBSD: pkg_add,v 1.426 2009/12/14 09:35:56 espie Exp $
#
# Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org>
#
@@ -546,7 +546,7 @@ sub really_add
}
});
$set->setup_header($state);
- $state->progress->next($state->{todo});
+ $state->progress->next($state->ntogo);
for my $handle ($set->newer) {
my $pkgname = $handle->pkgname;
my $plist = $handle->plist;