diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 18 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm | 33 |
2 files changed, 41 insertions, 10 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 49c03cf50dd..09a87d387b6 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.169 2018/06/23 09:19:49 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.170 2018/06/24 12:38:41 espie Exp $ # # Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org> # @@ -400,17 +400,17 @@ sub solve_handle_tags my ($solver, $h, $state) = @_; my $plist = $h->plist; return 1 if !defined $plist->{tags}; + my $okay = 1; $solver->{tag_finder} //= OpenBSD::lookup::tag->new($solver, $state); for my $tag (@{$plist->{tags}}) { - next if $solver->{tag_finder}->lookup($solver, - $solver->{to_register}{$h}, $state, $tag); - # XXX - next if $solver->find_in_self($plist, $state, $tag); - $state->errsay("Error in #1: tag definition not found #2", - $plist->pkgname, $tag->name); - return 0; + $solver->{tag_finder}->lookup($solver, + $solver->{to_register}{$h}, $state, $tag) + || $solver->find_in_self($plist, $state, $tag); + if (!$solver->verify_tag($tag, $state, $plist)) { + $okay = 0; + } } - return 1; + return $okay; } sub solve_tags diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm index 530a1ba31c6..52b321a8b8b 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: SolverBase.pm,v 1.4 2018/06/24 10:22:23 espie Exp $ +# $OpenBSD: SolverBase.pm,v 1.5 2018/06/24 12:38:41 espie Exp $ # # Copyright (c) 2005-2018 Marc Espie <espie@openbsd.org> # @@ -456,4 +456,35 @@ sub add_dep $self->{deplist}{$d} = $d; } + +sub verify_tag +{ + my ($self, $tag, $state, $plist) = @_; + my $msg = "Error in #1: \@tag #2"; + if (!defined $tag->{definition_list}) { + $state->errsay("$msg definition not found", + $plist->pkgname, $tag->name); + return 0; + } + my $use_params = 0; + for my $d (@{$tag->{definition_list}}) { + if ($d->need_params) { + $use_params = 1; + last; + } + } + if ($tag->{params} eq '' && $use_params) { + $state->errsay( + "$msg has no parameters but some define wants them", + $plist->pkgname, $tag->name); + return 0; + } elsif ($tag->{params} ne '' && !$use_params) { + $state->errsay( + "$msg has parameters but no define uses them", + $plist->pkgname, $tag->name); + return 0; + } + return 1; +} + 1; |