simplify progressmeter calls to visit_and: we retrieve the state from the
authorespie <espie@openbsd.org>
Mon, 18 May 2015 10:41:19 +0000 (10:41 +0000)
committerespie <espie@openbsd.org>
Mon, 18 May 2015 10:41:19 +0000 (10:41 +0000)
progressmeter object

usr.sbin/pkg_add/OpenBSD/Add.pm
usr.sbin/pkg_add/OpenBSD/Delete.pm
usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm
usr.sbin/pkg_add/OpenBSD/ProgressMeter/Term.pm

index a2ab99d..a9fc006 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.165 2015/03/29 09:42:58 espie Exp $
+# $OpenBSD: Add.pm,v 1.166 2015/05/18 10:41:19 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
 #
@@ -101,7 +101,7 @@ sub perform_installation
        my ($handle, $state) = @_;
 
        $state->{partial} = $handle->{partial};
-       $state->progress->visit_with_size($handle->{plist}, 'install', $state);
+       $state->progress->visit_with_size($handle->{plist}, 'install');
        if ($handle->{location}{early_close}) {
                $handle->{location}->close_now;
        } else {
index 62a1098..84dc069 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: Delete.pm,v 1.142 2014/11/30 15:53:26 espie Exp $
+# $OpenBSD: Delete.pm,v 1.143 2015/05/18 10:41:19 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
 #
@@ -142,7 +142,7 @@ sub delete_plist
        if (!$state->{size_only}) {
                $plist->register_manpage($state, 'rmman');
                manpages_unindex($state);
-               $state->progress->visit_with_size($plist, 'delete', $state);
+               $state->progress->visit_with_size($plist, 'delete');
        }
 
        unregister_dependencies($plist, $state);
index 82f1198..cf48e51 100644 (file)
@@ -1,6 +1,6 @@
 #! /usr/bin/perl
 # ex:ts=8 sw=4:
-# $OpenBSD: PkgCreate.pm,v 1.115 2015/05/18 10:37:12 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.116 2015/05/18 10:41:20 espie Exp $
 #
 # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
 #
@@ -1257,7 +1257,7 @@ sub make_plist_with_sum
 {
        my ($self, $state, $plist) = @_;
        my $p2 = OpenBSD::PackingList->new;
-       $state->progress->visit_with_count($plist, 'makesum_plist', $state, $p2);
+       $state->progress->visit_with_count($plist, 'makesum_plist', $p2);
        $p2->set_infodir($plist->infodir);
        return $p2;
 }
@@ -1499,7 +1499,7 @@ sub parse_and_run
                $self->check_dependencies($plist, $state);
                $state->set_status("checksumming");
                if ($regen_package) {
-                       $state->progress->visit_with_count($plist, 'verify_checksum', $state);
+                       $state->progress->visit_with_count($plist, 'verify_checksum');
                } else {
                        $plist = $self->make_plist_with_sum($state, $plist);
                }
index 241f4f2..6265ab9 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: ProgressMeter.pm,v 1.46 2015/05/18 10:25:10 espie Exp $
+# $OpenBSD: ProgressMeter.pm,v 1.47 2015/05/18 10:41:20 espie Exp $
 #
 # Copyright (c) 2010 Marc Espie <espie@openbsd.org>
 #
@@ -104,7 +104,7 @@ sub ntogo
 sub visit_with_size
 {
        my ($progress, $plist, $method, @r) = @_;
-       $plist->$method(@r);
+       $plist->$method($progress->{state}, @r);
 }
 
 sub visit_with_count
index d0ded47..39b8838 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: Term.pm,v 1.31 2015/05/18 10:25:10 espie Exp $
+# $OpenBSD: Term.pm,v 1.32 2015/05/18 10:41:20 espie Exp $
 #
 # Copyright (c) 2004-2007 Marc Espie <espie@openbsd.org>
 #
@@ -60,7 +60,7 @@ sub compute_count
 
 sub visit_with_size
 {
-       my ($progress, $plist, $method, $state, @r) = @_;
+       my ($progress, $plist, $method, @r) = @_;
        my $p = $progress->new_sizer($plist);
        $plist->size_and($p, $method, $progress->{state}, @r);
 }
@@ -77,7 +77,7 @@ sub visit_with_count
        my $count = 0;
        $progress->show($count, $plist->{total});
        $plist->count_and($progress, \$count, $plist->{total},
-           $method, @r);
+           $method, $progress->{state}, @r);
 }
 
 package OpenBSD::ProgressMeter::Term;