summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/pkg_info
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-01-16 11:16:24 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-01-16 11:16:24 +0000
commitcb414a18f7738fc2d2a41903019f370ee2e3e66a (patch)
treed798f51b8c47fb6d4042307076b6af44f49699dc /usr.sbin/pkg_add/pkg_info
parent75a02b58e8e5c9ebf697c1d103102247f359c4dd (diff)
allow locking of database in quiet mode, where we don't display any
message. Display the lock message on stderr anyways, so that we don't disturb normal displays. postpone locking after we know about -q in pkg_info's case. Display command line if pkg_create fails, so that we can see what arguments it found in bsd.port.mk.
Diffstat (limited to 'usr.sbin/pkg_add/pkg_info')
-rw-r--r--usr.sbin/pkg_add/pkg_info8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info
index 3ca83cb2f60..a9bbd4779cf 100644
--- a/usr.sbin/pkg_add/pkg_info
+++ b/usr.sbin/pkg_add/pkg_info
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_info,v 1.27 2005/01/14 02:25:12 espie Exp $
+# $OpenBSD: pkg_info,v 1.28 2005/01/16 11:16:23 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -247,13 +247,15 @@ sub print_info
set_usage('pkg_info [-cDdfIiKkLMpqRrsUv] [-E fname] [-e pkgname] [-l str] pkgname...', 'pkg_info [-Aa flags]');
-lock_db(1);
+my $locked;
try {
getopts('cDdfhIikKLmpqRrsvhe:E:MU:l:aA',
{'e' =>
sub {
my $pat = shift;
my @list;
+ lock_db(1, $opt_q);
+ $locked = 1;
if ($pat =~ m/\//) {
@list = find_by_path($pat);
} else {
@@ -278,6 +280,8 @@ try {
Usage($_);
};
+lock_db(1, $opt_q) unless $locked;
+
if ($opt_D) {
$opt_M = 1;
}