summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-12-30 17:37:37 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-12-30 17:37:37 +0000
commit8d34f863646a46e095ee8d62104e162431069e81 (patch)
tree2da7baec17c2a26bb98d97ec607c7a35a08e6564 /usr.sbin
parent62a5433220ec6f6df530f55fbf136640cfc7fa52 (diff)
also track stuff I couldn't install, and use it for negative cache lookups.
fix some looping if stuff can't install for whatever reason.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Dependencies.pm18
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Tracker.pm10
2 files changed, 24 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
index 699d632097b..b49d301e45c 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.111 2009/12/30 09:36:16 espie Exp $
+# $OpenBSD: Dependencies.pm,v 1.112 2009/12/30 17:37:36 espie Exp $
#
# Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org>
#
@@ -212,6 +212,14 @@ sub do
return $$v;
}
+package _cache::bad;
+our @ISA=(qw(_cache));
+sub do
+{
+ my ($v, $solver, $state, $dep, $package) = @_;
+ return $$v;
+}
+
package _cache::to_install;
our @ISA=(qw(_cache));
sub do
@@ -513,13 +521,17 @@ sub solve_dependency
$v = $self->find_dep_in_repositories($state, $dep);
if ($v) {
+ if (defined $state->{tracker}{cant_install}{$v->name}) {
+ set_global($dep, _cache::bad->new($v->name));
+ return $v->name;
+ }
my $s = OpenBSD::UpdateSet->from_location($v);
$state->tracker->todo($s);
$self->add_dep($s);
- $self->set_cache($dep, _cache::to_install->new($v->{name}));
- return $v->{name};
+ $self->set_cache($dep, _cache::to_install->new($v->name));
+ return $v->name;
}
# resort to default if nothing else
diff --git a/usr.sbin/pkg_add/OpenBSD/Tracker.pm b/usr.sbin/pkg_add/OpenBSD/Tracker.pm
index c8692924654..3c10b52f851 100644
--- a/usr.sbin/pkg_add/OpenBSD/Tracker.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Tracker.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Tracker.pm,v 1.18 2009/12/30 09:56:26 espie Exp $
+# $OpenBSD: Tracker.pm,v 1.19 2009/12/30 17:37:36 espie Exp $
#
# Copyright (c) 2009 Marc Espie <espie@openbsd.org>
#
@@ -94,6 +94,7 @@ sub remove_set
my ($self, $set) = @_;
for my $n ($set->newer) {
delete $self->{to_install}->{$n->pkgname};
+ delete $self->{cant_install}->{$n->pkgname};
}
for my $n ($set->kept, $set->older, $set->hints) {
delete $self->{to_update}->{$n->pkgname};
@@ -117,9 +118,16 @@ sub cant
my ($self, $set) = @_;
$set->{finished} = 1;
$self->remove_set($set);
+ $self->known($set);
for my $n ($set->older) {
$self->{cant_update}->{$n->pkgname} = 1;
}
+ for my $n ($set->newer) {
+ $self->{cant_install}->{$n->pkgname} = 1;
+ }
+ for my $n ($set->kept) {
+ $self->{uptodate}->{$n->pkgname} = 1;
+ }
}
sub done