diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-06-04 16:33:24 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-06-04 16:33:24 +0000 |
commit | 76d293a011c9a855659a2bfdf5c969a95e9f7db8 (patch) | |
tree | 989e90ad8d9d826fd8f74f4b6c64f5d558841c6c /usr.sbin/pkg_add | |
parent | bc6c53654837246be3d82b85769a64ccdf1b7132 (diff) |
avoid parsing libraries by hand.
Store shared libraries in a `better' format, which will also us
to report issues more nicely.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Replace.pm | 13 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/SharedLibs.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_create | 5 |
3 files changed, 17 insertions, 13 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm index da572cfefff..69472510c13 100644 --- a/usr.sbin/pkg_add/OpenBSD/Replace.pm +++ b/usr.sbin/pkg_add/OpenBSD/Replace.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Replace.pm,v 1.31 2007/06/04 14:40:39 espie Exp $ +# $OpenBSD: Replace.pm,v 1.32 2007/06/04 16:33:23 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -199,8 +199,9 @@ sub mark_lib { my ($self, $libs, $libpatterns) = @_; my $libname = $self->fullname; - if ($libname =~ m/^(.*\.so\.)(\d+)\.(\d+)$/o) { - $libpatterns->{$1} = [$2, $3, $libname]; + my ($stem, $major, $minor, $dir) = $self->parse($libname); + if (defined $stem) { + $libpatterns->{$stem}->{$dir} = [$major, $minor, $libname]; } $libs->{$libname} = 1; } @@ -209,9 +210,9 @@ sub unmark_lib { my ($self, $libs, $libpatterns) = @_; my $libname = $self->fullname; - if ($libname =~ m/^(.*\.so\.)(\d+)\.(\d+)$/o) { - my ($pat, $major, $minor) = ($1, $2, $3); - my $p = $libpatterns->{$pat}; + my ($stem, $major, $minor, $dir) = $self->parse($libname); + if (defined $stem) { + my $p = $libpatterns->{$stem}->{$dir}; if (defined $p && $p->[0] == $major && $p->[1] <= $minor) { my $n = $p->[2]; delete $libs->{$n}; diff --git a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm index 3fd4663d0c2..c6f7cdc91e1 100644 --- a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm +++ b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SharedLibs.pm,v 1.18 2007/06/04 14:57:33 espie Exp $ +# $OpenBSD: SharedLibs.pm,v 1.19 2007/06/04 16:33:23 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -87,9 +87,11 @@ our $registered_libs = {}; sub register_lib { my ($name, $pkgname) = @_; - if ($name =~ m/^(.*\/lib.*?\.so\.\d+)\.(\d+)$/o) { - my ($stem, $minor) = ($1, $2); - push(@{$registered_libs->{$stem}}, [$minor, $pkgname]); + my ($stem, $major, $minor, $dir) = + OpenBSD::PackingElement::Lib->parse($name); + if (defined $stem) { + push(@{$registered_libs->{$stem}->{$dir}->{$major}}, + [$minor, $pkgname]); } } @@ -145,7 +147,7 @@ sub _lookup_libspec if ($spec =~ m/^(.*)\.(\d+)\.(\d+)$/o) { my ($libname, $major, $minor) = ($1, $2, $3); - my $exists = $registered_libs->{"$dir/lib$libname.so.$major"}; + my $exists = $registered_libs->{$libname}->{$dir}->{$major}; if (defined $exists) { for my $e (@$exists) { if ($e->[0] >= $minor) { diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create index 08f9c9a087a..05cb57b3f1d 100644 --- a/usr.sbin/pkg_add/pkg_create +++ b/usr.sbin/pkg_add/pkg_create @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_create,v 1.111 2007/06/04 14:40:39 espie Exp $ +# $OpenBSD: pkg_create,v 1.112 2007/06/04 16:33:22 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -401,7 +401,8 @@ sub read_fragments if (m/^(\@comment\s+\$(?:Open)BSD\$)$/o) { $_ = '@comment $'.'OpenBSD: '.basename($file->name).',v$'; } - if (m,^\@lib\s+.*/lib[^/]+\.so\.\d+\.\d+$,o) { + if (m/^\@lib\s+(.*)$/o && + OpenBSD::PackingElement::Lib->parse($1)) { Warn "Shared library without SHARED_LIBS: $_"; $main::errors++; } |