summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/Add.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-12-17 11:07:25 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-12-17 11:07:25 +0000
commit1c03ee6c6dcfd52bc84bb4cc3a7b0ed1a9276ed2 (patch)
tree496ca51281d8b1179678fcce660d4a263b4cdf45 /usr.sbin/pkg_add/OpenBSD/Add.pm
parentef49c30e17ef8b26757e4c46b5abf696e6ba0102 (diff)
add a callback to file creation, so that we get progress meter for huge
files in packages. Should affect emacs, chrome and the likes.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Add.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index acccea3603c..0e02e81fdb2 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.98 2009/12/17 08:21:09 espie Exp $
+# $OpenBSD: Add.pm,v 1.99 2009/12/17 11:07:24 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -171,6 +171,10 @@ sub prepare_for_addition
sub install_and_progress
{
my ($self, $state, $donesize, $totsize) = @_;
+ $state->{callback} = sub {
+ my $done = shift;
+ $state->progress->show($$donesize + $done, $totsize);
+ };
unless ($state->{do_faked} && $state->{end_faked}) {
$self->install($state);
}
@@ -406,7 +410,7 @@ sub install
$state->{archive}->skip;
return;
} else {
- $file->create;
+ $file->create($state->{callback});
$self->may_check_digest($file, $state);
}