summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/Replace.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-06-05 23:11:02 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-06-05 23:11:02 +0000
commit1a073eb4e2fb8cfca5238a9de151658dbaafdb28 (patch)
tree8ac7a3b37c20dd1f42a7d4c261fa10b09a9ef323 /usr.sbin/pkg_add/OpenBSD/Replace.pm
parentd4a93fb832c12d02a8646d485cd6d5df1c407381 (diff)
reuse the compute_closure code.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Replace.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Replace.pm37
1 files changed, 9 insertions, 28 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm
index 69472510c13..deeecfc50d2 100644
--- a/usr.sbin/pkg_add/OpenBSD/Replace.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Replace.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Replace.pm,v 1.32 2007/06/04 16:33:23 espie Exp $
+# $OpenBSD: Replace.pm,v 1.33 2007/06/05 23:11:01 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -354,41 +354,22 @@ sub split_libs
return $splitted;
}
-sub walk_depends_closure
+sub adjust_depends_closure
{
- my ($start, $plist, $state) = @_;
- my @todo = ($start);
- my $done = {};
- my $depend = 0;
- my $name = $plist->pkgname;
+ my ($oldname, $plist, $state) = @_;
print "Packages that depend on those shared libraries:\n"
if $state->{beverbose};
- my $write = OpenBSD::RequiredBy->new($name);
-
- while (my $pkg = shift @todo) {
- $done->{$pkg} = 1;
- for my $pkg2 (OpenBSD::RequiredBy->new($pkg)->list) {
- next if $done->{$pkg2};
- push(@todo, $pkg2);
- print "\t$pkg2\n" if $state->{beverbose};
- $done->{$pkg2} = 1;
- $write->add($pkg2);
- OpenBSD::Requiring->new($pkg2)->add($name);
- $depend = 1;
- }
+ my $write = OpenBSD::RequiredBy->new($plist->pkgname);
+ for my $pkg (OpenBSD::RequiredBy->compute_closure($oldname)) {
+ print "\t$pkg\n" if $state->{beverbose};
+ $write->add($pkg);
+ OpenBSD::Requiring->new($pkg)->add($plist->pkgname);
}
-# if (!$depend && $state->{interactive}) {
-# if ($state->{forced}->{zapoldlibs} ||
-# OpenBSD::Interactive::confirm("Nothing depends on $name. Delete it", 1, 0)) {
-# OpenBSD::Delete::delete_plist($plist, $state);
-# }
-# }
}
-
sub save_old_libraries
{
my ($set, $state) = @_;
@@ -435,7 +416,7 @@ sub save_old_libraries
require OpenBSD::PkgCfl;
OpenBSD::PkgCfl::register($stub_list, $state);
- walk_depends_closure($oldname, $stub_list, $state);
+ adjust_depends_closure($oldname, $stub_list, $state);
} else {
print "No libraries to keep\n" if $state->{beverbose};
}