From 4d1daa54e56d597ff25ef71eb81b9860fabfe520 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Tue, 27 Jan 2004 00:08:32 +0000 Subject: remove package if RequiredBy file ends up empty too soon. This allows users to remove packages with bogus dependency registration that happened at one point in the life of the pkg_*. This should please henning. --- usr.sbin/pkg_add/pkg_delete | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete index e12a164c3df..84d51072262 100644 --- a/usr.sbin/pkg_add/pkg_delete +++ b/usr.sbin/pkg_add/pkg_delete @@ -1,6 +1,6 @@ #!/usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_delete,v 1.16 2003/12/21 18:41:23 espie Exp $ +# $OpenBSD: pkg_delete,v 1.17 2004/01/27 00:08:31 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -302,7 +302,11 @@ sub delete_package my $name = $item->{name}; next if defined $removed->{$name}; print "remove dependency in $name\n" if $opt_v or $opt_n; - OpenBSD::RequiredBy->new($name)->delete($pkgname) unless $opt_n; + local $@; + eval { OpenBSD::RequiredBy->new($name)->delete($pkgname) unless $opt_n; }; + if ($@) { + print STDERR "$@\n"; + } $removed->{$name} = 1; } remove_packing_info($dir) unless $opt_n; -- cgit v1.2.3