diff options
-rw-r--r-- | usr.sbin/pkg_add/pkg_delete | 19 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_delete.1 | 4 |
2 files changed, 18 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete index 4f31a066a63..4e98e0f6b4f 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.83 2004/12/27 22:44:29 espie Exp $ +# $OpenBSD: pkg_delete,v 1.84 2004/12/27 22:54:25 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -174,7 +174,7 @@ eval { # and finally, handle the removal { do { $removed = 0; - for my $pkgname (@realnames) { + DELETE: for my $pkgname (@realnames) { next if $done{$pkgname}; unless (is_installed($pkgname)) { print "$pkgname was not installed\n"; @@ -182,8 +182,19 @@ eval { $removed++; next; } - if (OpenBSD::RequiredBy->new($pkgname)->list() > 0) { - next; + my $r = OpenBSD::RequiredBy->new($pkgname); + if ($r->list() > 0) { + if ($forced{baddepend}) { + for my $p ($r->list()) { + if ($done{$p}) { + $r->delete($p); + } else { + next DELETE; + } + } + } else { + next; + } } if (!OpenBSD::ProgressMeter::set_header($pkgname)) { print $opt_n ? "Pretending to delete " : "Deleting ", diff --git a/usr.sbin/pkg_add/pkg_delete.1 b/usr.sbin/pkg_add/pkg_delete.1 index a8f623faf87..96135d6159e 100644 --- a/usr.sbin/pkg_add/pkg_delete.1 +++ b/usr.sbin/pkg_add/pkg_delete.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_delete.1,v 1.15 2004/12/09 18:58:25 espie Exp $ +.\" $OpenBSD: pkg_delete.1,v 1.16 2004/12/27 22:54:25 espie Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -70,6 +70,8 @@ These include: .Bl -tag -width "dependenciesXX" .It Ar ambiguous delete all packages matching ambiguous package specifications. +.It Ar baddepend +force the deletion of packages even if they reference inexistent dependencies. .It Ar dependencies also delete the whole set of packages that depends upon the requested packages. .It Ar nonroot |