diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2007-05-27 22:18:15 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2007-05-27 22:18:15 +0000 |
commit | 5f95645341c1e5c8b2c77756fb94a54ff5b70d4f (patch) | |
tree | 1b5ea101594fe091a9ba7459c03bb6480de2d5cd /usr.sbin | |
parent | b97b0341f458061e500cf047ffec14b97ee535cf (diff) |
move computation of header to a separate function.
slightly more precise comment
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Vstat.pm | 5 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 44 |
2 files changed, 29 insertions, 20 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm index f3463cbb0d6..6ebe056cba0 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.25 2007/05/27 22:04:17 espie Exp $ +# $OpenBSD: Vstat.pm,v 1.26 2007/05/27 22:18:14 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -293,6 +293,9 @@ sub newer sub older { my $self = shift; + # XXX in `combined' updates, some dependencies may remove extra + # packages, so we do a double-take on the list of packages we + # are actually replacing... for now, until we merge update sets. require OpenBSD::PackageInfo; my @l = (); for my $h (@{$self->{older}}) { diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index ddc6293f10c..cbdfefd020c 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.280 2007/05/27 22:04:17 espie Exp $ +# $OpenBSD: pkg_add,v 1.281 2007/05/27 22:18:14 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -103,6 +103,27 @@ sub actual_replacements return map {$_->{plist}} $set->older; } +sub setup_header +{ + my ($set, $state) = @_; + + my $pkgname = $set->handle->{pkgname}; + + my $header = $state->deptree_header($pkgname).$pkgname; + my @toreplace = $set->older; + if (@toreplace) { + $header.=" (replacing ". join(', ', (map {$_->{pkgname}} @toreplace)). ")"; + } + if (!OpenBSD::ProgressMeter::set_header($header)) { + print $state->{not} ? "Pretending to add " : "Adding "; + print $header; + if ($state->{do_faked}) { + print " under ", $state->{destdir}; + } + print "\n"; + } +} + package main; sub can_install { @@ -303,6 +324,8 @@ sub really_add $state->{dir} = $plist->{dir}; $state->set_pkgname($pkgname); + $set->setup_header($state); + # XXX in `combined' updates, some dependencies may remove extra # packages, so we do a double-take on the list of packages we # are actually replacing. @@ -316,21 +339,6 @@ sub really_add # } $state->{replacing} = $replacing; - my $header = $pkgname; - - $header = $state->deptree_header($pkgname).$header; - if (@toreplace) { - $header.=" (replacing ". join(', ', (map {$_->pkgname} @toreplace)). ")"; - } - if (!OpenBSD::ProgressMeter::set_header($header)) { - print $state->{not} ? "Pretending to add " : "Adding "; - print $header; - if ($state->{do_faked}) { - print " under ", $state->{destdir}; - } - print "\n"; - } - $set->validate_plists($state); my $totsize = $plist->{totsize}; @@ -356,9 +364,7 @@ sub really_add OpenBSD::ProgressMeter::set_header("$pkgname (extracting)"); - if (@toreplace) { - OpenBSD::Replace::save_old_libraries($plist, $state); - } + OpenBSD::Replace::save_old_libraries($plist, $state); my $donesize = 0; $plist->{done} = []; |