summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-08-03 14:10:13 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-08-03 14:10:13 +0000
commitdbfec0c40ed72121d04bdef56dc7442abf72fc2c (patch)
tree78180091f85d11e32044ae3240fef5b3fe27564e
parentfc933d106b1704f4fe8cdc00654300284515efbd (diff)
sort journal messsages in a better way, put - before +, so that one can
see deinstall info before new install info (prompted by a comment from tedu@)
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Log.pm12
-rw-r--r--usr.sbin/pkg_add/OpenBSD/SharedItems.pm10
2 files changed, 14 insertions, 8 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Log.pm b/usr.sbin/pkg_add/OpenBSD/Log.pm
index bfc8412e482..30fdee858dd 100644
--- a/usr.sbin/pkg_add/OpenBSD/Log.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Log.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Log.pm,v 1.3 2010/06/30 10:51:04 espie Exp $
+# $OpenBSD: Log.pm,v 1.4 2010/08/03 14:10:12 espie Exp $
#
# Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org>
#
@@ -65,10 +65,16 @@ sub errsay
push(@{$self->{erroutput}}, $self->f(@_)."\n");
}
+sub specialsort
+{
+ return ((sort grep { /^\-/ } @_), (sort grep { /^\+/} @_),
+ (sort grep { !/^[\-+]/ } @_));
+}
+
sub dump
{
my $self = shift;
- for my $ctxt (sort keys %{$self->{errmessages}}) {
+ for my $ctxt (specialsort keys %{$self->{errmessages}}) {
my $msgs = $self->{errmessages}->{$ctxt};
if (@$msgs > 0) {
$self->{p}->errsay("--- #1 -------------------", $ctxt);
@@ -76,7 +82,7 @@ sub dump
}
}
$self->{errmessages} = {};
- for my $ctxt (sort keys %{$self->{messages}}) {
+ for my $ctxt (specialsort keys %{$self->{messages}}) {
my $msgs = $self->{messages}->{$ctxt};
if (@$msgs > 0) {
$self->{p}->say("--- #1 -------------------", $ctxt);
diff --git a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm
index fb0cf7e81d5..a3fe9a2b5a8 100644
--- a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm
+++ b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: SharedItems.pm,v 1.27 2010/08/01 10:03:24 espie Exp $
+# $OpenBSD: SharedItems.pm,v 1.28 2010/08/03 14:10:12 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -69,7 +69,7 @@ sub wipe_directory
my $realname = $state->{destdir}.$d;
for my $i (@{$h->{$d}}) {
- $state->log->set_context($i->{pkgname});
+ $state->log->set_context('-'.$i->{pkgname});
$i->cleanup($state);
}
if (!rmdir $realname) {
@@ -104,7 +104,7 @@ sub cleanup
my $realname = $state->{destdir}.$d;
if ($remaining->{dirs}->{$realname}) {
for my $i (@{$h->{$d}}) {
- $state->log->set_context($i->{pkgname});
+ $state->log->set_context('-'.$i->{pkgname});
$i->reload($state);
}
} else {
@@ -119,7 +119,7 @@ sub cleanup
$state->system(OpenBSD::Paths->userdel, '--',
$user);
} else {
- $state->log->set_context($pkgname);
+ $state->log->set_context('-'.$pkgname);
$state->log("You should also run /usr/sbin/userdel #1", $user);
}
$done++;
@@ -131,7 +131,7 @@ sub cleanup
$state->system(OpenBSD::Paths->groupdel, '--',
$group);
} else {
- $state->log->set_context($pkgname);
+ $state->log->set_context('-'.$pkgname);
$state->log("You should also run /usr/sbin/groupdel #1", $group);
}
$done++;