diff options
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCfl.pm | 14 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 5 |
2 files changed, 16 insertions, 3 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); } diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index d81e0b9f722..7c1b5d914b4 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.162 2004/12/27 23:56:48 espie Exp $ +# $OpenBSD: pkg_add,v 1.163 2004/12/28 13:54:13 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -374,6 +374,7 @@ sub really_add($$) }; delete_installed($op->pkgname()); + OpenBSD::PkgCfl::unregister($op, $state); } # Here there should be code to handle old libs @@ -441,6 +442,7 @@ sub really_add($$) } } add_installed($pkgname); + OpenBSD::PkgCfl::register($plist, $state); if ($plist->has(DISPLAY)) { $plist->get(DISPLAY)->prepare($state); } @@ -645,7 +647,6 @@ sub install_package } } really_add($handle, $state); - OpenBSD::PkgCfl::register($plist, $state); rmtree($handle->info()); delete $handle->{plist}; $state->{installed}->{$handle->{pkgname}} = 1; |