summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/Vstat.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-30 14:04:52 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-30 14:04:52 +0000
commite56a906b41f6a38ce9beeb3f0208dc449668f3ba (patch)
tree3380608fede29f19c94479b8dfbd94ad45d9dfdc /usr.sbin/pkg_add/OpenBSD/Vstat.pm
parentba627c41a7bc412d55590a52ed12eab5be412606 (diff)
simplify really_add to use real visitors for extraction and installation.
Just do one single try {} catchall {} per-method, as this is enough. New methods: extract_and_progress, install_and_progress, that catch interrupts (die) deal with fake, and handle the progress meter. One single method: mark_progress, can be used for extraction, installation and deletion.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Vstat.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Vstat.pm17
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
index 6ec2a02bc25..961d19c6cd0 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.29 2007/05/29 10:40:20 espie Exp $
+# $OpenBSD: Vstat.pm,v 1.30 2007/05/30 14:04:51 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -398,4 +398,19 @@ sub handle
}
}
+package OpenBSD::PackingElement;
+sub mark_progress
+{
+}
+
+package OpenBSD::PackingElement::FileBase;
+sub mark_progress
+{
+ my ($self, $donesize, $totsize) = @_;
+ return unless defined $self->{size};
+ require OpenBSD::ProgressMeter;
+ $$donesize += $self->{size};
+ OpenBSD::ProgressMeter::show($$donesize, $totsize);
+}
+
1;