summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageInfo.pm19
-rw-r--r--usr.sbin/pkg_add/pkg_delete4
2 files changed, 18 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
index e562aa00450..9833c0f6a86 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: PackageInfo.pm,v 1.1 2003/10/16 17:43:34 espie Exp $
+# $OpenBSD: PackageInfo.pm,v 1.2 2003/11/06 17:49:31 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -27,7 +27,7 @@ use strict;
use warnings;
package OpenBSD::PackageInfo;
our @ISA=qw(Exporter);
-our @EXPORT=qw(installed_packages installed_info info_names is_info_name
+our @EXPORT=qw(installed_packages installed_info installed_name info_names is_info_name
add_installed is_installed CONTENTS COMMENT DESC INSTALL DEINSTALL REQUIRE
REQUIRED_BY DISPLAY MTREE_DIRS);
@@ -89,7 +89,12 @@ sub installed_packages()
sub installed_info($)
{
my $name = shift;
- return "$pkg_db/$name/";
+
+ if ($name =~ m|^\Q$pkg_db\E/?|) {
+ return "$name/";
+ } else {
+ return "$pkg_db/$name/";
+ }
}
sub is_installed($)
@@ -101,6 +106,14 @@ sub is_installed($)
return $dir;
}
+sub installed_name($)
+{
+ my $name = shift;
+ $name =~ s|/$||;
+ $name =~ s|^\Q$pkg_db\E/?||;
+ return $name;
+}
+
sub info_names()
{
return @info;
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete
index 635d38e880b..47546600625 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.9 2003/11/04 17:55:17 espie Exp $
+# $OpenBSD: pkg_delete,v 1.10 2003/11/06 17:49:31 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -333,7 +333,7 @@ for my $pkgname (@ARGV) {
}
}
next unless is_installed($pkgname);
- push(@realnames, $pkgname);
+ push(@realnames, installed_name($pkgname));
}
# Then check that dependencies are okay