summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm26
-rw-r--r--usr.sbin/pkg_add/OpenBSD/AddDelete.pm36
-rw-r--r--usr.sbin/pkg_add/OpenBSD/CollisionReport.pm6
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm22
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Dependencies.pm18
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Handle.pm6
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm11
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Replace.pm22
-rw-r--r--usr.sbin/pkg_add/OpenBSD/SharedItems.pm12
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm6
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Vstat.pm6
-rw-r--r--usr.sbin/pkg_add/OpenBSD/x509.pm4
-rw-r--r--usr.sbin/pkg_add/pkg_add45
-rw-r--r--usr.sbin/pkg_add/pkg_delete18
14 files changed, 144 insertions, 94 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index 9a090c899bd..c599aa40c96 100644
--- a/usr.sbin/pkg_add/OpenBSD/Add.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Add.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.100 2009/12/17 11:57:02 espie Exp $
+# $OpenBSD: Add.pm,v 1.101 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -35,7 +35,7 @@ sub manpages_index
while (my ($k, $v) = each %{$state->{mandirs}}) {
my @l = map { $destdir.$_ } @$v;
if ($state->{not}) {
- $state->say("Merging manpages in $destdir$k: ", join(@l)) if $state->{verbose};
+ $state->say("Merging manpages in $destdir$k: ", join(@l)) if $state->verbose >= 2;
} else {
try {
OpenBSD::Makewhatis::merge($destdir.$k, \@l);
@@ -284,11 +284,11 @@ sub install
my ($self, $state) = @_;
$self->SUPER::install($state);
my $auth = $self->name;
- $state->say("adding ", $self->type, " ", $auth) if $state->{verbose};
+ $state->say("adding ", $self->type, " ", $auth) if $state->verbose >= 2;
return if $state->{not};
return if defined $self->{okay};
my $l=[];
- push(@$l, "-v") if $state->{very_verbose};
+ push(@$l, "-v") if $state->verbose >= 2;
$self->build_args($l);
$state->vsystem($self->command,, @$l, '--', $auth);
}
@@ -340,7 +340,7 @@ sub install
return;
}
if ($state->{not}) {
- $state->say("sysctl -w $name != ". $self->{value});
+ $state->say("sysctl -w $name != ". $self->{value}) if $state->verbose >= 2;
return;
}
$state->vsystem(OpenBSD::Paths->sysctl, '--', $name.'='.$self->{value});
@@ -388,7 +388,7 @@ sub install
if ($state->{replacing}) {
if ($state->{not}) {
- $state->say("moving tempfile -> $destdir$fullname") if $state->{very_verbose};
+ $state->say("moving tempfile -> $destdir$fullname") if $state->verbose >= 5;
return;
}
File::Path::mkpath(dirname($destdir.$fullname));
@@ -399,13 +399,13 @@ sub install
} else {
rename($self->{tempname}, $destdir.$fullname) or
Fatal "Can't move ", $self->{tempname}, " to $fullname: $!";
- $state->say("moving ", $self->{tempname}, " -> $destdir$fullname") if $state->{very_verbose};
+ $state->say("moving ", $self->{tempname}, " -> $destdir$fullname") if $state->verbose >= 5;
undef $self->{tempname};
}
} else {
my $file = $self->prepare_to_extract($state);
- $state->say("extracting $destdir$fullname") if $state->{very_verbose};
+ $state->say("extracting $destdir$fullname") if $state->verbose >= 5;
if ($state->{not}) {
$state->{archive}->skip;
return;
@@ -508,7 +508,7 @@ sub install
my $orig = $self->{copyfrom};
my $origname = $destdir.$orig->fullname;
if (-e $filename) {
- if ($state->{verbose}) {
+ if ($state->verbose) {
$state->say("The existing file $filename has NOT been changed");
if (defined $orig->{d}) {
@@ -524,13 +524,13 @@ sub install
}
} else {
if ($state->{not}) {
- $state->say("The file $filename would be installed from $origname");
+ $state->say("The file $filename would be installed from $origname") if $state->verbose >= 2;
} else {
if (!copy($origname, $filename)) {
$state->errsay("File $filename could not be installed:\n\t$!");
}
$self->set_modes($filename);
- if ($state->{verbose}) {
+ if ($state->verbose >= 2) {
$state->say("installed $filename from $origname");
}
}
@@ -596,7 +596,7 @@ sub install
print $shells2 $fullname, "\n";
close $shells2;
$state->say("Shell $fullname appended to $destdir",
- OpenBSD::Paths->shells);
+ OpenBSD::Paths->shells) if $state->verbose;
}
package OpenBSD::PackingElement::Dir;
@@ -607,7 +607,7 @@ sub install
my $fullname = $self->fullname;
my $destdir = $state->{destdir};
- $state->say("new directory ", $destdir, $fullname) if $state->{very_verbose};
+ $state->say("new directory ", $destdir, $fullname) if $state->verbose >= 5;
return if $state->{not};
File::Path::mkpath($destdir.$fullname);
$self->set_modes($destdir.$fullname);
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
index 98136795923..7f571fa8f8e 100644
--- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: AddDelete.pm,v 1.8 2009/12/19 14:21:14 espie Exp $
+# $OpenBSD: AddDelete.pm,v 1.9 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org>
#
@@ -20,7 +20,7 @@ our $bad = 0;
our %defines = ();
our $state;
-our ($opt_n, $opt_x, $opt_v, $opt_B, $opt_L, $opt_i, $opt_q, $opt_c, $opt_I);
+our ($opt_n, $opt_x, $opt_v, $opt_B, $opt_L, $opt_i, $opt_q, $opt_c, $opt_I, $opt_s);
$opt_v = 0;
sub handle_options
@@ -36,7 +36,7 @@ sub handle_options
}
};
try {
- getopts('hciInqvxB:f:F:L:'.$opt_string, $hash);
+ getopts('hciInqvsxB:f:F:L:'.$opt_string, $hash);
} catchall {
Usage($_);
};
@@ -44,15 +44,17 @@ sub handle_options
$opt_L = OpenBSD::Paths->localbase unless defined $opt_L;
$state->{recorder} = OpenBSD::SharedItemsRecorder->new;
+ if ($opt_s) {
+ $opt_n = 1;
+ }
$state->{not} = $opt_n;
# XXX RequiredBy
$main::not = $opt_n;
$state->{defines} = \%defines;
- $state->{very_verbose} = $opt_v >= 2;
- $state->{verbose} = $opt_v;
$state->{interactive} = $opt_i;
- $state->{beverbose} = $opt_n || ($opt_v >= 2);
+ $state->{v} = $opt_v;
$state->{localbase} = $opt_L;
+ $state->{size_only} = $opt_s;
$state->{quick} = $opt_q;
$state->{extra} = $opt_c;
$state->{dont_run_scripts} = $opt_I;
@@ -95,12 +97,12 @@ sub framework
$state->{recorder}->cleanup($state);
OpenBSD::PackingElement::Lib::ensure_ldconfig($state);
OpenBSD::PackingElement::Fontdir::finish_fontdirs($state);
- if ($state->{beverbose}) {
- $state->vstat->tally;
- }
$state->progress->clear;
$state->log->dump;
finish_display();
+ if ($state->verbose >= 2 || $opt_s) {
+ $state->vstat->tally;
+ }
# show any error, and show why we died...
rethrow $dielater;
} catch {
@@ -216,6 +218,7 @@ sub init
$self->{l} = OpenBSD::Log->new;
$self->{vstat} = OpenBSD::MyStat->new;
$self->{progressmeter} = bless {}, "OpenBSD::StubProgress";
+ $self->{v} = 0;
}
sub ntogo
@@ -225,6 +228,11 @@ sub ntogo
return $self->progress->ntogo($self->todo, $offset);
}
+sub verbose
+{
+ return shift->{v};
+}
+
sub vstat
{
return shift->{vstat};
@@ -274,7 +282,7 @@ sub vsystem
{
my $self = shift;
$self->progress->clear;
- OpenBSD::Error::VSystem($self->{very_verbose}, @_);
+ OpenBSD::Error::VSystem($self->verbose >= 2, @_);
}
sub system
@@ -295,7 +303,7 @@ sub unlink
sub setup_progressmeter
{
my ($self, $opt_x) = @_;
- if (!$opt_x && !$self->{beverbose}) {
+ if (!$opt_x && $self->verbose) {
require OpenBSD::ProgressMeter;
$self->{progressmeter} = OpenBSD::ProgressMeter->new;
}
@@ -306,7 +314,7 @@ sub check_root
my $state = shift;
if ($< && !$state->{defines}->{nonroot}) {
if ($state->{not}) {
- $state->errsay("$0 should be run as root");
+ $state->errsay("$0 should be run as root") if $state->verbose;
} else {
Fatal "$0 must be run as root";
}
@@ -317,7 +325,7 @@ sub choose_location
{
my ($state, $name, $list, $is_quirks) = @_;
if (@$list == 0) {
- $state->say("Can't find $name") unless $is_quirks;
+ $state->errsay("Can't find $name") unless $is_quirks;
return undef;
} elsif (@$list == 1) {
return $list->[0];
@@ -332,7 +340,7 @@ sub choose_location
my $result = OpenBSD::Interactive::ask_list("Ambiguous: choose package for $name", 1, sort keys %h);
return $h{$result};
} else {
- $state->say("Ambiguous: $name could be ", join(' ', keys %h));
+ $state->errsay("Ambiguous: $name could be ", join(' ', keys %h));
return undef;
}
}
diff --git a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm
index 0413b8ec696..00df272e7e4 100644
--- a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm
+++ b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: CollisionReport.pm,v 1.28 2009/11/17 10:17:21 espie Exp $
+# $OpenBSD: CollisionReport.pm,v 1.29 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org>
#
@@ -25,7 +25,7 @@ use OpenBSD::PackageInfo;
sub find_collisions
{
my ($todo, $state) = @_;
- my $verbose = $state->{verbose};
+ my $verbose = $state->verbose >= 3;
my $bypkg = {};
for my $name (keys %$todo) {
my $p = $state->vstat->exists($name);
@@ -132,7 +132,7 @@ sub collision_report($$)
if ($dorepair == 1) {
for my $f (@$list) {
- if ($state->unlink($state->{verbose},
+ if ($state->unlink($state->verbose >= 2,
$destdir.$f->fullname)) {
$state->{problems}--;
} else {
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index 3eb10aab77b..456c15e1d45 100644
--- a/usr.sbin/pkg_add/OpenBSD/Delete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Delete.pm,v 1.93 2009/12/17 11:57:02 espie Exp $
+# $OpenBSD: Delete.pm,v 1.94 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -49,7 +49,7 @@ sub manpages_unindex
while (my ($k, $v) = each %{$state->{mandirs}}) {
my @l = map { $destdir.$_ } @$v;
if ($state->{not}) {
- $state->say("Removing manpages in $destdir$k: ", join(@l)) if $state->{verbose};
+ $state->say("Removing manpages in $destdir$k: ", join(@l)) if $state->verbose >= 2;
} else {
eval { OpenBSD::Makewhatis::remove($destdir.$k, \@l); };
if ($@) {
@@ -127,7 +127,7 @@ sub unregister_dependencies
for my $name (OpenBSD::Requiring->new($pkgname)->list) {
$state->say("remove dependency on $name")
- if $state->{very_verbose} or $state->{not};
+ if $state->verbose >= 3;
local $@;
try {
OpenBSD::RequiredBy->new($name)->delete($pkgname);
@@ -278,7 +278,7 @@ sub delete
{
my ($self, $state) = @_;
- if ($state->{beverbose}) {
+ if ($state->verbose >= 2) {
$state->say("rmuser: ", $self->name);
}
@@ -296,7 +296,7 @@ sub delete
{
my ($self, $state) = @_;
- if ($state->{beverbose}) {
+ if ($state->verbose >= 2) {
$state->say("rmgroup: ", $self->name);
}
@@ -321,7 +321,7 @@ sub delete
{
my ($self, $state) = @_;
- if ($state->{very_verbose}) {
+ if ($state->verbose >= 5) {
$state->say("rmdir: ", $self->fullname);
}
@@ -424,7 +424,7 @@ sub delete
}
}
}
- if ($state->{very_verbose}) {
+ if ($state->verbose >= 5) {
$state->say("deleting: $realname");
}
return if $state->{not};
@@ -533,7 +533,7 @@ sub delete
} else {
my $d = $self->compute_digest($realname, $orig->{d});
if ($d->equals($orig->{d})) {
- $state->say("File $realname identical to sample") if $state->{not} or $state->{verbose};
+ $state->say("File $realname identical to sample") if $state->verbose >= 2;
} else {
unless ($state->{extra}) {
$self->mark_dir($state);
@@ -542,8 +542,8 @@ sub delete
}
}
}
+ $state->say("deleting $realname") if $state->verbose >= 2;
return if $state->{not};
- $state->say("deleting $realname") if $state->{verbose};
if (!unlink $realname) {
$state->say("Problem deleting $realname");
$state->log("deleting $realname failed: $!\n");
@@ -587,7 +587,7 @@ sub delete
print $shells2 @l;
close $shells2;
$state->say("Shell $fullname removed from $destdir",
- OpenBSD::Paths->shells);
+ OpenBSD::Paths->shells) if $state->verbose;
}
}
$self->SUPER::delete($state);
@@ -600,7 +600,7 @@ sub delete
{
my ($self, $state) = @_;
my $realname = $self->realname($state);
- if ($state->{beverbose} && $state->{extra}) {
+ if ($state->verbose >= 2 && $state->{extra}) {
$state->say("deleting extra file: $realname");
}
return if $state->{not};
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
index e9bf37e9c6e..6707e4fd50b 100644
--- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Dependencies.pm,v 1.98 2009/12/13 17:54:15 espie Exp $
+# $OpenBSD: Dependencies.pm,v 1.99 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org>
#
@@ -87,7 +87,7 @@ sub find_in_already_done
$self->{known});
if ($r) {
$state->say("found libspec $obj in package $r")
- if $state->{verbose};
+ if $state->verbose >= 3;
return $r;
} else {
return undef;
@@ -103,7 +103,7 @@ sub find_in_extra_sources
for my $dir (OpenBSD::SharedLibs::system_dirs()) {
if ($solver->check_lib_spec($dir, $obj, {system => 1})) {
$state->say("found libspec $obj in $dir/lib")
- if $state->{verbose};
+ if $state->verbose >= 3;
return 'system';
}
}
@@ -122,7 +122,7 @@ sub find_in_new_source
if ($solver->check_lib_spec($solver->{localbase}, $obj,
{$dep => 1})) {
$state->say("found libspec $obj in package $dep")
- if $state->{verbose};
+ if $state->verbose >= 3;
return $dep;
}
return undef;
@@ -138,7 +138,7 @@ sub find_elsewhere
$solver->{localbase}, $dep->{pattern}, $obj);
if ($r) {
$state->say("found libspec $obj in old package $r")
- if $state->{verbose};
+ if $state->verbose;
return $r;
}
}
@@ -161,7 +161,7 @@ sub find_in_already_done
my ($self, $solver, $state, $obj) = @_;
my $r = $self->{known_tags}->{$obj};
if (defined $r) {
- $state->say("Found tag $obj in $r") if $state->{verbose};
+ $state->say("Found tag $obj in $r") if $state->verbose >= 3;
}
return $r;
}
@@ -427,15 +427,15 @@ sub adjust_old_dependency_on
my $oldname = $o->pkgname;
$state->say("Adjusting dependencies for ",
- "$oldname->$pkgname") if $state->{beverbose};
+ "$oldname->$pkgname") if $state->verbose >= 3;
my $d = OpenBSD::RequiredBy->new($pkgname);
for my $dep (@{$o->{wantlist}}) {
if (defined $set->{older}->{$dep}) {
$state->say("\tskipping $dep")
- if $state->{beverbose};
+ if $state->verbose >= 4;
next;
}
- $state->say("\t$dep") if $state->{beverbose};
+ $state->say("\t$dep") if $state->verbose >= 4;
$d->add($dep);
OpenBSD::Replace::adjust_dependency($dep,
$oldname, $pkgname) if $oldname ne $pkgname;
diff --git a/usr.sbin/pkg_add/OpenBSD/Handle.pm b/usr.sbin/pkg_add/OpenBSD/Handle.pm
index ba9864c6e5c..9cdb1a1866b 100644
--- a/usr.sbin/pkg_add/OpenBSD/Handle.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Handle.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Handle.pm,v 1.12 2009/11/28 12:50:25 espie Exp $
+# $OpenBSD: Handle.pm,v 1.13 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org>
#
@@ -179,7 +179,7 @@ sub get_plist
my $location = $handle->{location};
my $pkg = $handle->pkgname;
- if ($state->{verbose}) {
+ if ($state->verbose >= 2) {
$state->say($state->deptree_header($pkg), "parsing $pkg");
}
my $plist = $location->grabPlist;
@@ -207,7 +207,7 @@ sub get_plist
$handle->{tweaked} =
OpenBSD::Add::tweak_package_status($pkgname, $state);
$state->say("Not reinstalling $pkgname")
- if $state->{verbose} and !$handle->{tweaked};
+ if $state->verbose >= 2 and !$handle->{tweaked};
$state->tracker->{installed}->{$pkgname} = 1;
$location->close_now;
$location->wipe_info;
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index 1b0f04d972a..c9c5e0604a1 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.164 2009/12/17 11:57:02 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.165 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -409,7 +409,7 @@ sub check_digest
$state->log->fatal("checksum for ", $self->fullname,
" does not match");
}
- if ($state->{very_verbose}) {
+ if ($state->verbose >= 3) {
$state->say("Checksum match for ", $self->fullname);
}
}
@@ -1196,7 +1196,7 @@ sub run
OpenBSD::PackingElement::Lib::ensure_ldconfig($state);
$state->say($self->keyword, " ", $self->{expanded})
- if $state->{beverbose};
+ if $state->verbose >= 2;
$state->log->system(OpenBSD::Paths->sh, '-c', $self->{expanded})
unless $state->{not};
}
@@ -1503,7 +1503,6 @@ sub run
{
my ($self, $state, @args) = @_;
- my $not = $state->{not};
my $pkgname = $state->{pkgname};
my $name = $self->fullname;
@@ -1511,8 +1510,8 @@ sub run
OpenBSD::PackingElement::Lib::ensure_ldconfig($state);
$state->say($self->beautify, " script: $name $pkgname ",
- join(' ', @args)) if $state->{beverbose};
- return if $not;
+ join(' ', @args)) if $state->verbose >= 2;
+ return if $state->{not};
chmod 0755, $name;
return if $state->log->system($name, $pkgname, @args) == 0;
if ($state->{defines}->{scripts}) {
diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm
index 348e88227af..7783ec4fc74 100644
--- a/usr.sbin/pkg_add/OpenBSD/Replace.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Replace.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Replace.pm,v 1.61 2009/12/17 08:21:09 espie Exp $
+# $OpenBSD: Replace.pm,v 1.62 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -116,7 +116,7 @@ sub extract
}
if ($state->{not}) {
$state->say("extracting tempfile under $d")
- if $state->{very_verbose};
+ if $state->verbose >= 3;
$state->{archive}->skip;
} else {
if (!-e _) {
@@ -124,7 +124,7 @@ sub extract
}
my ($fh, $tempname) = OpenBSD::Temp::permanent_file($d, "pkg");
- $state->say("extracting $tempname") if $state->{very_verbose};
+ $state->say("extracting $tempname") if $state->verbose >= 3;
$self->{tempname} = $tempname;
# XXX don't apply destdir twice
@@ -145,7 +145,7 @@ sub extract
return if -e $destdir.$fullname;
$self->SUPER::extract($state);
$state->say("new directory ", $destdir, $fullname)
- if $state->{very_verbose};
+ if $state->verbose >= 3;
return if $state->{not};
File::Path::mkpath($destdir.$fullname);
}
@@ -336,7 +336,7 @@ sub can_old_package_be_replaced
}
if (@r) {
$state->say("Verifying dependencies still match for ",
- join(', ', @r)) if $state->{verbose};
+ join(', ', @r)) if $state->verbose >= 2;
for my $wanting (@wantlist) {
my $p2 = OpenBSD::PackingList->from_installation(
$wanting, \&OpenBSD::PackingList::DependOnly);
@@ -415,11 +415,11 @@ sub adjust_depends_closure
my ($oldname, $plist, $state) = @_;
$state->say("Packages that depend on those shared libraries:")
- if $state->{beverbose};
+ if $state->verbose >= 3;
my $write = OpenBSD::RequiredBy->new($plist->pkgname);
for my $pkg (OpenBSD::RequiredBy->compute_closure($oldname)) {
- $state->say("\t", $pkg) if $state->{beverbose};
+ $state->say("\t", $pkg) if $state->verbose >= 3;
$write->add($pkg);
OpenBSD::Requiring->new($pkg)->add($plist->pkgname);
}
@@ -435,7 +435,7 @@ sub do_save_libs
my $stub_name = $stub_list->pkgname;
my $dest = installed_info($stub_name);
$state->say("Keeping them in $stub_name")
- if $state->{verbose};
+ if $state->verbose >= 2;
if ($state->{not}) {
@@ -471,7 +471,7 @@ sub save_libs_from_handle
my $p = {};
$state->say("Looking for changes in shared libraries")
- if $state->{beverbose};
+ if $state->verbose >= 2;
$o->plist->mark_lib($libs, $p);
for my $n ($set->newer) {
$n->plist->unmark_lib($libs, $p);
@@ -482,10 +482,10 @@ sub save_libs_from_handle
if (%$libs) {
$state->say("Libraries to keep: ",
- join(",", sort(keys %$libs))) if $state->{verbose};
+ join(",", sort(keys %$libs))) if $state->verbose >= 2;
do_save_libs($o, $libs, $state);
} else {
- $state->say("No libraries to keep") if $state->{verbose};
+ $state->say("No libraries to keep") if $state->verbose >= 2;
}
}
diff --git a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm
index 76244c4c5a6..010e989c7b0 100644
--- a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm
+++ b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: SharedItems.pm,v 1.17 2009/12/17 11:57:02 espie Exp $
+# $OpenBSD: SharedItems.pm,v 1.18 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -27,14 +27,15 @@ use OpenBSD::Paths;
sub find_items_in_installed_packages
{
- my $progress = shift;
+ my $state = shift;
my $db = OpenBSD::SharedItemsRecorder->new;
my @list = installed_packages();
my $total = @list;
- $progress->set_header("Read shared items");
+ local $SIG{INFO} = sub { $state->say("Read shared items"); };
+ $state->progress->set_header("Read shared items");
my $done = 0;
for my $e (@list) {
- $progress->show($done, $total);
+ $state->progress->show($done, $total);
my $plist = OpenBSD::PackingList->from_installation($e,
\&OpenBSD::PackingList::SharedItemsOnly) or next;
next if !defined $plist;
@@ -48,9 +49,10 @@ sub cleanup
{
my ($recorder, $state) = @_;
- my $remaining = find_items_in_installed_packages($state->progress);
+ my $remaining = find_items_in_installed_packages($state);
$state->progress->clear;
+ local $SIG{INFO} = sub { $state->say("Clean shared items"); };
$state->progress->set_header("Clean shared items");
my $h = $recorder->{dirs};
my $u = $recorder->{users};
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index c65cc94d4fa..48a8cf67c34 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.118 2009/12/14 18:11:26 espie Exp $
+# $OpenBSD: Update.pm,v 1.119 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -74,7 +74,7 @@ sub progress_message
my ($self, $state, $msg) = @_;
$msg .= $state->ntogo;
$state->progress->message($msg);
- $state->say($msg) if $state->{beverbose};
+ $state->say($msg) if $state->verbose >= 2;
}
my $first = 1;
@@ -197,7 +197,7 @@ sub process_handle
}
$state->say("Update candidates: $pkgname -> ",
- join(' ', map {$_->name} @$l), $state->ntogo);
+ join(' ', map {$_->name} @$l), $state->ntogo) if $state->verbose;
my $r = $state->choose_location($pkgname, $l);
if (defined $r) {
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
index 0411ce0f3cb..c5011bad5ab 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.44 2009/11/11 12:21:20 espie Exp $
+# $OpenBSD: Vstat.pm,v 1.45 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -204,7 +204,7 @@ sub report_ro
{
my ($s, $state, $fname) = @_;
- if ($state->{very_verbose} or ++($s->{problems}) < 4) {
+ if ($state->verbose >= 3 or ++($s->{problems}) < 4) {
$state->errsay("Error: ", $s->{dev},
" is read-only ($fname)");
} elsif ($s->{problems} == 4) {
@@ -217,7 +217,7 @@ sub report_overflow
{
my ($s, $state, $fname) = @_;
- if ($state->{very_verbose} or ++($s->{problems}) < 4) {
+ if ($state->verbose >= 3 or ++($s->{problems}) < 4) {
$state->errsay("Error: ", $s->{dev},
" is not large enough ($fname)");
} elsif ($s->{problems} == 4) {
diff --git a/usr.sbin/pkg_add/OpenBSD/x509.pm b/usr.sbin/pkg_add/OpenBSD/x509.pm
index 0a6ff1712e9..532489c0f3c 100644
--- a/usr.sbin/pkg_add/OpenBSD/x509.pm
+++ b/usr.sbin/pkg_add/OpenBSD/x509.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: x509.pm,v 1.3 2009/11/11 11:13:16 espie Exp $
+# $OpenBSD: x509.pm,v 1.4 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -111,7 +111,7 @@ sub check_signature
$state->log->warn("Bad signature");
return 0;
}
- if ($state->{verbose}) {
+ if ($state->verbose >= 2) {
dump_certificate_info($fname2);
}
unlink $fname;
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index d1801eb38a8..070d4d1b247 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.430 2009/12/19 14:21:14 espie Exp $
+# $OpenBSD: pkg_add,v 1.431 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org>
#
@@ -54,7 +54,7 @@ sub has_new_sig
my $n = OpenBSD::PackingList->from_installation($plist->pkgname)->signature;
my $o = $plist->signature;
$state->say("Comparing full signature for ", $plist->pkgname, " \"$o\" vs. \"$n\": ", $n eq $o ? "equal" : "different")
- if $state->{very_verbose};
+ if $state->verbose >= 3;
$plist->{new_sig} = $n ne $o;
}
return $plist->{new_sig};
@@ -145,6 +145,7 @@ sub setup_header
}
if (!$state->progress->set_header($header)) {
+ return unless $state->verbose;
if (!defined $info) {
$header = "Adding $header";
}
@@ -162,6 +163,35 @@ sub setup_header
}
}
+sub status
+{
+ my ($set, $state, $handle, $info) = @_;
+
+ my $header = $state->deptree_header($set);
+ if (defined $handle) {
+ $header .= $handle->pkgname;
+ } else {
+ $header .= $set->print;
+ }
+ if (defined $info) {
+ $header.=" ($info)";
+ }
+
+ if (!defined $info) {
+ $header = "Adding $header";
+ }
+ if (defined $state->{lastheader} &&
+ $header eq $state->{lastheader}) {
+ return;
+ }
+ $state->{lastheader} = $header;
+ $header .= "(pretending) " if $state->{not};
+ if ($state->{do_faked}) {
+ $header .= " under ".$state->{destdir};
+ }
+ $state->say($header);
+}
+
sub complete
{
my ($set, $state) = @_;
@@ -432,6 +462,7 @@ sub really_add
}
$set->setup_header($state);
+ local $SIG{'INFO'} = sub { $set->status($state); };
# XXX in `combined' updates, some dependencies may remove extra
# packages, so we do a double-take on the list of packages we
@@ -465,6 +496,7 @@ sub really_add
if ($replacing) {
for my $handle ($set->newer) {
+ next if $state->{size_only};
$set->setup_header($state, $handle, "extracting");
try {
@@ -486,6 +518,7 @@ sub really_add
$set->{solver}->record_old_dependencies($state);
build_before($set->older_to_do);
iterate($set->older_to_do, sub {
+ return if $state->{size_only};
my $o = shift;
$set->setup_header($state, $o, "deleting");
my $oldname = $o->pkgname;
@@ -511,6 +544,7 @@ sub really_add
my $first = 1;
iterate($set->newer, sub {
+ return if $state->{size_only};
my $handle = shift;
if (!$first) {
@@ -621,7 +655,7 @@ sub install_set
if (!defined $set->{solver}) {
$set->{solver} = OpenBSD::Dependencies::Solver->new($set);
my @deps = $set->{solver}->solve_depends($state);
- if ($state->{verbose}) {
+ if ($state->verbose >= 2) {
$set->{solver}->dump;
}
if (@deps > 0) {
@@ -775,6 +809,7 @@ sub do_quirks
$state->{quirks} = OpenBSD::Quirks->new(1);
};
}
+
sub process_parameters
{
# match fuzzily against a list
@@ -810,9 +845,8 @@ sub process_parameters
push(@todo2, OpenBSD::UpdateSet->new->add_older(OpenBSD::Handle->from_location($l)));
}
}
-
-
} else {
+
# actual names
my $m = $opt_z ? "add_hints" : "add_hints2";
for my $pkgname (@ARGV) {
@@ -856,6 +890,7 @@ sub {
$state->tracker->todo(@todo2);
# This is the actual very small loop that adds all packages
while (my $set = shift @todo2) {
+ local $SIG{INFO} = sub { $state->say($set->print, "(", $state->todo, ")"); };
$state->progress->set_header("Looking for packages");
unshift(@todo2, install_set($set, $state));
eval {
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete
index 96eabcc107d..f7096450c14 100644
--- a/usr.sbin/pkg_add/pkg_delete
+++ b/usr.sbin/pkg_add/pkg_delete
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_delete,v 1.129 2009/12/19 14:21:14 espie Exp $
+# $OpenBSD: pkg_delete,v 1.130 2009/12/20 22:38:45 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -83,7 +83,7 @@ sub process_parameters
@todo = OpenBSD::RequiredBy->compute_closure(@realnames);
if (@todo > @realnames) {
- my $details = $state->{very_verbose} || $defines{verbosedeps};
+ my $details = $state->verbose >= 2 || $defines{verbosedeps};
my $show = sub {
my ($p, $d) = @_;
$state->say("Can't remove ", join(' ', @$p),
@@ -132,7 +132,7 @@ sub {
$state->{todo} = scalar @todo - scalar keys %done;
next if $done{$pkgname};
unless (is_installed($pkgname)) {
- $state->say("$pkgname was not installed");
+ $state->errsay("$pkgname was not installed");
$done{$pkgname} = 1;
$removed++;
next;
@@ -151,10 +151,16 @@ sub {
next;
}
}
- if (!$state->progress->set_header($pkgname)) {
- print $state->{not} ? "Pretending to delete " :
+ my $info = sub {
+ $state->say($state->{not} ?
+ "Pretending to delete " :
"Deleting ",
- "$pkgname\n";
+ $pkgname);
+ };
+
+ local $SIG{'INFO'} = $info;
+ if (!$state->progress->set_header($pkgname)) {
+ &$info if $state->verbose;
}
$state->log->set_context($pkgname);
OpenBSD::Delete::delete_package($pkgname, $state);