summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-06-09 10:30:54 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-06-09 10:30:54 +0000
commitf3a00987805a3573b982ef2ac12a4ee2cdd0ab42 (patch)
treef00cafcd95c4f1cba4fbedfd7e5d06487d9d2b16 /usr.sbin/pkg_add
parente666e65bfb76c9b338f86372205d797c8ac9afec (diff)
new code is much sturdier with respect to old libraries, we do not have
to consider .libs-* as `special case', saving old libraries should do the right thing in all cases, more or less...
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Replace.pm67
-rw-r--r--usr.sbin/pkg_add/pkg_add25
2 files changed, 6 insertions, 86 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm
index 9946fe319fc..5e85ec86998 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.37 2007/06/07 20:41:01 espie Exp $
+# $OpenBSD: Replace.pm,v 1.38 2007/06/09 10:30:53 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -468,69 +468,4 @@ sub adjust_dependency
$l->add($into);
}
-sub figure_out_libs
-{
- my ($plist, $state, @libs) = @_;
-
- my $has = {};
- my $result = [];
-
- for my $item (@{$plist->{items}}) {
- next unless $item->IsFile;
- $has->{$item->fullname} = 1;
- }
-
- for my $oldlib (@libs) {
- print "Checking for collisions with $oldlib... "
- if $state->{verbose};
-
-# require OpenBSD::RequiredBy;
-#
-# if (OpenBSD::RequiredBy->new($oldlib)->list == 0) {
-# require OpenBSD::Delete;
-#
-# OpenBSD::Delete::delete_package($oldlib, $state);
-# delete_installed($oldlib);
-# next;
-# }
-
- my $p = OpenBSD::PackingList->from_installation($oldlib);
- my $n = [];
- my $delete = [];
- my $empty = 1;
- my $doit = 0;
- for my $file (@{$p->{items}}) {
- if ($file->IsFile) {
- if ($has->{$file->fullname}) {
- $doit = 1;
- push(@$delete, $file);
- next;
- } else {
- $empty = 0;
- }
- }
- push(@$n, $file);
- }
- $p->{items} = $n;
- if ($doit) {
- print "some found\n" if $state->{verbose};
- # XXX we don't use this code yet
- my $dummy = {items => $delete};
- push(@$result,
- { plist => $p,
- todelete => $dummy,
- empty => $empty});
- #require OpenBSD::Delete;
- #OpenBSD::Delete::validate_plist($p, $state);
- } else {
- print "none found\n" if $state->{verbose};
- }
- }
- if (@$result) {
- #$plist->{old_libs} = $result;
- return 0;
- }
- return 1;
-}
-
1;
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index a7831b901fb..952d3cbae76 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.313 2007/06/07 20:30:03 espie Exp $
+# $OpenBSD: pkg_add,v 1.314 2007/06/09 10:30:53 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -132,29 +132,20 @@ sub can_install
return 1 if @conflicts == 0;
my %conflicts = map {($_,1)} @conflicts;
-
- my @libs = ();
- @conflicts = ();
- for my $k (keys %conflicts) {
- if ($k =~ m/^\.libs\-/o) {
- push(@libs, $k);
- } else {
- push(@conflicts, $k);
- }
- }
+ @conflicts = keys %conflicts;
if (!$state->{allow_replacing}) {
if ($state->{forced}->{conflicts}) {
- print "Forcing install of $pkgname in the presence of conflicts (",join(',', @conflicts, @libs), ")\n";
+ print "Forcing install of $pkgname in the presence of conflicts (",join(',', @conflicts), ")\n";
return 1;
}
- print "Can't install $pkgname because of conflicts (",join(',', @conflicts, @libs), ")\n";
+ print "Can't install $pkgname because of conflicts (",join(',', @conflicts), ")\n";
$handle->set_error(OpenBSD::Handle::CANT_INSTALL);
return;
}
if (@conflicts > 5) {
- print "Can't install $pkgname because of conflicts (",join(',', @conflicts, @libs), ")\n";
+ print "Can't install $pkgname because of conflicts (",join(',', @conflicts), ")\n";
$handle->set_error(OpenBSD::Handle::CANT_INSTALL);
return;
}
@@ -167,12 +158,6 @@ sub can_install
return;
}
- if (!OpenBSD::Replace::figure_out_libs($plist, $state, @libs)) {
- print "Can't update to $pkgname because of collision with old libs\n";
- $handle->set_error(OpenBSD::Handle::CANT_INSTALL);
- return;
- }
-
for my $toreplace (@conflicts) {
if ($state->is_installed($toreplace)) {
Warn "Cannot replace $toreplace with $pkgname: just got installed\n";