summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2014-02-04 00:14:28 +0000
committerMarc Espie <espie@cvs.openbsd.org>2014-02-04 00:14:28 +0000
commita131f4a5cb932feea0f8613c92648c9fe8c46146 (patch)
treea2d1ffe3eaea3d331e8cdec6c59ca777436eaf8b /usr.sbin/pkg_add/OpenBSD
parent2148e48ed83cb959e8fbf3877655563f4ee66a57 (diff)
check for errors before dependencies, anyways.
split the part for arch, since it requires full plists. avoid creating dummy locations for handles in errors.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Handle.pm5
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgAdd.pm18
2 files changed, 20 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Handle.pm b/usr.sbin/pkg_add/OpenBSD/Handle.pm
index 0fe22de0c91..e66874e37c8 100644
--- a/usr.sbin/pkg_add/OpenBSD/Handle.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Handle.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Handle.pm,v 1.36 2014/02/03 13:47:20 espie Exp $
+# $OpenBSD: Handle.pm,v 1.37 2014/02/04 00:14:27 espie Exp $
#
# Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org>
#
@@ -101,7 +101,8 @@ sub dependency_info
my $self = shift;
if (defined $self->{plist}) {
return $self->{plist};
- } elsif (defined $self->{location}{update_info}) {
+ } elsif (defined $self->{location} &&
+ defined $self->{location}{update_info}) {
return $self->{location}{update_info};
} else {
return undef;
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
index 31b381f2f73..9e378f63b28 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgAdd.pm,v 1.57 2014/02/03 13:47:20 espie Exp $
+# $OpenBSD: PkgAdd.pm,v 1.58 2014/02/04 00:14:27 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -843,7 +843,15 @@ sub newer_has_errors
$state->tracker->cant($set);
return 1;
}
+ }
+ return 0;
+}
+sub newer_is_bad_arch
+{
+ my ($set, $state) = @_;
+
+ for my $handle ($set->newer) {
if ($handle->plist->has('arch')) {
unless ($handle->plist->{arch}->check($state->{arch})) {
$state->set_name_from_handle($handle);
@@ -878,6 +886,10 @@ sub process_set
$set->figure_out_kept($state);
+ if (newer_has_errors($set, $state)) {
+ return ();
+ }
+
my @deps = $set->solver->solve_depends($state);
if ($state->verbose >= 2) {
$set->solver->dump($state);
@@ -896,6 +908,10 @@ sub process_set
return ();
}
+ if (newer_is_bad_arch($set, $state)) {
+ return ();
+ }
+
if ($set->older_to_do) {
my $r = $set->check_forward_dependencies($state);
if (!defined $r) {