summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Replace.pm10
-rw-r--r--usr.sbin/pkg_add/pkg_add48
2 files changed, 20 insertions, 38 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm
index 65e8063e5dc..22958136d4c 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.17 2007/05/22 11:02:57 espie Exp $
+# $OpenBSD: Replace.pm,v 1.18 2007/05/26 23:45:44 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -142,13 +142,7 @@ sub update_issue($$)
return if $_[1];
my $self = $_[0];
- # those are deemed innocuous
- if ($self->{expanded} =~ m|^/sbin/ldconfig\s+\-R\b| or
- $self->{expanded} =~ m|^install-info\s+\-\-delete\b|) {
- return;
- } else {
- return '@unexec '.$self->{expanded};
- }
+ return '@unexec '.$self->{expanded};
}
package OpenBSD::PackingElement::Dependency;
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 266e2b2e885..013d64e7d61 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.268 2007/05/26 12:25:29 espie Exp $
+# $OpenBSD: pkg_add,v 1.269 2007/05/26 23:45:44 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -194,29 +194,27 @@ sub can_install
# package information
sub prepare_to_add
{
- my ($pkg, $state, $handle) = @_;
+ my ($pkg, $state) = @_;
+ my $handle = OpenBSD::Handle->new;
my $location = OpenBSD::PackageLocator->find($pkg, $state->{arch});
if (!$location) {
print $state->deptree_header($pkg);
print "Can't find $pkg\n";
$handle->set_error(OpenBSD::Handle::NOT_FOUND);
- return;
- }
- if ($location->{finished}) {
- $handle->set_error(OpenBSD::Handle::CANT_INSTALL);
- return;
+ return $handle;
}
+ $handle->{location} = $location;
my $plist = $location->{plist} = $location->plist;
unless (defined $plist) {
print "Can't find CONTENTS from $pkg\n";
$handle->set_error(OpenBSD::Handle::BAD_PACKAGE);
- return;
+ return $handle;
}
if ($plist->localbase ne $state->{localbase}) {
print "Localbase mismatch: package has: ", $plist->localbase, " , user wants: ", $state->{localbase}, "\n";
$handle->set_error(OpenBSD::Handle::BAD_PACKAGE);
- return;
+ return $handle;
}
my $pkgname = $location->{pkgname} = $plist->pkgname;
if ($pkg ne '-') {
@@ -224,23 +222,20 @@ sub prepare_to_add
OpenBSD::PackageName::url2pkgname($pkg) ne $pkgname) {
print "Package name is not consistent ???\n";
$handle->set_error(OpenBSD::Handle::BAD_PACKAGE);
- return;
+ return $handle;
}
}
if ($state->{verbose}) {
print $state->deptree_header($pkg);
print "parsing $pkgname\n";
}
- if (can_install($plist, $state, $handle)) {
- return $location;
- } else {
+ if (!can_install($plist, $state, $handle)) {
$location->close_with_client_error;
$location->wipe_info;
delete $location->{plist};
- $location->{finished} = 1;
$handle->set_error(OpenBSD::Handle::CANT_INSTALL);
- return;
}
+ return $handle;
}
@@ -506,29 +501,22 @@ sub install_package
my ($pkg, $state, @todo) = @_;
my $cache = $state->{cache};
- my $handle = OpenBSD::Handle->new;
-
if (!defined $cache->{$pkg}) {
- $cache->{$pkg} = prepare_to_add($pkg, $state, $handle);
+ $cache->{$pkg} = prepare_to_add($pkg, $state);
}
- my $location = $cache->{$pkg};
- if ($state->{forced}->{kitchensink}) {
- if ($handle->has_error(OpenBSD::Handle::BAD_PACKAGE)) {
- $state->set_pkgname($pkg);
- $state->fatal("Fatal error") unless defined $location;
- } else {
- return () unless defined $location;
- }
- } else {
- if ($handle->has_error) {
+ my $handle = $cache->{$pkg};
+ if ($handle->has_error) {
+ if (!$state->{forced}->{kitchensink} ||
+ $handle->has_error(OpenBSD::Handle::BAD_PACKAGE)) {
$state->set_pkgname($pkg);
- $state->fatal("Fatal error") unless defined $location;
+ $state->fatal("Fatal error");
} else {
- return () unless defined $location;
+ return ();
}
}
+ my $location = $handle->{location};
if ($state->is_installed($location->{pkgname})) {
$location->close_now;
return ();