summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/Add.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-30 11:13:36 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-30 11:13:36 +0000
commitbef77969179309cc388115cbcafbc28569a546ee (patch)
tree90b33df9a188c758044267a95aa8a0063d8ac230 /usr.sbin/pkg_add/OpenBSD/Add.pm
parenta2e6cd3b3be1cfd9721c4664da4acf373536fd42 (diff)
separate the creation of the borked package and the Fatal.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Add.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm19
1 files changed, 13 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index d88c1690c9a..4ead84d8d46 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.60 2007/05/29 14:39:03 espie Exp $
+# $OpenBSD: Add.pm,v 1.61 2007/05/30 11:13:35 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -66,21 +66,19 @@ sub validate_plist
$plist->{totsize} = $state->{totsize};
}
-sub borked_installation
+sub record_partial_installation
{
- my ($plist, $not, @msg) = @_;
+ my $plist = shift;
- Fatal @msg if $not;
use OpenBSD::PackingElement;
-
my $borked = borked_package($plist->pkgname);
# fix packing list for pkg_delete
$plist->{items} = $plist->{done};
# last file may have not copied correctly
my $last = $plist->{items}->[@{$plist->{items}}-1];
- if ($last->IsFile() && defined($last->{md5})) {
+ if ($last->IsFile && defined($last->{md5})) {
require OpenBSD::md5;
my $old = $last->{md5};
@@ -99,6 +97,15 @@ sub borked_installation
OpenBSD::PackingElement::Cwd->add($plist, '.');
$plist->{name}->{name} = $borked;
register_installation($plist);
+ return $borked;
+}
+
+sub borked_installation
+{
+ my ($plist, $not, @msg) = @_;
+
+ Fatal @msg if $not;
+ my $borked = record_partial_installation($plist);
Fatal @msg, ", partial installation recorded as $borked";
}