diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-12-28 13:54:14 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-12-28 13:54:14 +0000 |
commit | d154e99ca9414323ee1e8d5954d7987f8a6a28d1 (patch) | |
tree | ff21441b66f6659fe0079516aff454e073e779c0 /usr.sbin/pkg_add/OpenBSD | |
parent | d1858f2e79c731d8dd2b4c59cf00c3f8c9d86e97 (diff) |
synchronize conflict lists when we add/remove anything.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCfl.pm | 14 |
1 files changed, 13 insertions, 1 deletions
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 <espie@openbsd.org> # @@ -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); } |