summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-06-02 11:24:23 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-06-02 11:24:23 +0000
commitdd64d16d1bb1c291d90bd0807e6bb058bf3d1508 (patch)
tree48d0fed63e0f70fc0a2d9d315ac9ce8ff4af81d0 /usr.sbin/pkg_add
parent9beaacc450d2bd2d8bd90dca6c7c4a27a6df99ed (diff)
move most of the code that deals with dependencies in the solver object
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Dependencies.pm40
-rw-r--r--usr.sbin/pkg_add/pkg_add44
2 files changed, 42 insertions, 42 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
index 278b9ed43c7..f17b9fef79e 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.45 2007/06/02 11:18:46 espie Exp $
+# $OpenBSD: Dependencies.pm,v 1.46 2007/06/02 11:24:22 espie Exp $
#
# Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org>
#
@@ -180,7 +180,7 @@ sub dump
sub register_dependencies
{
- my $self = shift;
+ my ($self, $state) = @_;
require OpenBSD::RequiredBy;
my $pkgname = $self->pkgname;
@@ -276,5 +276,41 @@ sub lookup_library
return;
}
+sub record_old_dependencies
+{
+ my ($self, $state) = @_;
+ for my $o ($self->{set}->older) {
+ require OpenBSD::RequiredBy;
+ my @wantlist = OpenBSD::RequiredBy->new($o->{pkgname})->list;
+ $o->{wantlist} = \@wantlist;
+ }
+}
+
+sub adjust_old_dependencies
+{
+ my ($self, $state) = @_;
+ my $pkgname = $self->{set}->handle->{pkgname};
+ for my $o ($self->{set}->older) {
+ require OpenBSD::Replace;
+ require OpenBSD::RequiredBy;
+
+ my $oldname = $o->{pkgname};
+
+ print "Adjusting dependencies for $pkgname/$oldname\n"
+ if $state->{beverbose};
+ my $d = OpenBSD::RequiredBy->new($pkgname);
+ for my $dep (@{$o->{wantlist}}) {
+ if (defined $self->{set}->{skipupdatedeps}->{$dep}) {
+ print "\tskipping $dep\n" if $state->{beverbose};
+ next;
+ }
+ print "\t$dep\n" if $state->{beverbose};
+ $d->add($dep);
+ OpenBSD::Replace::adjust_dependency($dep, $oldname, $pkgname);
+ }
+ }
+}
+
+
1;
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 0d65a3564b0..4e1f678e851 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.305 2007/06/02 11:18:46 espie Exp $
+# $OpenBSD: pkg_add,v 1.306 2007/06/02 11:24:22 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -324,42 +324,6 @@ sub partial_install
return failed_message($base_msg, $state->{interrupted}, save_partial_set($set, $state));
}
-sub record_old_dependencies
-{
- my ($set, $state) = @_;
- for my $o ($set->older) {
- require OpenBSD::RequiredBy;
- my @wantlist = OpenBSD::RequiredBy->new($o->{pkgname})->list;
- $o->{wantlist} = \@wantlist;
- }
-}
-
-sub adjust_old_dependencies
-{
- my ($set, $state) = @_;
- my $pkgname = $set->handle->{pkgname};
- for my $o ($set->older) {
- require OpenBSD::Replace;
- require OpenBSD::RequiredBy;
-
- my $oldname = $o->{pkgname};
-
- print "Adjusting dependencies for $pkgname/$oldname\n"
- if $state->{beverbose};
- my $d = OpenBSD::RequiredBy->new($pkgname);
- for my $dep (@{$o->{wantlist}}) {
- if (defined $set->{skipupdatedeps}->{$dep}) {
- print "\tskipping $dep\n" if $state->{beverbose};
- next;
- }
- print "\t$dep\n" if $state->{beverbose};
- $d->add($dep);
- OpenBSD::Replace::adjust_dependency($dep, $oldname, $pkgname);
- }
- }
-}
-
-
sub really_add
{
my ($set, $state) = @_;
@@ -422,7 +386,7 @@ sub really_add
$set, $state);
}
- record_old_dependencies($set, $state);
+ $set->{solver}->record_old_dependencies($state);
for my $o ($set->older) {
my $oldname = $o->{pkgname};
$state->progress->set_header($oldname." (deleting)");
@@ -473,14 +437,14 @@ sub really_add
OpenBSD::SharedLibs::add_libs_from_plist($plist);
$plist->to_cache;
OpenBSD::Add::register_installation($plist);
- $set->{solver}->register_dependencies;
+ $set->{solver}->register_dependencies($state);
add_installed($pkgname);
delete $handle->{partial};
OpenBSD::PkgCfl::register($plist, $state);
if ($plist->has(DISPLAY)) {
$plist->get(DISPLAY)->prepare($state);
}
- adjust_old_dependencies($set, $state);
+ $set->{solver}->adjust_old_dependencies($state);
}
sub install_package