summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2018-06-26 09:40:34 +0000
committerMarc Espie <espie@cvs.openbsd.org>2018-06-26 09:40:34 +0000
commit6fafc82c585a5ea16f7b441035969ac6aaf69fa3 (patch)
tree87b5667fde07321787271add5920f6a10f493ced /usr.sbin
parent37aaaf33e69a8b5beaabfebc3f5063b983eed475 (diff)
make it possible to remove old packages with erroneous tags...
shouldn't happen, but... - mark old handles as such in UpdateSets - keep going on solve_handle_tag to get maximum reports - tweak verify_tags to demote old handles to warnings from errors
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Dependencies.pm17
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm20
-rw-r--r--usr.sbin/pkg_add/OpenBSD/UpdateSet.pm7
3 files changed, 25 insertions, 19 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
index 09a87d387b6..94dd261d155 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.170 2018/06/24 12:38:41 espie Exp $
+# $OpenBSD: Dependencies.pm,v 1.171 2018/06/26 09:40:33 espie Exp $
#
# Copyright (c) 2005-2010 Marc Espie <espie@openbsd.org>
#
@@ -250,7 +250,7 @@ sub find_dep_in_stuff_to_install
$v = $self->find_candidate($dep, keys %{$state->tracker->{to_install}});
if ($v) {
$self->set_cache($dep, _cache::to_install->new($v));
- $self->add_dep($state->tracker->{to_install}->{$v});
+ $self->add_dep($state->tracker->{to_install}{$v});
}
return $v;
}
@@ -406,7 +406,7 @@ sub solve_handle_tags
$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)) {
+ if (!$solver->verify_tag($tag, $state, $plist, $h->{is_old})) {
$okay = 0;
}
}
@@ -417,14 +417,17 @@ sub solve_tags
{
my ($solver, $state) = @_;
+ my $okay = 1;
for my $h ($solver->{set}->changed_handles) {
if (!$solver->solve_handle_tags($h, $state)) {
- $solver->dump($state);
- $solver->{tag_finder}->dump($state);
- return 0;
+ $okay = 0;
}
}
- return 1;
+ if (!$okay) {
+ $solver->dump($state);
+ $solver->{tag_finder}->dump($state);
+ }
+ return $okay;
}
package OpenBSD::PackingElement;
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies/SolverBase.pm
index f2c8025b03a..c52484c84a3 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.7 2018/06/25 18:18:00 espie Exp $
+# $OpenBSD: SolverBase.pm,v 1.8 2018/06/26 09:40:33 espie Exp $
#
# Copyright (c) 2005-2018 Marc Espie <espie@openbsd.org>
#
@@ -460,12 +460,14 @@ sub add_dep
sub verify_tag
{
- my ($self, $tag, $state, $plist) = @_;
- my $msg = "Error in #1: \@tag #2";
+ my ($self, $tag, $state, $plist, $is_old) = @_;
+ my $bad_return = $is_old ? 1 : 0;
+ my $type = $is_old ? "Warning" : "Error";
+ my $msg = "#1 in #2: \@tag #3";
if (!defined $tag->{definition_list}) {
$state->errsay("$msg definition not found",
- $plist->pkgname, $tag->name);
- return 0;
+ $type, $plist->pkgname, $tag->name);
+ return $bad_return;
}
my $use_params = 0;
for my $d (@{$tag->{definition_list}}) {
@@ -477,13 +479,13 @@ sub verify_tag
if ($tag->{params} eq '' && $use_params && !$tag->{found_in_self}) {
$state->errsay(
"$msg has no parameters but some define wants them",
- $plist->pkgname, $tag->name);
- return 0;
+ $type, $plist->pkgname, $tag->name);
+ return $bad_return;
} elsif ($tag->{params} ne '' && !$use_params) {
$state->errsay(
"$msg has parameters but no define uses them",
- $plist->pkgname, $tag->name);
- return 0;
+ $type, $plist->pkgname, $tag->name);
+ return $bad_return;
}
return 1;
}
diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
index 0e8bc3759d5..c52d8ab8174 100644
--- a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
+++ b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: UpdateSet.pm,v 1.79 2018/06/20 10:23:18 espie Exp $
+# $OpenBSD: UpdateSet.pm,v 1.80 2018/06/26 09:40:33 espie Exp $
#
# Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org>
#
@@ -73,7 +73,8 @@ sub add_older
{
my $self = shift;
for my $h (@_) {
- $self->{older}->{$h->pkgname} = $h;
+ $self->{older}{$h->pkgname} = $h;
+ $h->{is_old} = 1;
}
return $self;
}
@@ -257,7 +258,7 @@ sub add_newer
{
my $self = shift;
for my $h (@_) {
- $self->{newer}->{$h->pkgname} = $h;
+ $self->{newer}{$h->pkgname} = $h;
$self->{updates}++;
}
return $self;