diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-05-30 11:13:36 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-05-30 11:13:36 +0000 |
commit | bef77969179309cc388115cbcafbc28569a546ee (patch) | |
tree | 90b33df9a188c758044267a95aa8a0063d8ac230 | |
parent | a2e6cd3b3be1cfd9721c4664da4acf373536fd42 (diff) |
separate the creation of the borked package and the Fatal.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 19 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingList.pm | 4 |
2 files changed, 15 insertions, 8 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"; } diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index a875fcf5e95..acbc98c7735 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingList.pm,v 1.69 2007/05/29 13:17:48 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.70 2007/05/30 11:13:35 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -69,7 +69,7 @@ sub set_infodir sub infodir { my $self = shift; - return ${$self->{infodir}} + return ${$self->{infodir}}; } sub read |