diff options
author | 2014-02-03 15:57:13 +0000 | |
---|---|---|
committer | 2014-02-03 15:57:13 +0000 | |
commit | 005e7d5639d598c6a542044b650366ed25284156 (patch) | |
tree | 16887a6f5a10c53484fb1bcd72ae9b2ec039f5e1 | |
parent | use the same option as isp(4) to build without firmware. (diff) | |
download | wireguard-openbsd-005e7d5639d598c6a542044b650366ed25284156.tar.xz wireguard-openbsd-005e7d5639d598c6a542044b650366ed25284156.zip |
store compact form of manpages.
fix a long standing stupid bug: can't store both deleted and added manpages in
the same hash, otherwise the first deletion is going to scrape already added
stuff. Ouchie.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 15 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Delete.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 19 |
3 files changed, 23 insertions, 23 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index fb5e0185de3..9b3316d0e15 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.145 2014/01/31 10:29:54 espie Exp $ +# $OpenBSD: Add.pm,v 1.146 2014/02/03 15:57:13 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -28,12 +28,12 @@ use File::Copy; sub manpages_index { my ($state) = @_; - return unless defined $state->{mandirs}; + return unless defined $state->{addman}; my $destdir = $state->{destdir}; require OpenBSD::Makewhatis; - while (my ($k, $v) = each %{$state->{mandirs}}) { - my @l = map { $destdir.$_ } @$v; + while (my ($k, $v) = each %{$state->{addman}}) { + my @l = map { "$destdir$k/$_" } @$v; if ($state->{not}) { $state->say("Merging manpages in #1: #2", $destdir.$k, join(' ', @l)) @@ -47,6 +47,7 @@ sub manpages_index }; } } + delete $state->{addman}; } sub register_installation @@ -363,7 +364,7 @@ sub prepare_for_addition { my ($self, $state, $pkgname) = @_; return unless $self->{noshadow}; - $state->{noshadow}->{$state->{destdir}.$self->fullname} = 1; + $state->{noshadow}{$state->{destdir}.$self->fullname} = 1; } package OpenBSD::PackingElement::FileBase; @@ -459,7 +460,7 @@ sub extract my $d = dirname($file->{destdir}.$file->name); # we go back up until we find an existing directory. # hopefully this will be on the same file system. - while (!-d $d && -e _ || defined $state->{noshadow}->{$d}) { + while (!-d $d && -e _ || defined $state->{noshadow}{$d}) { $d = dirname($d); } if ($state->{not}) { @@ -644,7 +645,7 @@ sub install { my ($self, $state) = @_; $self->SUPER::install($state); - $self->register_manpage($state); + $self->register_manpage($state, 'addman'); } package OpenBSD::PackingElement::InfoFile; diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index 018cfee3b65..b4949b9361a 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.129 2014/01/30 13:23:51 espie Exp $ +# $OpenBSD: Delete.pm,v 1.130 2014/02/03 15:57:13 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -42,12 +42,12 @@ sub keep_old_files sub manpages_unindex { my ($state) = @_; - return unless defined $state->{mandirs}; + return unless defined $state->{rmman}; my $destdir = $state->{destdir}; require OpenBSD::Makewhatis; - while (my ($k, $v) = each %{$state->{mandirs}}) { - my @l = map { $destdir.$_ } @$v; + while (my ($k, $v) = each %{$state->{rmman}}) { + my @l = map { "$destdir$k/$_" } @$v; if ($state->{not}) { $state->say("Removing manpages in #1: #2", $destdir.$k, join(' ', @l)) @@ -60,7 +60,7 @@ sub manpages_unindex } } } - delete $state->{mandirs}; + delete $state->{rmman}; } sub validate_plist @@ -144,7 +144,7 @@ sub delete_plist my $pkgname = $plist->pkgname; $state->{pkgname} = $pkgname; if (!$state->{size_only}) { - $plist->register_manpage($state); + $plist->register_manpage($state, 'rmman'); manpages_unindex($state); $state->progress->visit_with_size($plist, 'delete', $state); if ($plist->has(UNDISPLAY)) { diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 56aa10fa2fa..5cf4c53d957 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.228 2014/01/31 15:48:44 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.229 2014/02/03 15:57:13 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -559,12 +559,11 @@ __PACKAGE__->register_with_factory; sub register_manpage { - my ($self, $state) = @_; + my ($self, $state, $key) = @_; return if defined $self->{tempname}; my $fname = $self->fullname; - if ($fname =~ m,^(.*/man)/(?:man|cat).*?/,) { - my $d = $1; - push(@{$state->{mandirs}->{$d}}, $fname); + if ($fname =~ m,^(.*/man)/((?:man|cat).*),) { + push(@{$state->{$key}{$1}}, $2); } } @@ -736,13 +735,13 @@ sub add my ($class, $plist, $args) = @_; if ($args eq 'no checksum') { - $plist->{state}->{lastfile}->{nochecksum} = 1; + $plist->{state}{lastfile}{nochecksum} = 1; } elsif ($args eq 'no shadow') { - $plist->{state}->{lastdir}->{noshadow} = 1; + $plist->{state}{lastdir}{noshadow} = 1; } else { - my $object = $plist->{state}->{lastfileobject}; - $object->{tags}->{$args} = 1; - push(@{$plist->{tags}->{$args}}, $object); + my $object = $plist->{state}{lastfileobject}; + $object->{tags}{$args} = 1; + push(@{$plist->{tags}{$args}}, $object); } return undef; } |