diff options
author | 2007-05-27 22:18:14 +0000 | |
---|---|---|
committer | 2007-05-27 22:18:14 +0000 | |
commit | 380871dffb12f24e1717f1712b5f27a4b0c6e859 (patch) | |
tree | ece49c706cdb126541d9f0f4917af88e24db7509 | |
parent | move packing-list validation to the UpdateSet level. (diff) | |
download | wireguard-openbsd-380871dffb12f24e1717f1712b5f27a4b0c6e859.tar.xz wireguard-openbsd-380871dffb12f24e1717f1712b5f27a4b0c6e859.zip |
move computation of header to a separate function.
slightly more precise comment
-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} = []; |