summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/ForwardDependencies.pm24
-rw-r--r--usr.sbin/pkg_add/pkg_add8
2 files changed, 27 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/ForwardDependencies.pm b/usr.sbin/pkg_add/OpenBSD/ForwardDependencies.pm
index 56e950a9e28..bdf8aa5eb33 100644
--- a/usr.sbin/pkg_add/OpenBSD/ForwardDependencies.pm
+++ b/usr.sbin/pkg_add/OpenBSD/ForwardDependencies.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: ForwardDependencies.pm,v 1.1 2009/12/26 17:00:49 espie Exp $
+# $OpenBSD: ForwardDependencies.pm,v 1.2 2009/12/28 19:27:58 espie Exp $
#
# Copyright (c) 2009 Marc Espie <espie@openbsd.org>
#
@@ -34,12 +34,30 @@ sub find
$forward->{$f} = 1;
}
}
- bless $forward, $class;
+ bless { forward => $forward, set => $set}, $class;
+}
+
+sub adjust
+{
+ my ($self, $state) = @_;
+ my $set = $self->{set};
+
+ for my $f (keys %{$self->{forward}}) {
+ my $deps_f = OpenBSD::Requiring->new($f);
+ for my $check ($deps_f->list) {
+ if (defined $set->{older}->{$check}) {
+ my $r = $set->{older}->{$check}->{update_found}->pkgname;
+ $state->say("Should adjust $check to $r in $f");
+ }
+ }
+ }
}
sub check
{
- my ($forward, $set, $state) = @_;
+ my ($self, $state) = @_;
+ my $forward = $self->{forward};
+ my $set = $self->{set};
my @r = keys %$forward;
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 66711fb6861..78a37d946c9 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.442 2009/12/28 14:38:51 espie Exp $
+# $OpenBSD: pkg_add,v 1.443 2009/12/28 19:27:58 espie Exp $
#
# Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org>
#
@@ -276,7 +276,7 @@ sub check_forward_dependencies
require OpenBSD::ForwardDependencies;
$set->{forward} = OpenBSD::ForwardDependencies->find($set);
- my $bad = $set->{forward}->check($set, $state);
+ my $bad = $set->{forward}->check($state);
if (keys %$bad > 0) {
# for my $m (keys %$bad) {
@@ -579,6 +579,9 @@ sub really_add
for my $handle ($set->newer) {
$set->{solver}->register_dependencies($state);
}
+ if ($replacing) {
+# $set->{forward}->adjust($state);
+ }
$set->{solver}->adjust_old_dependencies($state);
if ($state->{repairdependencies}) {
$set->{solver}->repair_dependencies($state);
@@ -764,6 +767,7 @@ if (defined $state->{destdir}) {
$state->{automatic} = $opt_a;
$state->{allow_replacing} = $opt_r || $opt_u || $opt_U;
+$state->{hard_replace} = $opt_r;
$state->{newupdates} = $opt_u || $opt_U;
if (@ARGV == 0 && !$opt_u && !$opt_l) {