diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-05-23 10:33:46 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-05-23 10:33:46 +0000 |
commit | f0862252f6ab7c53b105fbc2a89015ce8b206ce2 (patch) | |
tree | b6cd72d10ba4f275b5e9de9595f6b8c6d2baf30e /usr.sbin/pkg_add | |
parent | ea7bbd52815b4ea7f6ff0aae725f75a65bd2faae (diff) |
fiddle with SharedLibs name, put common code into a common place in
pkg_add.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/SharedLibs.pm | 17 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 26 |
3 files changed, 25 insertions, 26 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 46b7c2ceac3..97ea2058ac4 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Dependencies.pm,v 1.38 2007/05/19 23:40:46 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.39 2007/05/23 10:33:45 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> # @@ -210,7 +210,7 @@ sub find_old_lib require OpenBSD::PackageRepository::Installed; for my $try (OpenBSD::PackageRepository::Installed->new->match(OpenBSD::Search::PkgSpec->new(".libs-".$pattern))) { - OpenBSD::SharedLibs::add_package_libs($try); + OpenBSD::SharedLibs::add_libs_from_installed_package($try); if (check_lib_spec($base, $lib, {$try => 1})) { $dependencies->{$try} = 1; return "$try($lib)"; @@ -241,7 +241,7 @@ sub lookup_library } if ($lib !~ m|/|) { - OpenBSD::SharedLibs::add_system_libs($state->{destdir}); + OpenBSD::SharedLibs::add_libs_from_system($state->{destdir}); for my $dir (OpenBSD::SharedLibs::system_dirs()) { if (check_lib_spec($dir, $lib, {system => 1})) { print "found libspec $lib in $dir/lib\n" if $state->{very_verbose}; @@ -267,7 +267,7 @@ sub lookup_library push(@{$self->{todo}}, $dep2) unless $done->{$dep2}; } next if $dependencies->{$dep}; - OpenBSD::SharedLibs::add_package_libs($dep); + OpenBSD::SharedLibs::add_libs_from_installed_package($dep); if (check_lib_spec($plist->localbase, $lib, {$dep => 1})) { print "found libspec $lib in dependent package $dep\n" if $state->{verbose}; $dependencies->{$dep} = 1; diff --git a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm index 7c3871843dc..af9faf8cd9e 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.15 2007/05/23 09:27:27 espie Exp $ +# $OpenBSD: SharedLibs.pm,v 1.16 2007/05/23 10:33:45 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -100,7 +100,7 @@ sub system_dirs return ("/usr", "/usr/X11R6"); } -sub add_system_libs +sub add_libs_from_system { my ($destdir) = @_; return if $done_plist->{'system'}; @@ -114,9 +114,9 @@ sub add_system_libs } } -sub add_package_libs +sub add_libs_from_installed_package { - my ($pkgname, $wantpath) = @_; + my $pkgname = shift; return if $done_plist->{$pkgname}; $done_plist->{$pkgname} = 1; my $plist = OpenBSD::PackingList->from_installation($pkgname, @@ -125,18 +125,13 @@ sub add_package_libs Warn "Can't read plist for $pkgname\n"; return; } - if (defined $wantpath) { - if (defined $plist->{extrainfo}) { - $pkgname = $plist->{extrainfo}->{subdir}; - } - } $plist->mark_available_lib($pkgname); } -sub add_plist_libs +sub add_libs_from_plist { - my ($plist) = @_; + my $plist = shift; my $pkgname = $plist->pkgname; return if $done_plist->{$pkgname}; $done_plist->{$pkgname} = 1; diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index e38842e5d9a..95678c71198 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.260 2007/05/22 10:47:40 espie Exp $ +# $OpenBSD: pkg_add,v 1.261 2007/05/23 10:33:45 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -76,6 +76,13 @@ sub mark_installed $state->{installed}->{$pkg} = 1; } +sub mark_as_already_installed +{ + my ($state, $pkg) = @_; + OpenBSD::SharedLibs::add_libs_from_installed_package($pkg); + $state->mark_installed($pkg); +} + sub is_installed { my ($state, $pkg) = @_; @@ -118,12 +125,11 @@ sub can_install($$$) } if (!$state->{replace}) { - if (@conflicts == 1 && is_installed($plist->pkgname) && + if (@conflicts == 1 && is_installed($pkgname) && !$plist->has_new_sig($state) && !$plist->uses_old_libs) { print "Not reinstalling $pkgname\n" if $state->{verbose}; - OpenBSD::SharedLibs::add_package_libs($plist->pkgname); - $state->mark_installed($pkgname); + $state->mark_as_already_installed($pkgname); return; } if ($state->{forced}->{conflicts}) { @@ -143,11 +149,10 @@ sub can_install($$$) require OpenBSD::Replace; - if (is_installed($plist->pkgname) && !$state->{forced}->{installed}) { + if (is_installed($pkgname) && !$state->{forced}->{installed}) { if (!$plist->has_new_sig($state) && !$plist->uses_old_libs) { print "Not reinstalling $pkgname\n" if $state->{verbose}; - OpenBSD::SharedLibs::add_package_libs($plist->pkgname); - $state->mark_installed($pkgname); + $state->mark_as_already_installed($pkgname); return; } } @@ -466,7 +471,7 @@ sub really_add($$) if ($interrupted || $errors) { failed_install($handle, $state->{not}, $interrupted); } - OpenBSD::SharedLibs::add_plist_libs($plist); + OpenBSD::SharedLibs::add_libs_from_plist($plist); $plist->to_cache; my $dest = installed_info($pkgname); OpenBSD::Add::register_installation($dir, $dest, $plist); @@ -525,8 +530,7 @@ sub install_package if (is_installed($plist->pkgname) && !$state->{forced}->{installed}) { if ($state->{replace}) { if (!$plist->has_new_sig($state) && !$plist->uses_old_libs) { - OpenBSD::SharedLibs::add_package_libs($plist->pkgname); - $state->mark_installed($handle->{pkgname}); + $state->mark_as_already_installed($plist->pkgname); $handle->close_now; return (); } @@ -566,7 +570,7 @@ sub install_package # grab libraries for my $dep ($handle->{solver}->dependencies) { - OpenBSD::SharedLibs::add_package_libs($dep); + OpenBSD::SharedLibs::add_libs_from_installed_package($dep); } my $okay = 1; for my $lib (@{$plist->{wantlib}}) { |