diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2011-07-14 11:31:21 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2011-07-14 11:31:21 +0000 |
commit | 46d64d3e1ece7bb3c62c2a75d8303e8be829042d (patch) | |
tree | b41194173a7fa536247f2d0fcd6b267acd8b3541 /usr.sbin/pkg_add/OpenBSD/AddDelete.pm | |
parent | cba23c078ac1877316cd6018ad8a38049928944c (diff) |
move deptree_header into AddDelete, use it in pkg_delete.
Now, pkg_delete will display things a lot like pkg_add, spelling out
what reverse dependencies trigger the deletion of a given package at that
point in the list.
by popular demand.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/AddDelete.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/AddDelete.pm | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index c01343989c0..f8a58762ab5 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.49 2011/07/13 13:01:13 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.50 2011/07/14 11:31:20 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -196,6 +196,34 @@ sub ntogo_string return $self->todo($offset // 0); } +# one-level dependencies tree, for nicer printouts +sub build_deptree +{ + my ($state, $set, @deps) = @_; + + if (defined $state->{deptree}->{$set}) { + $set = $state->{deptree}->{$set}; + } + for my $dep (@deps) { + $state->{deptree}->{$dep} = $set unless + defined $state->{deptree}->{$dep}; + } +} + +sub deptree_header +{ + my ($state, $pkg) = @_; + if (defined $state->{deptree}->{$pkg}) { + my $s = $state->{deptree}->{$pkg}->real_set; + if ($s eq $pkg) { + delete $state->{deptree}->{$pkg}; + } else { + return $s->short_print.':'; + } + } + return ''; +} + sub vstat { my $self = shift; |