From d154e99ca9414323ee1e8d5954d7987f8a6a28d1 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Tue, 28 Dec 2004 13:54:14 +0000 Subject: synchronize conflict lists when we add/remove anything. --- usr.sbin/pkg_add/OpenBSD/PkgCfl.pm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'usr.sbin/pkg_add/OpenBSD') diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm index 0870aadf394..105d9809f46 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PkgCfl.pm,v 1.9 2004/12/19 14:09:53 espie Exp $ +# $OpenBSD: PkgCfl.pm,v 1.10 2004/12/28 13:54:13 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie # @@ -73,9 +73,18 @@ sub conflicts_with sub register($$) { my ($plist, $state) = @_; + if (!defined $plist->{conflicts}) { + $plist->{conflicts} = OpenBSD::PkgCfl->make_conflict_list($plist); + } $state->{conflict_list}->{$plist->pkgname()} = $plist->{conflicts}; } +sub unregister($$) +{ + my ($plist, $state) = @_; + delete $state->{conflict_list}->{$plist->pkgname()}; +} + sub fill_conflict_lists($) { my $state = shift; @@ -101,6 +110,9 @@ sub find($$) } while (my ($name, $l) = each %{$state->{conflict_list}}) { next if $name eq $pkgname; + if (!defined $l) { + die "Error: $name has no definition\n"; + } if ($l->conflicts_with($pkgname)) { push(@bad, $name); } -- cgit v1.2.3