diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2012-05-05 10:21:48 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2012-05-05 10:21:48 +0000 |
commit | 3a405e38162fd1796f5820a8eecedfe2e7b38e59 (patch) | |
tree | d9115d7526b5fa723e7f6a53a0b3cd52c1edf423 /usr.sbin | |
parent | 2d3dc233f4de3568ab046445fb3afb7db8540927 (diff) |
if the lib directory is not localbase->lib, we add directory entries to
the .libs* stuff.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/OldLibs.pm | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/OldLibs.pm b/usr.sbin/pkg_add/OpenBSD/OldLibs.pm index c1e9a9b91c3..72a8ed9c4a3 100644 --- a/usr.sbin/pkg_add/OpenBSD/OldLibs.pm +++ b/usr.sbin/pkg_add/OpenBSD/OldLibs.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: OldLibs.pm,v 1.9 2010/12/24 10:31:59 espie Exp $ +# $OpenBSD: OldLibs.pm,v 1.10 2012/05/05 10:21:47 espie Exp $ # # Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org> # @@ -33,6 +33,12 @@ sub separate_element $c2->{$self} = 1; } +sub special_deep_copy +{ + my ($self, $copy, $h) = @_; + $self->clone->add_object($copy) if defined $h->{$self}; +} + package OpenBSD::PackingElement::Meta; sub separate_element @@ -68,7 +74,14 @@ sub separate_element &OpenBSD::PackingElement::separate_element; } +package OpenBSD::PackingElement::FCONTENTS; +sub special_deep_copy +{ +} + package OpenBSD::PackingElement::Lib; +use File::Basename; + sub mark_lib { my ($self, $libs, $libpatterns) = @_; @@ -105,6 +118,32 @@ sub unmark_lib delete $libs->{$libname}; } +sub enforce_dir +{ + my ($self, $path, $copy, $dirs) = @_; + my $d = dirname($path); + my $localbase = $copy->localbase; + + if ($d eq "$localbase/lib" || $d eq $localbase) { + return; + } + if ($dirs->{$d}) { + return; + } + $dirs->{$d} = 1; + $self->enforce_dir($d, $copy, $dirs); + my $cwd = $self->cwd; + $d =~ s/^\Q$cwd\E\///; + OpenBSD::PackingElement::Dir->add($copy, $d); +} + +sub special_deep_copy +{ + my ($self, $copy, $h, $dirs) = @_; + $self->enforce_dir($self->fullname, $copy, $dirs); + $self->SUPER::special_deep_copy($copy, $h, $dirs); +} + package OpenBSD::OldLibs; use OpenBSD::RequiredBy; use OpenBSD::PackageInfo; @@ -115,7 +154,9 @@ sub split_some_libs my $c1 = {}; my $c2 = {}; $plist->separate_element($libs, $c1, $c2); - my $p1 = $plist->make_deep_copy($c1); + my $p1 = OpenBSD::PackingList->new; + $p1->set_infodir($plist->infodir); + $plist->special_deep_copy($p1, $c1, {}); my $p2 = $plist->make_shallow_copy($c2); return ($p1, $p2); } |