diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-08-02 12:12:37 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-08-02 12:12:37 +0000 |
commit | fe1130822ba2906b4cb487c90b4d6055c81250a5 (patch) | |
tree | 858f436b1af7857c22ea961a7980a2c1c917871c /usr.sbin | |
parent | efa379bc32ae3c2e62eda2303fc862a8739b5025 (diff) |
@man type file for manpages.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 22 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingList.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 14 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_delete | 13 |
4 files changed, 48 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index cf93270fed5..7b09db64202 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,4 +1,4 @@ -# $OpenBSD: PackingElement.pm,v 1.14 2004/08/02 12:08:25 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.15 2004/08/02 12:12:36 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -279,6 +279,26 @@ sub keyword() { "info" } sub needs_keyword { 1 } +package OpenBSD::PackingElement::Manpage; +our @ISA=qw(OpenBSD::PackingElement::File); +__PACKAGE__->setKeyword('man'); +sub keyword() { "man" } +sub needs_keyword { 1 } + +sub destate +{ + my ($self, $state) = @_; + $self->SUPER::destate($state); + my $fname = $self->fullname(); + if ($fname =~ m,^(.*/man)/(?:man|cat).*?/,) { + my $d = $1; + $state->{mandirs} = {} unless defined $state->{mandirs}; + $state->{mandirs}->{$d} = [] + unless defined $state->{mandirs}->{$d}; + push(@{$state->{mandirs}->{$d}}, $fname); + } +} + package OpenBSD::PackingElement::Ignore; our @ISA=qw(OpenBSD::PackingElement); __PACKAGE__->setKeyword('ignore'); diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index 9e05c37e8b6..b12b1ac136c 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm @@ -1,4 +1,4 @@ -# $OpenBSD: PackingList.pm,v 1.13 2004/07/22 23:53:53 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.14 2004/08/02 12:12:36 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -83,7 +83,7 @@ sub FilesOnly my ($fh, $cont) = @_; local $_; while (<$fh>) { - next unless m/^\@cwd\b/ || m/^\@name\b/ || m/^\@info\b/ || !m/^\@/; + next unless m/^\@cwd\b/ || m/^\@name\b/ || m/^\@info\b/ || m/^\@man\b/ || !m/^\@/; &$cont($_); } } diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 8aea3aa9ebd..27a1b8dec70 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.36 2004/08/02 12:08:25 espie Exp $ +# $OpenBSD: pkg_add,v 1.37 2004/08/02 12:12:36 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -465,6 +465,17 @@ sub collision_report } } +sub manpages_index +{ + my ($plist, $destdir) = @_; + return unless defined $plist->{state}->{mandirs}; + while (my ($k, $v) = each %{$plist->{state}->{mandirs}}) { + system("/usr/libexec/makewhatis", "-d", $destdir.$k, + map { $destdir.$_ } @$v); + } +} + + sub really_add($$) { my ($handle, $destdir) = @_; @@ -552,6 +563,7 @@ sub really_add($$) last if $interrupted; } + manpages_index($plist, $destdir); $handle->close(); unless ($opt_I) { diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete index e1d42b11723..80500b05761 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.27 2004/07/20 18:58:41 espie Exp $ +# $OpenBSD: pkg_delete,v 1.28 2004/08/02 12:12:36 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -277,6 +277,16 @@ sub remove_packing_info rmdir($dir) or die "Can't finish removing directory $dir: $!"; } +sub manpages_unindex +{ + my ($plist, $destdir) = @_; + return unless defined $plist->{state}->{mandirs}; + while (my ($k, $v) = each %{$plist->{state}->{mandirs}}) { + system("/usr/libexec/makewhatis", "-u", $destdir.$k, + map { $destdir.$_ } @$v); + } +} + sub delete_package { my ($pkgname, $state) = @_; @@ -312,6 +322,7 @@ sub delete_package if ($plist->has(DEINSTALL)) { $plist->get(DEINSTALL)->delete($state); } + manpages_unindex($plist, $state->{destdir}); for my $item (@{$plist->{items}}) { $item->delete($state); } |