summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/Update.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-06-01 14:58:30 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-06-01 14:58:30 +0000
commit34efd479fa8bad945ccf900ff7b2ea62520b5ab9 (patch)
tree45fa87d5e13357c168aceffa96b66199b0fd125e /usr.sbin/pkg_add/OpenBSD/Update.pm
parent323bb16b2bd94d254e8211d526fa04629fb1aec7 (diff)
refactor ProgressMeter code to create objects, put these into state.
Create a common state class for delete and add, put the progressmeter creation in there. neat effect: we don't have a progressmeter, we use a stub class instead and *never* pull the code in at all.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Update.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm15
1 files changed, 7 insertions, 8 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index 023fd165487..61d7d1212f5 100644
--- a/usr.sbin/pkg_add/OpenBSD/Update.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Update.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Update.pm,v 1.77 2007/05/14 11:22:00 espie Exp $
+# $OpenBSD: Update.pm,v 1.78 2007/06/01 14:58:29 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -18,7 +18,6 @@ use strict;
use warnings;
package OpenBSD::Update;
-use OpenBSD::ProgressMeter;
use OpenBSD::Interactive;
use OpenBSD::PackageInfo;
use OpenBSD::PackageLocator;
@@ -59,7 +58,7 @@ sub process_package
{
my ($self, $pkgname, $state) = @_;
if ($pkgname =~ m/^(?:\.libs|partial)\-/) {
- OpenBSD::ProgressMeter::clear();
+ $state->progress->clear;
print "Not updating $pkgname, remember to clean it\n";
return;
}
@@ -128,7 +127,7 @@ sub process_package
}
if (@l == 1) {
if ($state->{forced}->{pkgpath}) {
- OpenBSD::ProgressMeter::clear();
+ $state->progress->clear;
print "Directly updating $pkgname -> ", $l[0], "\n";
$self->add2updates($l[0]);
return;
@@ -136,13 +135,13 @@ sub process_package
if (defined $found && $found eq $l[0] &&
!$plist->uses_old_libs) {
my $msg = "No need to update $pkgname";
- OpenBSD::ProgressMeter::message($msg);
+ $state->progress->message($msg);
print "$msg\n" if $state->{beverbose};
return;
}
}
- OpenBSD::ProgressMeter::clear();
+ $state->progress->clear;
print "Candidates for updating $pkgname -> ", join(' ', @l), "\n";
if (@l == 1) {
@@ -175,11 +174,11 @@ sub process
@list = OpenBSD::Requiring->compute_closure(@list);
}
- OpenBSD::ProgressMeter::set_header("Looking for updates");
+ $state->progress->set_header("Looking for updates");
for my $pkgname (@list) {
$self->process_package($pkgname, $state);
}
- OpenBSD::ProgressMeter::next();
+ $state->progress->next;
}
1;