diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-02-24 18:45:12 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-02-24 18:45:12 +0000 |
commit | f253be8e096d25b45b7215abb2fe352085c439d1 (patch) | |
tree | c7b99bcc9f8ddcfbb6f399fd371eec09575cab84 /usr.sbin | |
parent | f9fbfbf829223da29f9bceee5878ac57f54d43ad (diff) |
UI improvement: in case the disk overflows, let tally give information
about the extra size needed. In validate, mark the overflow and call tally
later.
.e.g.,
Error: /dev/wd0f is not large enough (/usr/local/lib/libkparts.so.4.0.0)
Error: /dev/wd0f is not large enough (/usr/local/lib/libkrosscore.so.4.0.0)
Error: /dev/wd0f is not large enough (/usr/local/lib/libktexteditor.so.4.0.0)
Error: ... more files do not fit on /dev/wd0f
/dev/wd0h: 97 bytes
/dev/wd0f: 337090852 bytes (missing 78473 blocks)
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Vstat.pm | 9 |
2 files changed, 14 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index 431736cbb8f..21597ccffaf 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.49 2006/12/05 14:04:19 steven Exp $ +# $OpenBSD: Add.pm,v 1.50 2007/02/24 18:45:11 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -71,6 +71,9 @@ sub validate_plist($$) OpenBSD::CollisionReport::collision_report($colliding, $state); } + if (defined $state->{overflow}) { + OpenBSD::Vstat::tally(); + } Fatal "fatal issues in installing $pkgname" if $problems; $totsize = 1 if $totsize == 0; return $totsize; @@ -319,6 +322,7 @@ sub validate Warn "Error: ... more files do not fit on ", $s->{dev}, "\n"; } + $state->{overflow} = 1; $$problems++; } } @@ -451,6 +455,7 @@ sub validate Warn "Error: ... more files do not fit on ", $s->{dev}, "\n"; } + $state->{overflow} = 1; $$problems++; } } @@ -623,6 +628,7 @@ sub validate } if ($s->avail() < 0) { Warn "Error: ", $s->{dev}, " is not large enough ($fname)\n"; + $state->{overflow} = 1; $$problems++; } } diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm index fe4bd7337a4..d88e198748f 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.14 2006/02/07 10:56:55 espie Exp $ +# $OpenBSD: Vstat.pm,v 1.15 2007/02/24 18:45:11 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -165,7 +165,12 @@ sub tally() { while (my ($device, $data) = each %$devinfo) { if ($data->{used} != 0) { - print $device, ": ", $data->{used}, " bytes\n"; + print $device, ": ", $data->{used}, " bytes"; + my $avail = $data->avail(); + if ($avail < 0) { + print " (missing ", int(-$avail+1), " blocks)"; + } + print "\n"; } } } |