summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-11-14 19:25:46 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-11-14 19:25:46 +0000
commit7c7a7160046710d8238862131f6d2e7dad75bb90 (patch)
tree4ffa79ed5515b4712365285e4d853a7477c15dd8 /usr.sbin
parentababaa113d0d3b62c5fc624223446a7172d40e52 (diff)
stop storing @pkdep into packing-lists, use separate REQUIRING file instead.
Cases where we need to tweak dependencies are well-delimited, and we simply convert the old installed package to the new model in one step.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm14
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm39
-rw-r--r--usr.sbin/pkg_add/pkg_add8
3 files changed, 43 insertions, 18 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index d306666bfba..e7c918cd601 100644
--- a/usr.sbin/pkg_add/OpenBSD/Delete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Delete.pm,v 1.9 2004/11/11 22:40:38 espie Exp $
+# $OpenBSD: Delete.pm,v 1.10 2004/11/14 19:25:45 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -138,6 +138,18 @@ sub delete_plist
}
$removed->{$name} = 1;
}
+ for my $name (OpenBSD::Requiring->new($pkgname)->list()) {
+ next if defined $removed->{$name};
+ print "remove dependency in $name\n"
+ if $state->{very_verbose} or $state->{not};
+ local $@;
+ eval { OpenBSD::RequiredBy->new($name)->delete($pkgname) unless $state->{not}; };
+ if ($@) {
+ print STDERR "$@\n";
+ }
+ $removed->{$name} = 1;
+ }
+
remove_packing_info($dir) unless $state->{not};
$plist->forget();
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index cbd4712355e..71edc223357 100644
--- a/usr.sbin/pkg_add/OpenBSD/Update.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Update.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Update.pm,v 1.31 2004/11/14 11:40:08 espie Exp $
+# $OpenBSD: Update.pm,v 1.32 2004/11/14 19:25:45 espie Exp $
#
# Copyright (c) 2004 Marc Espie <espie@openbsd.org>
#
@@ -272,6 +272,19 @@ sub split_libs
return $splitted;
}
+sub convert_to_requiring
+{
+ my $pkg = shift;
+
+ my $plist = OpenBSD::PackingList->from_installation($pkg);
+ my $r = OpenBSD::Requiring->new($pkg);
+ for my $item (@{$plist->{pkgdep}}) {
+ $r->add($item->{name});
+ }
+ delete $plist->{pkgdep};
+ $plist->to_installation();
+}
+
sub walk_depends_closure
{
my ($start, $name, $state) = @_;
@@ -289,11 +302,14 @@ sub walk_depends_closure
next if $done->{$pkg2};
push(@todo, $pkg2);
print "\t$pkg2\n" if $state->{beverbose};
- $write->add($pkg2) unless $state->{not};
- my $plist = OpenBSD::PackingList->from_installation($pkg2);
- OpenBSD::PackingElement::PkgDep->add($plist, $name);
- $plist->to_installation() unless $state->{not};
$done->{$pkg2} = 1;
+ next if $state->{not};
+ $write->add($pkg2);
+ my $l = OpenBSD::Requiring->new($pkg2);
+ if (!$l->list()) {
+ convert_to_requiring($pkg2);
+ }
+ $l->add($name);
}
}
}
@@ -344,14 +360,11 @@ sub adjust_dependency
{
my ($dep, $from, $into) = @_;
- my $plist = OpenBSD::PackingList->from_installation($dep);
- my $items = [];
- for my $item (@{$plist->{pkgdep}}) {
- next if $item->{'name'} eq $from;
- push(@$items, $item);
+ my $l = OpenBSD::Requiring->new($dep);
+ if (!$l->list()) {
+ convert_to_requiring($dep);
}
- $plist->{pkgdep} = $items;
- OpenBSD::PackingElement::PkgDep->add($plist, $into);
- $plist->to_installation();
+ $l->delete($from);
+ $l->add($into);
}
1;
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index c8c930d6efd..169c822e17d 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.121 2004/11/14 13:20:07 espie Exp $
+# $OpenBSD: pkg_add,v 1.122 2004/11/14 19:25:45 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -423,8 +423,11 @@ sub really_add($$)
if (defined $handle->{solved_dependencies}) {
require OpenBSD::RequiredBy;
+ my $r = OpenBSD::Requiring->new($pkgname);
+
for my $dep (@{$handle->{solved_dependencies}}) {
OpenBSD::RequiredBy->new($dep)->add($pkgname);
+ $r->add($dep);
}
}
}
@@ -549,9 +552,6 @@ sub install_package
}
}
}
- for my $dep (@{$handle->{solved_dependencies}}) {
- OpenBSD::PackingElement::PkgDep->add($plist, $dep);
- }
really_add($handle, $state);
$state->{conflict_list}->{$plist->pkgname()} = $handle->{conflicts};
return ();