summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2003-10-19 18:40:12 +0000
committerMarc Espie <espie@cvs.openbsd.org>2003-10-19 18:40:12 +0000
commitabe181f52c99fdefce3019bd343c5867ed96a33f (patch)
tree999ce5598402bb4dbd17250141c6894dbc4c674a /usr.sbin
parent8e124d028195fc07c59d76f956b84e0480cc4ace (diff)
Add is_stem, findstem and use them in pkg_info.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/pkg_info15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info
index 45241a46420..ddc64e0b5f7 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.1 2003/10/16 17:43:34 espie Exp $
+# $OpenBSD: pkg_info,v 1.2 2003/10/19 18:40:11 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -28,6 +28,7 @@
use strict;
use warnings;
use OpenBSD::PackageInfo;
+use OpenBSD::PackageName;
use Getopt::Std;
use File::Copy;
# XXX we don't want to load these packages all the time
@@ -100,6 +101,18 @@ if (@ARGV == 0) {
for my $pkg (@ARGV) {
my $dir = installed_info($pkg);
unless (-d $dir) {
+ if (OpenBSD::PackageName::is_stem($pkg)) {
+ my @l = OpenBSD::PackageName::findstem($pkg, installed_packages());
+ if (@l == 1) {
+ $dir = installed_info($l[0]);
+ } elsif (@l != 0) {
+ print STDERR "$pkg: ambiguous (", join(" ",@l), ")\n";
+ next;
+ }
+ }
+ }
+
+ unless (-d $dir) {
my $true_package = OpenBSD::PackageLocator->find($pkg);
next unless $true_package;
$dir = $true_package->info();