From 101180a9f0c59ed9236c6762fdd7d299b5a0f8c5 Mon Sep 17 00:00:00 2001 From: espie Date: Tue, 20 May 2014 05:46:13 +0000 Subject: [PATCH] makewhatis being now external, it no longer requires picky/test/check_dir. It also can't handle too many manpages at once (shell limit) so hand-feed it (problem spotted by landry@). Some tests by schwarze@. --- usr.sbin/pkg_add/OpenBSD/Add.pm | 5 ++-- usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm | 31 +++++++++++++-------- usr.sbin/pkg_add/OpenBSD/AddDelete.pm | 20 +------------ usr.sbin/pkg_add/OpenBSD/Delete.pm | 5 ++-- usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 5 ++-- 5 files changed, 27 insertions(+), 39 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index 68b391fa55a..1df52e1a9bf 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.151 2014/04/18 10:00:48 schwarze Exp $ +# $OpenBSD: Add.pm,v 1.152 2014/05/20 05:46:13 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -40,8 +40,7 @@ sub manpages_index $state->say("Merging manpages in #1: #2", $destdir.$k, join(' ', @l)) if $state->verbose; } else { - $state->vsystem(OpenBSD::Paths->makewhatis, - '-d', $destdir.$k, '--', @l); + $state->run_makewhatis(['-d', $destdir.$k], \@l); } } $state->{v} = $v; diff --git a/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm index 90539c6f564..258e3caf36c 100644 --- a/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm +++ b/usr.sbin/pkg_add/OpenBSD/AddCreateDelete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: AddCreateDelete.pm,v 1.22 2014/01/17 10:55:01 espie Exp $ +# $OpenBSD: AddCreateDelete.pm,v 1.23 2014/05/20 05:46:13 espie Exp $ # # Copyright (c) 2007-2014 Marc Espie # @@ -71,25 +71,34 @@ sub handle_options $state->{not} = $state->opt('n'); } -# those are required for makewhatis integration -sub picky +sub vsystem { - return shift->{picky}; + my $self = shift; + my $verbose = $self; + if ($self->verbose < 2) { + $self->system(@_); + } else { + $self->verbose_system(@_); + } } -sub testmode +sub system { - return shift->{testmode}; + my $self = shift; + $self->progress->clear; + $self->SUPER::system(@_); } -sub check_dir +sub run_makewhatis { - my ($self, $dir) = @_; - unless (-d $dir) { - $self->fatal("#1: #2 is not a directory", $0, $dir); + my ($state, $opts, $l) = @_; + while (@$l > 1000) { + my @b = splice(@$l, 0, 1000); + $state->vsystem(OpenBSD::Paths->makewhatis, @$opts, '--', @b); } -} + $state->vsystem(OpenBSD::Paths->makewhatis, @$opts, '--', @$l); +} sub ntogo { my ($self, $offset) = @_; diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm index 1ec617707d9..2839235ffca 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.61 2014/03/18 18:53:29 espie Exp $ +# $OpenBSD: AddDelete.pm,v 1.62 2014/05/20 05:46:13 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie # @@ -308,24 +308,6 @@ sub run_quirks } } -sub vsystem -{ - my $self = shift; - my $verbose = $self; - if ($self->verbose < 2) { - $self->system(@_); - } else { - $self->verbose_system(@_); - } -} - -sub system -{ - my $self = shift; - $self->progress->clear; - $self->SUPER::system(@_); -} - sub check_root { my $state = shift; diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index 2e97089094d..dd4973c8401 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.135 2014/04/18 10:00:48 schwarze Exp $ +# $OpenBSD: Delete.pm,v 1.136 2014/05/20 05:46:13 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -54,8 +54,7 @@ sub manpages_unindex $state->say("Removing manpages in #1: #2", $destdir.$k, join(' ', @l)) if $state->verbose; } else { - $state->vsystem(OpenBSD::Paths->makewhatis, - '-u', $destdir.$k, '--', @l); + $state->run_makewhatis(['-u', $destdir.$k], \@l); } } $state->{v} = $v; diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 8323baea297..2e9b61d6c01 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.105 2014/04/18 10:00:48 schwarze Exp $ +# $OpenBSD: PkgCreate.pm,v 1.106 2014/05/20 05:46:13 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -1283,8 +1283,7 @@ sub finish_manpages my ($self, $state, $plist) = @_; $plist->grab_manpages($state); if (defined $state->{manpages}) { - $state->system(OpenBSD::Paths->makewhatis, '-t', '--', - @{$state->{manpages}}); + $state->run_makewhatis(['-t'], $state->{manpages}); } if (defined $state->{mandir}) { -- 2.20.1