summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-12-12 07:06:10 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-12-12 07:06:10 +0000
commit6c1576e849c762528dd8dfa4d58ad54127b4a195 (patch)
tree711aab2d3216d1742b6283985b6d770bde9dabe1 /usr.sbin
parent6d9e20614adecd5f67d46e3ed51ec1614930dfce (diff)
do the same dance with older packages: build before list, and use it when
deleting.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/pkg_add18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 467bdc9d2f8..662b8ffdaeb 100644
--- a/usr.sbin/pkg_add/pkg_add
+++ b/usr.sbin/pkg_add/pkg_add
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_add,v 1.420 2009/12/11 21:04:01 espie Exp $
+# $OpenBSD: pkg_add,v 1.421 2009/12/12 07:06:09 espie Exp $
#
# Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org>
#
@@ -326,11 +326,14 @@ sub partial_install
return failed_message($base_msg, $state->{interrupted}, save_partial_set($set, $state));
}
-sub iterate
+sub build_before
{
- my $sub = pop @_;
- for my $p (@_) {
- &$sub($p);
+ my %known = map {($_->pkgname, 1)} @_;
+ require OpenBSD::RequiredBy;
+ for my $c (@_) {
+ for my $d (OpenBSD::RequiredBy->new($c->pkgname)->list) {
+ push(@{$c->{before}}, $d) if $known{$d};
+ }
}
}
@@ -344,7 +347,7 @@ sub okay
return 1;
}
-sub iterate2
+sub iterate
{
my $sub = pop @_;
my $done = {};
@@ -457,6 +460,7 @@ sub really_add
}
$set->{solver}->record_old_dependencies($state);
+ build_before($set->older_to_do);
iterate($set->older_to_do, sub {
my $o = shift;
$set->setup_header($state, $o, "deleting");
@@ -482,7 +486,7 @@ sub really_add
}
my $first = 1;
- iterate2($set->newer, sub {
+ iterate($set->newer, sub {
my $handle = shift;
if (!$first) {