diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-11-29 11:22:26 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-11-29 11:22:26 +0000 |
commit | 81234400edda9522378801123bac38d504903222 (patch) | |
tree | fcc54bb918c555876570e5e3e0d2a8b178bedfcd /usr.sbin/pkg_add/OpenBSD | |
parent | 4de884c57a9032f52c167129a0ccf37c027f713f (diff) |
clean up conflict handling and dependency adjustement: build list
of conflict globally, add it as old handles, and then use it everywhere.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 58 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Replace.pm | 6 |
2 files changed, 36 insertions, 28 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index a2d1d0b480b..3f3ac16b702 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Dependencies.pm,v 1.86 2009/11/29 07:06:17 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.87 2009/11/29 11:22:25 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> # @@ -384,37 +384,45 @@ sub record_old_dependencies } } -sub adjust_old_dependencies +sub adjust_old_dependency_on { - my ($self, $state) = @_; - for my $pkg ($self->{set}->newer) { - my $pkgname = $pkg->pkgname; - for my $o ($self->{set}->older) { - next unless defined $o->{wantlist}; - require OpenBSD::Replace; - require OpenBSD::RequiredBy; - - my $oldname = $o->pkgname; - - $state->say("Adjusting dependencies for ", - "$pkgname/$oldname") if $state->{beverbose}; - my $d = OpenBSD::RequiredBy->new($pkgname); - for my $dep (@{$o->{wantlist}}) { - if (defined $self->{set}->{skipupdatedeps}->{$dep}) { - $state->say("\tskipping $dep") - if $state->{beverbose}; - next; - } - $state->say("\t$dep") + my ($self, $pkgname, $state) = @_; + + my $set = $self->{set}; + + for my $o ($set->older) { + next unless defined $o->{wantlist}; + require OpenBSD::Replace; + require OpenBSD::RequiredBy; + + my $oldname = $o->pkgname; + + $state->say("Adjusting dependencies for ", + "$pkgname/$oldname") if $state->{beverbose}; + my $d = OpenBSD::RequiredBy->new($pkgname); + for my $dep (@{$o->{wantlist}}) { + if (defined $set->{older}->{$dep}) { + $state->say("\tskipping $dep") if $state->{beverbose}; - $d->add($dep); - OpenBSD::Replace::adjust_dependency($dep, - $oldname, $pkgname); + next; } + $state->say("\t$dep") if $state->{beverbose}; + $d->add($dep); + OpenBSD::Replace::adjust_dependency($dep, + $oldname, $pkgname); } } } +sub adjust_old_dependencies +{ + my ($self, $state) = @_; + + for my $pkg ($self->{set}->newer) { + $self->adjust_old_dependency_on($pkg->pkgname, $state); + } +} + sub repair_dependencies { my ($self, $state) = @_; diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm index e25b2f5b663..67a076cdc16 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.56 2009/11/29 06:51:12 espie Exp $ +# $OpenBSD: Replace.pm,v 1.57 2009/11/29 11:22:25 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -308,7 +308,7 @@ sub perform_extraction sub can_old_package_be_replaced { - my ($old_plist, $set, $state, $ignore) = @_; + my ($old_plist, $set, $state) = @_; $state->{okay} = 1; $state->{journal} = []; @@ -332,7 +332,7 @@ sub can_old_package_be_replaced my @wantlist = OpenBSD::RequiredBy->new($old_plist->pkgname)->list; my @r = (); for my $wanting (@wantlist) { - push(@r, $wanting) if !defined $ignore->{$wanting}; + push(@r, $wanting) if !defined $set->{older}->{$wanting}; } if (@r) { $state->say("Verifying dependencies still match for ", |