diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-06-02 10:32:32 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-06-02 10:32:32 +0000 |
commit | edc495da5a88f5c8ec7f25327d80bcd8352b65bb (patch) | |
tree | b6a3b035c4e8cfdd507b9d69b2c506a0fd8ec9fe /usr.sbin/pkg_add | |
parent | e31cc9eb5b5ca92e6917af825a92c07fe42c84da (diff) |
move dependency registration into its own function.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Delete.pm | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index 492d0e9819f..3920ab592c4 100644 --- a/usr.sbin/pkg_add/OpenBSD/Delete.pm +++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Delete.pm,v 1.58 2007/06/01 14:58:29 espie Exp $ +# $OpenBSD: Delete.pm,v 1.59 2007/06/02 10:32:31 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -126,6 +126,24 @@ sub delete_package delete_plist($plist, $state); } +sub unregister_dependencies +{ + my ($plist, $state) = @_; + + my $pkgname = $plist->pkgname; + + for my $name (OpenBSD::Requiring->new($pkgname)->list) { + print "remove dependency on $name\n" + if $state->{very_verbose} or $state->{not}; + local $@; + try { + OpenBSD::RequiredBy->new($name)->delete($pkgname); + } catchall { + print STDERR "$_\n"; + }; + } +} + sub delete_plist { my ($plist, $state) = @_; @@ -144,17 +162,7 @@ sub delete_plist } - for my $name (OpenBSD::Requiring->new($pkgname)->list) { - print "remove dependency on $name\n" - if $state->{very_verbose} or $state->{not}; - local $@; - try { - OpenBSD::RequiredBy->new($name)->delete($pkgname); - } catchall { - print STDERR "$_\n"; - }; - } - + unregister_dependencies($plist, $state); return if $state->{not}; if ($state->{baddelete}) { my $borked = keep_old_files($state, $plist); |