summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-11-11 12:21:21 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-11-11 12:21:21 +0000
commit63ddfd51ddaedc7390c3a7435bf25b80b16701d5 (patch)
tree6e18f7b52ecd0172b89090bce998b6c47252f2de
parent1c829fb0f939d9417b3b16b2637885a826516516 (diff)
also get most STDERR messages through the same way
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm8
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Dependencies.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm8
-rw-r--r--usr.sbin/pkg_add/OpenBSD/UpdateSet.pm20
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Vstat.pm18
-rw-r--r--usr.sbin/pkg_add/pkg_add8
-rw-r--r--usr.sbin/pkg_add/pkg_delete3
8 files changed, 49 insertions, 24 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index 3f2af49af53..c541c20fbc9 100644
--- a/usr.sbin/pkg_add/OpenBSD/Add.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Add.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.93 2009/11/11 12:04:19 espie Exp $
+# $OpenBSD: Add.pm,v 1.94 2009/11/11 12:21:20 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -40,7 +40,7 @@ sub manpages_index
try {
OpenBSD::Makewhatis::merge($destdir.$k, \@l);
} catchall {
- print STDERR "Error in makewhatis: $_\n";
+ $state->errsay("Error in makewhatis: $_");
};
}
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index bd66c3b2e18..bd3fe82e65a 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.85 2009/11/11 12:04:19 espie Exp $
+# $OpenBSD: Delete.pm,v 1.86 2009/11/11 12:21:20 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -54,7 +54,7 @@ sub manpages_unindex
} else {
eval { OpenBSD::Makewhatis::remove($destdir.$k, \@l); };
if ($@) {
- print STDERR "Error in makewhatis: $@\n";
+ $state->errsay("Error in makewhatis: $@");
}
}
}
@@ -67,7 +67,7 @@ sub validate_plist
if ($plist->has('system-package')) {
$state->{problems}++;
- print STDERR "Error: can't delete system packages\n";
+ $state->errsay("Error: can't delete system packages");
return;
}
$plist->prepare_for_deletion($state, $plist->pkgname);
@@ -132,7 +132,7 @@ sub unregister_dependencies
try {
OpenBSD::RequiredBy->new($name)->delete($pkgname);
} catchall {
- print STDERR "$_\n";
+ $state->errsay($_);
};
}
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
index 56d52dfbb8e..98bf70dd56a 100644
--- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Dependencies.pm,v 1.82 2009/11/11 12:04:19 espie Exp $
+# $OpenBSD: Dependencies.pm,v 1.83 2009/11/11 12:21:20 espie Exp $
#
# Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org>
#
@@ -177,7 +177,7 @@ sub find_in_new_source
my $plist = OpenBSD::PackingList->from_installation($dep,
\&OpenBSD::PackingList::DependOnly);
if (!defined $plist) {
- print STDERR "Can't read plist for $dep\n";
+ $state->errsay("Can't read plist for $dep");
}
$self->find_in_plist($plist, $dep);
return $self->find_in_already_done($solver, $state, $obj);
diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm
index e70984071c4..1cfdd285027 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.14 2009/11/11 12:04:19 espie Exp $
+# $OpenBSD: ProgressMeter.pm,v 1.15 2009/11/11 12:21:20 espie Exp $
#
# Copyright (c) 2004-2007 Marc Espie <espie@openbsd.org>
#
@@ -140,6 +140,12 @@ sub print
print @_;
}
+sub errprint
+{
+ shift->clear;
+ print STDERR @_;
+}
+
sub next
{
my $self = shift;
diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
index 8c3012b52d7..6502274f7d1 100644
--- a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
+++ b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: UpdateSet.pm,v 1.19 2009/11/11 12:04:19 espie Exp $
+# $OpenBSD: UpdateSet.pm,v 1.20 2009/11/11 12:21:20 espie Exp $
#
# Copyright (c) 2007 Marc Espie <espie@openbsd.org>
#
@@ -100,6 +100,18 @@ sub say
$self->progress->print(@_, "\n");
}
+sub errprint
+{
+ my $self = shift;
+ $self->progress->errprint(@_);
+}
+
+sub errsay
+{
+ my $self = shift;
+ $self->progress->errprint(@_, "\n");
+}
+
sub system
{
my $self = shift;
@@ -176,6 +188,12 @@ sub print
print @_;
}
+sub errprint
+{
+ shift;
+ print STDERR @_;
+}
+
# an UpdateSet is a list of packages to remove/install.
# it contains three things:
# -> a list of older packages to remove (installed locations)
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
index 8774492ff97..0411ce0f3cb 100644
--- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Vstat.pm,v 1.43 2007/06/30 11:38:38 espie Exp $
+# $OpenBSD: Vstat.pm,v 1.44 2009/11/11 12:21:20 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -205,10 +205,10 @@ sub report_ro
my ($s, $state, $fname) = @_;
if ($state->{very_verbose} or ++($s->{problems}) < 4) {
- print STDERR "Error: ", $s->{dev},
- " is read-only ($fname)\n";
+ $state->errsay("Error: ", $s->{dev},
+ " is read-only ($fname)");
} elsif ($s->{problems} == 4) {
- print STDERR "Error: ... more files on ", $s->{dev}, "\n";
+ $state->errsay("Error: ... more files on ", $s->{dev});
}
$state->{problems}++;
}
@@ -218,11 +218,11 @@ sub report_overflow
my ($s, $state, $fname) = @_;
if ($state->{very_verbose} or ++($s->{problems}) < 4) {
- print STDERR "Error: ", $s->{dev},
- " is not large enough ($fname)\n";
+ $state->errsay("Error: ", $s->{dev},
+ " is not large enough ($fname)");
} elsif ($s->{problems} == 4) {
- print STDERR "Error: ... more files do not fit on ",
- $s->{dev}, "\n";
+ $state->errsay("Error: ... more files do not fit on ",
+ $s->{dev});
}
$state->{problems}++;
$state->{overflow} = 1;
@@ -231,7 +231,7 @@ sub report_overflow
sub report_noexec
{
my ($s, $state, $fname) = @_;
- print STDERR "Error: ", $s->{dev}, " is noexec ($fname)\n";
+ $state->errsay("Error: ", $s->{dev}, " is noexec ($fname)");
$state->{problems}++;
}
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 335be41175b..ccfeeeb3c6d 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.377 2009/11/11 12:04:18 espie Exp $
+# $OpenBSD: pkg_add,v 1.378 2009/11/11 12:21:20 espie Exp $
#
# Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org>
#
@@ -310,9 +310,8 @@ sub really_add
my $plist = $handle->plist;
if ($plist->is_signed) {
if ($state->{defines}->{nosig}) {
- print STDERR
- "NOT CHECKING DIGITAL SIGNATURE FOR ",
- $plist->pkgname, "\n";
+ $state->errsay("NOT CHECKING DIGITAL SIGNATURE FOR ",
+ $plist->pkgname);
$state->{check_digest} = 0;
} else {
require OpenBSD::x509;
@@ -811,6 +810,7 @@ if ($state->{packages_with_sig}) {
if ($state->{beverbose}) {
OpenBSD::Vstat::tally();
}
+$state->progress->clear;
$state->log->dump;
if (defined $state->{updatedepends} && %{$state->{updatedepends}}) {
print "Forced updates, bogus dependencies for ",
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete
index 7f5c9c3c96c..fe6c51b089c 100644
--- a/usr.sbin/pkg_add/pkg_delete
+++ b/usr.sbin/pkg_add/pkg_delete
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_delete,v 1.118 2009/11/11 12:04:18 espie Exp $
+# $OpenBSD: pkg_delete,v 1.119 2009/11/11 12:21:20 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -214,6 +214,7 @@ OpenBSD::PackingElement::Fontdir::finish_fontdirs($state);
if ($state->{beverbose}) {
OpenBSD::Vstat::tally();
}
+$state->progress->clear;
$state->log->dump;
rethrow $dielater;
} catch {