summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-12-20 08:58:04 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-12-20 08:58:04 +0000
commitf57324788c5dc9727fe30ee3f9c1ea1cfd9ea201 (patch)
tree4899051ca1919705f5dd3409a429ab5605542bf0 /usr.sbin
parent4e4da1b70ea9303fb35a047c2b74152d861fecb9 (diff)
pass state to SharedLibs for direct printing
(also cosmetic ws)
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Dependencies.pm24
-rw-r--r--usr.sbin/pkg_add/OpenBSD/SharedLibs.pm20
2 files changed, 22 insertions, 22 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
index 61801fcc014..840aa2d6d21 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.138 2010/12/13 12:13:54 espie Exp $
+# $OpenBSD: Dependencies.pm,v 1.139 2010/12/20 08:58:03 espie Exp $
#
# Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org>
#
@@ -72,7 +72,7 @@ sub dump
return unless %{$self->{done}};
$state->say("Full dependency tree is #1",
- join(' ', keys %{$self->{done}}));
+ join(' ', keys %{$self->{done}}));
}
package OpenBSD::lookup::library;
@@ -106,7 +106,7 @@ sub find_in_extra_sources
my ($self, $solver, $state, $obj) = @_;
return undef if !$obj->is_valid || defined $obj->{dir};
- OpenBSD::SharedLibs::add_libs_from_system($state->{destdir});
+ OpenBSD::SharedLibs::add_libs_from_system($state->{destdir}, $state);
for my $dir (OpenBSD::SharedLibs::system_dirs()) {
if ($solver->check_lib_spec($dir, $obj, {system => 1})) {
$self->say_found($state, $obj, $state->f("#1/lib", $dir));
@@ -121,13 +121,12 @@ sub find_in_new_source
my ($self, $solver, $state, $obj, $dep) = @_;
if (defined $solver->{set}->{newer}->{$dep}) {
- OpenBSD::SharedLibs::add_libs_from_plist($solver->{set}->{newer}->{$dep}->plist);
+ OpenBSD::SharedLibs::add_libs_from_plist($solver->{set}->{newer}->{$dep}->plist, $state);
} else {
- OpenBSD::SharedLibs::add_libs_from_installed_package($dep);
+ OpenBSD::SharedLibs::add_libs_from_installed_package($dep, $state);
}
- if ($solver->check_lib_spec($solver->{localbase}, $obj,
- {$dep => 1})) {
- $self->say_found($state, $obj, $state->f("package #1", $dep));
+ if ($solver->check_lib_spec($solver->{localbase}, $obj, {$dep => 1})) {
+ $self->say_found($state, $obj, $state->f("package #1", $dep));
return $dep;
}
return undef;
@@ -166,7 +165,8 @@ sub find_in_already_done
my ($self, $solver, $state, $obj) = @_;
my $r = $self->{known_tags}->{$obj};
if (defined $r) {
- $state->say("Found tag #1 in #2", $obj, $r) if $state->verbose >= 3;
+ $state->say("Found tag #1 in #2", $obj, $r)
+ if $state->verbose >= 3;
}
return $r;
}
@@ -274,7 +274,7 @@ sub do
if ($state->tracker->{to_update}{$$v}) {
$solver->add_dep($state->tracker->{to_update}{$$v});
- return $$v;
+ return $$v;
}
if ($state->tracker->{uptodate}{$$v}) {
bless $v, "_cache::installed";
@@ -303,7 +303,7 @@ sub clone
while (my ($k, $e) = each %{$extra->{$h}}) {
$self->{$h}{$k} //= $e;
}
- }
+ }
}
package OpenBSD::Dependencies::Solver;
@@ -675,7 +675,7 @@ sub find_old_lib
my $r = $state->repo->installed->match_locations(OpenBSD::Search::PkgSpec->new(".libs-".$pattern));
for my $try (map {$_->name} @$r) {
- OpenBSD::SharedLibs::add_libs_from_installed_package($try);
+ OpenBSD::SharedLibs::add_libs_from_installed_package($try, $state);
if ($self->check_lib_spec($base, $lib, {$try => 1})) {
return $try;
}
diff --git a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm
index 37432cd5c6c..251758ebbb6 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.52 2010/10/27 14:35:56 espie Exp $
+# $OpenBSD: SharedLibs.pm,v 1.53 2010/12/20 08:58:03 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -31,8 +31,8 @@ package OpenBSD::PackingElement::Lib;
sub mark_available_lib
{
- my ($self, $pkgname) = @_;
- OpenBSD::SharedLibs::register_lib($self->fullname, $pkgname);
+ my ($self, $pkgname, $state) = @_;
+ OpenBSD::SharedLibs::register_lib($self->fullname, $pkgname, $state);
}
package OpenBSD::SharedLibs;
@@ -90,12 +90,12 @@ our $repo = OpenBSD::LibRepo->new;
sub register_lib
{
- my ($name, $pkgname) = @_;
+ my ($name, $pkgname, $state) = @_;
my $lib = OpenBSD::Library->from_string($name);
if ($lib->is_valid) {
$repo->register($lib, $pkgname);
} else {
- print STDERR "Bogus library in $pkgname: $name\n"
+ $state->errsay("Bogus library in #1: #2", $pkgname, $name)
unless $pkgname eq 'system';
}
@@ -110,7 +110,7 @@ sub system_dirs
sub add_libs_from_system
{
- my ($destdir) = @_;
+ my ($destdir, $state) = @_;
return if $done_plist->{'system'};
$done_plist->{'system'} = 1;
for my $dirname (system_dirs()) {
@@ -125,23 +125,23 @@ sub add_libs_from_system
sub add_libs_from_installed_package
{
- my $pkgname = shift;
+ my ($pkgname, $state) = @_;
return if $done_plist->{$pkgname};
$done_plist->{$pkgname} = 1;
my $plist = OpenBSD::PackingList->from_installation($pkgname,
\&OpenBSD::PackingList::LibraryOnly);
return if !defined $plist;
- $plist->mark_available_lib($pkgname);
+ $plist->mark_available_lib($pkgname, $state);
}
sub add_libs_from_plist
{
- my $plist = shift;
+ my ($plist, $state) = @_;
my $pkgname = $plist->pkgname;
return if $done_plist->{$pkgname};
$done_plist->{$pkgname} = 1;
- $plist->mark_available_lib($pkgname);
+ $plist->mark_available_lib($pkgname, $state);
}
sub lookup_libspec