diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-11-09 09:58:57 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-11-09 09:58:57 +0000 |
commit | 0a4e12e93a655edd922fa17760542d672380b368 (patch) | |
tree | 9de3838df788a64bc14383d71b534c1a9677c5db | |
parent | a52094c0f7ac0550c0d9cec87d5f613fd7480ab6 (diff) |
don't keep libraries whose version numbers are not needed.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index d239f12a819..6a07b725e42 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.14 2004/11/09 09:32:17 espie Exp $ +# $OpenBSD: Update.pm,v 1.15 2004/11/09 09:58:56 espie Exp $ # # Copyright (c) 2004 Marc Espie <espie@openbsd.org> # @@ -113,15 +113,26 @@ sub validate_depend sub mark_lib { - my ($self, $libs) = @_; + my ($self, $libs, $libpatterns) = @_; my $libname = $self->fullname(); + if (my $libname =~ m/^(.*\.so\.)(\d+)\.(\d+)$/) { + $libpatterns->{"$1"} = [$2, $3, $libname]; + } $libs->{"$libname"} = 1; } sub unmark_lib { - my ($self, $libs) = @_; + my ($self, $libs, $libpatterns) = @_; my $libname = $self->fullname(); + if (my $libname =~ m/^(.*\.so\.)(\d+)\.(\d+)$/) { + my ($pat, $major, $minor) = ($1, $2, $3); + my $p = $libpatterns->{"$pat"}; + if (defined $p && $p->[0] == $major && $p->[1] <= $minor) { + my $n = $p->[2]; + delete $libs->{"$n"}; + } + } delete $libs->{"$libname"}; } @@ -241,9 +252,10 @@ sub save_old_libraries my $old_plist = $new_plist->{replacing}; my $libs = {}; + my $p = {}; - $old_plist->visit('mark_lib', $libs); - $new_plist->visit('unmark_lib', $libs); + $old_plist->visit('mark_lib', $libs, $p); + $new_plist->visit('unmark_lib', $libs, $p); if (%$libs) { my $stub_list = split_libs($old_plist, $libs); |