diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2011-11-14 12:49:07 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2011-11-14 12:49:07 +0000 |
commit | 00331a173ccf4454d4ec3ee0bb5684baba5d422f (patch) | |
tree | 4c863f8ef67d66b332d22cb5f7a9581204642469 /usr.sbin/pkg_add | |
parent | 680fe47acf2a83581fa86e4d6b952600b13e3a37 (diff) |
much better solver: don't try to solve every library, but just the ones
we have in the package we're trying to create.
So, solve one level, and keep solving until we have what we need or we
run out of level. Any package without @wantlib and lots of runtime depends
will build MUCH faster. Other packages MAY build faster.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 3ad8750e696..425b235bbe7 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.51 2011/11/14 10:31:20 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.52 2011/11/14 12:49:06 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -567,16 +567,41 @@ sub solve_all_depends { my ($solver, $state) = @_; - while (1) { my @todo = $solver->solve_depends($state); if (@todo == 0) { return; } + if ($solver->solve_wantlibs($state, 0)) { + return; + } $solver->{set}->add_new(@todo); } } +sub solve_wantlibs +{ + my ($solver, $state, $final) = @_; + + my $okay = 1; + my $lib_finder = OpenBSD::lookup::library->new($solver); + my $h = $solver->{set}->{new}[0]; + for my $lib (@{$h->{plist}->{wantlib}}) { + $solver->{localbase} = $h->{plist}->localbase; + next if $lib_finder->lookup($solver, + $solver->{to_register}->{$h}, $state, + $lib->spec); + $okay = 0; + OpenBSD::SharedLibs::report_problem($state, + $lib->spec) if $final; + } + if (!$okay && $final) { + $solver->dump($state); + $lib_finder->dump($state); + } + return $okay; +} + sub really_solve_dependency { my ($self, $state, $dep, $package) = @_; @@ -651,13 +676,6 @@ sub ask_tree return $plist; } -sub errsay_library -{ - my ($solver, $state, $h) = @_; - - $state->errsay("Can't create #1 because of libraries", $h->pkgname); -} - # we don't want old libs sub find_old_lib { @@ -1060,10 +1078,12 @@ sub check_dependencies my ($self, $plist, $state) = @_; my $solver = OpenBSD::Dependencies::CreateSolver->new($plist); - $solver->solve_all_depends($state); + # look for libraries in the "real" tree $state->{destdir} = '/'; - if (!$solver->solve_wantlibs($state)) { + + $solver->solve_all_depends($state); + if (!$solver->solve_wantlibs($state, 1)) { $state->{bad}++; } } |