summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-01-27 00:08:32 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-01-27 00:08:32 +0000
commit4d1daa54e56d597ff25ef71eb81b9860fabfe520 (patch)
tree0a56ad8c26d86105f86861d8f73a01229ca6a475 /usr.sbin/pkg_add
parent540b045e24f7ba00f95a5323d9de705f5a858df9 (diff)
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.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/pkg_delete8
1 files changed, 6 insertions, 2 deletions
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;