summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-12-29 13:03:06 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-12-29 13:03:06 +0000
commit2fe6aceb5a332ca15a1371e80002dd4e200a4390 (patch)
tree20226cfab674c46dab1f7d752c1cc351b52e570c /usr.sbin/pkg_add
parentb535eaad07436596fbb5fc44e9b2729d07857346 (diff)
more stuff that uses print directly dies
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm14
-rw-r--r--usr.sbin/pkg_add/OpenBSD/AddDelete.pm6
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageInfo.pm10
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocation.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgAdd.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCheck.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgInfo.pm4
7 files changed, 23 insertions, 23 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index 9f0275086f2..2b9c3c77afd 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.118 2010/12/24 09:09:54 espie Exp $
+# $OpenBSD: Add.pm,v 1.119 2010/12/29 13:03:05 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -50,11 +50,11 @@ sub manpages_index
sub register_installation
{
- my $plist = shift;
- return if $main::not;
+ my ($plist, $state) = @_;
+ return if $state->{not};
my $dest = installed_info($plist->pkgname);
mkdir($dest);
- $plist->copy_info($dest);
+ $plist->copy_info($dest, $state);
$plist->set_infodir($dest);
$plist->to_installation;
}
@@ -687,12 +687,12 @@ sub prepare_for_addition
sub copy_info
{
- my ($self, $dest) = @_;
+ my ($self, $dest, $state) = @_;
require File::Copy;
File::Copy::move($self->fullname, $dest) or
- print STDERR "Problem while moving ", $self->fullname,
- " into $dest: $!\n";
+ $state->errsay("Problem while moving #1 into #2: #3",
+ $self->fullname, $dest, $!);
}
package OpenBSD::PackingElement::FINSTALL;
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
index 0d73727fcf9..20fdc831908 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.43 2010/12/24 09:09:54 espie Exp $
+# $OpenBSD: AddDelete.pm,v 1.44 2010/12/29 13:03:05 espie Exp $
#
# Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org>
#
@@ -58,7 +58,7 @@ sub framework
my ($self, $state) = @_;
my $do = sub {
- lock_db($state->{not}) unless $state->defines('nolock');
+ lock_db($state->{not}, $state) unless $state->defines('nolock');
$state->check_root;
$self->process_parameters($state);
my $dielater = $self->do_the_main_work($state);
@@ -82,7 +82,7 @@ sub framework
try {
&$do;
} catch {
- print STDERR "$0: $_\n";
+ $state->errsay("#1: #2", $0, $_);
OpenBSD::Handler->reset;
if ($_ =~ m/^Caught SIG(\w+)/o) {
kill $1, $$;
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
index 3909f835f35..96daaf67562 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageInfo.pm,v 1.52 2010/12/24 09:04:14 espie Exp $
+# $OpenBSD: PackageInfo.pm,v 1.53 2010/12/29 13:03:05 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -193,17 +193,17 @@ my $dlock;
sub lock_db($;$)
{
- my ($shared, $quiet) = @_;
+ my ($shared, $state) = @_;
my $mode = $shared ? LOCK_SH : LOCK_EX;
open($dlock, '<', $pkg_db) or return;
if (flock($dlock, $mode | LOCK_NB)) {
return;
}
- print STDERR "Package database already locked... awaiting release... "
- unless $quiet;
+ $state->errprint("Package database already locked... awaiting release... ")
+ if defined $state;
while (!flock($dlock, $mode)) {
}
- print STDERR "done!\n" unless $quiet;
+ $state->errsay("done!") if defined $state;
return;
}
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm
index e85e8ddf660..6f2abdfa742 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageLocation.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageLocation.pm,v 1.27 2010/12/24 09:04:14 espie Exp $
+# $OpenBSD: PackageLocation.pm,v 1.28 2010/12/29 13:03:05 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -194,7 +194,7 @@ sub grab_info
if ($@) {
unlink($e->{name});
$@ =~ s/\s+at.*//o;
- print STDERR $@;
+ $self->{state}->errprint('#1', $@);
return 0;
}
} else {
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
index e6b6fca68eb..e4b67d494b0 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgAdd.pm,v 1.19 2010/12/24 10:31:59 espie Exp $
+# $OpenBSD: PkgAdd.pm,v 1.20 2010/12/29 13:03:05 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -790,7 +790,7 @@ sub really_add
OpenBSD::SharedLibs::add_libs_from_plist($plist, $state);
OpenBSD::Add::tweak_plist_status($plist, $state);
$plist->to_cache;
- OpenBSD::Add::register_installation($plist);
+ OpenBSD::Add::register_installation($plist, $state);
add_installed($pkgname);
delete $handle->{partial};
OpenBSD::PkgCfl::register($plist, $state);
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm b/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm
index d1829224290..eface7321fe 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgCheck.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgCheck.pm,v 1.27 2010/12/24 10:31:59 espie Exp $
+# $OpenBSD: PkgCheck.pm,v 1.28 2010/12/29 13:03:05 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -630,7 +630,7 @@ sub parse_and_run
if (@ARGV != 0) {
$state->usage;
}
- lock_db(0) unless $state->{subst}->value('nolock');
+ lock_db(0, $state) unless $state->{subst}->value('nolock');
$self->run($state);
return 0;
}
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
index 2db34ca21e7..4633b96a79f 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgInfo.pm,v 1.18 2010/12/24 09:04:14 espie Exp $
+# $OpenBSD: PkgInfo.pm,v 1.19 2010/12/29 13:03:05 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -69,7 +69,7 @@ sub lock
my $state = shift;
return if $state->{locked};
return if $state->{subst}->value('nolock');
- lock_db(1, $state->opt('q'));
+ lock_db(1, $state->opt('q') ? undef : $state);
$state->{locked} = 1;
}