diff options
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 25 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 50 |
2 files changed, 37 insertions, 38 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 3b5842aad98..41ca0a5a7df 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.148 2010/12/20 16:30:03 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.149 2010/12/21 11:25:19 espie Exp $ # # Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org> # @@ -458,9 +458,9 @@ sub check_lib_spec return; } -sub find_in_installed +sub find_dep_in_installed { - my ($self, $dep) = @_; + my ($self, $state, $dep) = @_; return $self->find_candidate($dep, @{$self->installed_list}); } @@ -472,15 +472,6 @@ sub find_dep_in_self return $self->find_candidate($dep, $self->{set}->newer_names); } -package OpenBSD::Dependencies::Solver; -our @ISA = qw(OpenBSD::Dependencies::SolverBase); - -sub add_dep -{ - my ($self, $d) = @_; - $self->{deplist}{$d} = $d; -} - use OpenBSD::PackageInfo; OpenBSD::Auto::cache(installed_list, sub { @@ -494,6 +485,14 @@ OpenBSD::Auto::cache(installed_list, } ); +sub add_dep +{ + my ($self, $d) = @_; + $self->{deplist}{$d} = $d; +} + +package OpenBSD::Dependencies::Solver; +our @ISA = qw(OpenBSD::Dependencies::SolverBase); sub merge { @@ -641,7 +640,7 @@ sub really_solve_dependency return $v if $v; } - $v = $self->find_in_installed($dep); + $v = $self->find_dep_in_installed($state, $dep); if ($v) { if ($state->{newupdates}) { if ($state->tracker->is_known($v)) { diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 5f9b1f1067a..ff98967e691 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.33 2010/12/20 16:30:04 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.34 2010/12/21 11:25:19 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -537,16 +537,11 @@ sub solve_all_depends while (1) { - $solver->{more} = []; - $solver->solve_depends($state); - if (@{$solver->{more}}) { - for my $i (@{$solver->{more}}) { - push(@{$solver->{set}{new}}, - OpenBSD::PseudoHandle->new($i)); - } - } else { + my @todo = $solver->solve_depends($state); + if (@todo == 0) { return; } + $solver->{set}->add_new(@todo); } } @@ -555,7 +550,7 @@ sub really_solve_dependency my ($self, $state, $dep, $package) = @_; # look in installed packages - my $v = $self->find_in_installed($dep); + my $v = $self->find_dep_in_installed($state, $dep); if (!defined $v) { $v = $self->find_dep_in_self($state, $dep); } @@ -582,22 +577,13 @@ sub solve_from_ports // OpenBSD::Paths->portsdir; my $make = OpenBSD::Paths->make; open(my $fh, "cd $portsdir && SUBDIR=$dep->{pkgpath} ECHO_MSG=: $make print-plist-with-depends|") or return undef; - my $plist = OpenBSD::PackingList->read($fh); + my $plist = OpenBSD::PackingList->read($fh, + \&OpenBSD::PackingList::PrelinkStuffOnly); OpenBSD::SharedLibs::add_libs_from_plist($plist, $state); - push(@{$self->{more}}, $plist); + $self->add_dep($plist); return $plist->pkgname; } -# the full installed list is okay -OpenBSD::Auto::cache(installed_list, - sub { - require OpenBSD::PackageInfo; - - my @l = OpenBSD::PackageInfo::installed_packages(); - return \@l; - } -); - sub errsay_library { my ($solver, $state, $h) = @_; @@ -628,10 +614,19 @@ sub pkgname package OpenBSD::PseudoSet; sub new { - my ($class, $plist) = @_; + my ($class, @elements) = @_; + + my $o = bless {}, $class; + $o->add_new(@elements); +} - my $h = OpenBSD::PseudoHandle->new($plist); - bless {new => [$h]}, $class; +sub add_new +{ + my ($self, @elements) = @_; + for my $i (@elements) { + push(@{$self->{new}}, OpenBSD::PseudoHandle->new($i)); + } + return $self; } sub newer @@ -650,6 +645,11 @@ sub older return (); } +sub older_names +{ + return (); +} + sub kept { return (); |