summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-28 13:00:06 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-28 13:00:06 +0000
commit527bc72819037e26ae05ebd7822a5631f67cee5b (patch)
tree940fe658af0bbffe518cef33fc8df53a176a21f9 /usr.sbin/pkg_add
parent642f587b14cf58667aff4f2338ce7a3068357b9c (diff)
delay error reporting a bit more: try installing and deinstalling everything
and report more issues.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm14
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm8
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Vstat.pm36
3 files changed, 38 insertions, 20 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index a30fe381579..c4359208186 100644
--- a/usr.sbin/pkg_add/OpenBSD/Add.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Add.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.57 2007/05/28 12:16:55 espie Exp $
+# $OpenBSD: Add.pm,v 1.58 2007/05/28 13:00:04 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -59,21 +59,9 @@ sub validate_plist
{
my ($plist, $state) = @_;
- $state->{problems} = 0;
$state->{totsize} = 0;
- $state->{colliding} = [];
$plist->prepare_for_addition($state, $plist->pkgname);
- if (@{$state->{colliding}} > 0) {
- require OpenBSD::CollisionReport;
-
- OpenBSD::CollisionReport::collision_report($state->{colliding}, $state);
- }
- if (defined $state->{overflow}) {
- OpenBSD::Vstat::tally();
- }
- Fatal "fatal issues in installing ", $plist->pkgname
- if $state->{problems};
$state->{totsize} = 1 if $state->{totsize} == 0;
$plist->{totsize} = $state->{totsize};
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index e532dcb6bbc..0a33d330127 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.48 2007/05/28 12:16:55 espie Exp $
+# $OpenBSD: Delete.pm,v 1.49 2007/05/28 13:00:05 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -106,11 +106,8 @@ sub validate_plist
{
my ($plist, $state) = @_;
- $state->{problems} = 0;
$state->{totsize} = 0;
$plist->prepare_for_deletion($state, $plist->pkgname);
- Fatal "fatal issues in deinstalling ", $plist->pkgname
- if $state->{problems};
$state->{totsize} = 1 if $state->{totsize} == 0;
$plist->{totsize} = $state->{totsize};
}
@@ -140,7 +137,10 @@ sub delete_package
Fatal "Package $pkgname real name does not match";
}
+ $state->{problems} = 0;
validate_plist($plist, $state);
+ Fatal "fatal issues in deinstalling $pkgname"
+ if $state->{problems};
OpenBSD::Vstat::synchronize();
delete_plist($plist, $state);
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
index 0af1ffb1559..b0bb20e4ad7 100644
--- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Vstat.pm,v 1.27 2007/05/28 12:16:55 espie Exp $
+# $OpenBSD: Vstat.pm,v 1.28 2007/05/28 13:00:05 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -343,16 +343,46 @@ sub older
return @l;
}
+sub print
+{
+ my $self = shift;
+ my @l = ();
+ if (defined $self->{newer}) {
+ push(@l, "installing", map {$_->{pkgname}} $self->newer);
+ }
+ if (defined $self->{older} && @{$self->{older}} > 0) {
+ push(@l, "deinstalling", map {$_->{pkgname}} $self->older);
+ }
+ return join(' ', @l);
+}
+
sub validate_plists
{
my ($self, $state) = @_;
+ $state->{problems} = 0;
+
for my $o ($self->older) {
require OpenBSD::Delete;
- OpenBSD::Delete::validate_plist($o->{plist}, $state);
+ $o->{totsize} =
+ OpenBSD::Delete::validate_plist($o->{plist}, $state);
}
+ $state->{colliding} = [];
for my $n ($self->newer) {
require OpenBSD::Add;
- OpenBSD::Add::validate_plist($n->{plist}, $state);
+ $n->{totsize} =
+ OpenBSD::Add::validate_plist($n->{plist}, $state);
+ }
+ if (@{$state->{colliding}} > 0) {
+ require OpenBSD::CollisionReport;
+
+ OpenBSD::CollisionReport::collision_report($state->{colliding}, $state);
+ }
+ if (defined $state->{overflow}) {
+ OpenBSD::Vstat::tally();
+ }
+ if ($state->{problems}) {
+ require OpenBSD::Error;
+ OpenBSD::Error::Fatal "fatal issues in ", $self->print;
}
OpenBSD::Vstat::synchronize();
}