summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-12-13 17:54:16 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-12-13 17:54:16 +0000
commit6b39c1a3a6609a2f4173820ddb1bb441f21ce78c (patch)
tree0cf68eeb31e4d229f4e1d805e896e093d177ba01 /usr.sbin
parent464ac7f07df757159681f71467c9df4d93bd3689 (diff)
simplify set printing
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Dependencies.pm8
-rw-r--r--usr.sbin/pkg_add/OpenBSD/UpdateSet.pm27
-rw-r--r--usr.sbin/pkg_add/pkg_add16
3 files changed, 19 insertions, 32 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
index 2286ed2e41d..e9bf37e9c6e 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.97 2009/12/11 21:04:01 espie Exp $
+# $OpenBSD: Dependencies.pm,v 1.98 2009/12/13 17:54:15 espie Exp $
#
# Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org>
#
@@ -243,7 +243,7 @@ sub find_dep_in_repositories
@pkgs = ((grep {$_ eq $dep->{def}} @pkgs),
(sort (grep {$_ ne $dep->{def}} @pkgs)));
my $good = OpenBSD::Interactive::ask_list(
- 'Ambiguous: choose dependency for '.$self->{set}->short_print.': ',
+ 'Ambiguous: choose dependency for '.$self->{set}->print.': ',
$state->{interactive}, @pkgs);
return $c{$good};
} else {
@@ -373,10 +373,10 @@ sub dump
{
my $self = shift;
if ($self->dependencies) {
- print "Dependencies for ", $self->{set}->short_print,
+ print "Dependencies for ", $self->{set}->print,
" resolve to: ", join(', ', $self->dependencies);
print " (todo: ",
- join(',', (map {$_->short_print} @{$self->{deplist}})),
+ join(',', (map {$_->print} @{$self->{deplist}})),
")"
if @{$self->{deplist}} > 0;
print "!!" if $self->{not_ready};
diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
index a3e3facefab..ae35ba1690e 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.36 2009/12/12 17:08:07 espie Exp $
+# $OpenBSD: UpdateSet.pm,v 1.37 2009/12/13 17:54:15 espie Exp $
#
# Copyright (c) 2007 Marc Espie <espie@openbsd.org>
#
@@ -167,32 +167,19 @@ sub older_to_do
sub print
{
my $self = shift;
- my @l = ();
- if ($self->newer > 0) {
- push(@l, "installing", $self->newer_names);
- }
- if ($self->older > 0) {
- push(@l, "deinstalling", $self->older_names);
- }
- return join(' ', @l);
-}
-
-sub short_print
-{
- my $self = shift;
- my @l = ();
+ my $result = "";
if ($self->older > 0) {
- push(@l, join('+',$self->older_names));
+ $result .= join('+',$self->older_names)."->";
}
if ($self->newer > 0) {
- push(@l, join('+', $self->newer_names));
+ $result .= join('+', $self->newer_names);
} elsif ($self->hints > 0) {
- push(@l, join('+', $self->hint_names));
+ $result .= join('+', $self->hint_names);
}
- return join('->', @l);
+ return $result;
}
-sub shorter_print
+sub short_print
{
my $self = shift;
return join('+', $self->newer_names);
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index ea72d0ae5f4..ef8422ad32c 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.422 2009/12/12 16:42:04 espie Exp $
+# $OpenBSD: pkg_add,v 1.423 2009/12/13 17:54:15 espie Exp $
#
# Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org>
#
@@ -81,7 +81,7 @@ sub deptree_header
{
my ($state, $pkg) = @_;
if (defined $state->{deptree}->{$pkg}) {
- return $state->{deptree}->{$pkg}->shorter_print.':';
+ return $state->{deptree}->{$pkg}->short_print.':';
} else {
return '';
}
@@ -132,7 +132,7 @@ sub setup_header
if (defined $handle) {
$header .= $handle->pkgname;
} else {
- $header .= $set->short_print;
+ $header .= $set->print;
}
if (defined $info) {
$header.=" ($info)";
@@ -232,7 +232,7 @@ sub can_install
return 1 if @conflicts == 0;
if (!$state->{allow_replacing}) {
- $state->errsay("Can't install ", $set->short_print,
+ $state->errsay("Can't install ", $set->print,
" because of conflicts (",join(',', @conflicts), ")");
return 0;
}
@@ -246,7 +246,7 @@ sub can_install
for my $toreplace (@conflicts) {
if ($state->tracker->is_installed($toreplace)) {
$state->errsay("Cannot replace $toreplace in ",
- $set->short_print, ": just got installed");
+ $set->print, ": just got installed");
return 0;
}
@@ -279,7 +279,7 @@ sub can_install
if (!OpenBSD::Replace::can_old_package_be_replaced($old->plist,
$set, $state)) {
$state->errsay("Can't update $name into ",
- $set->short_print);
+ $set->print);
return 0;
}
@@ -300,7 +300,7 @@ sub recheck_conflicts
for my $h2 ($set->newer) {
next if $h2 == $h;
if ($h->plist->conflict_list->conflicts_with($h2->pkgname)) {
- $state->errsay($set->short_print, ": internal conflict between ", $h->pkgname, " and ", $h2->pkgname);
+ $state->errsay($set->print, ": internal conflict between ", $h->pkgname, " and ", $h2->pkgname);
return 0;
}
}
@@ -630,7 +630,7 @@ sub install_set
my @baddeps = $set->{solver}->check_depends;
if (@baddeps) {
- $state->errsay("Can't install ", $set->short_print,
+ $state->errsay("Can't install ", $set->print,
": can't resolve ", join(',', @baddeps));
for my $handle ($set->newer) {
$handle->location->close_now;