diff options
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackingElement.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index ec4fc1fbc70..f43c1350205 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.18 2004/08/06 07:51:17 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.19 2004/08/06 10:23:45 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -19,6 +19,9 @@ use strict; use warnings; use OpenBSD::PackageInfo; +# perl ipc +require 5.008_000; + # This is the basic class, which is mostly abstract, except for # setKeyword and Factory. # It does provide base methods for stuff under it, though. @@ -343,6 +346,54 @@ sub destate } } +package OpenBSD::PackingElement::Lib; +our @ISA=qw(OpenBSD::PackingElement::FileBase); +use File::Basename; + +__PACKAGE__->setKeyword('lib'); +sub keyword() { "lib" } + +our $todo; +my $path; +our $ldconfig = '/sbin/ldconfig'; + +sub add_ldconfig_dirs() +{ + my $sub = shift; + return unless defined $todo; + for my $d (keys %$todo) { + &$sub($d); + } + $todo={}; +} + +sub mark_ldconfig_directory +{ + my ($self, $destdir) = @_; + if (!defined $path) { + $path={}; + open my $fh, "-|", $ldconfig, "-r"; + if (defined $fh) { + local $_; + while (<$fh>) { + if (m/^\s*search directories:\s*(.*?)\s*$/) { + for my $d (split(':', $1)) { + $path->{$d} = 1; + } + } + } + close($fh); + } else { + print STDERR "Can't find ldconfig\n"; + } + } + my $d = dirname($self->fullname()); + if ($path->{$d}) { + $todo = {} unless defined $todo; + $todo->{$d} = 1; + } +} + package OpenBSD::PackingElement::Ignore; our @ISA=qw(OpenBSD::PackingElement); __PACKAGE__->setKeyword('ignore'); |