summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-08-02 12:08:26 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-08-02 12:08:26 +0000
commitefa379bc32ae3c2e62eda2303fc862a8739b5025 (patch)
tree74013ef37c4b50d2b56700fc87eaf4751a775b48 /usr.sbin/pkg_add
parent913bed0b7b038840f1a3f46d46cf3d1b0866a1a6 (diff)
Reuse first component of @newdepends, @libdepends to contain
a PKG_PATH (easy backward compatibility: is there a slash ?) That's missing info to enable pkg_add to launch package building in the ports tree as an alternate source of binary packages.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm27
-rw-r--r--usr.sbin/pkg_add/pkg_add6
2 files changed, 24 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index fb18e6dd0dd..cf93270fed5 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: PackingElement.pm,v 1.13 2004/07/22 22:23:26 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.14 2004/08/02 12:08:25 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -441,13 +441,21 @@ sub new
{
my ($class, $args) = @_;
my ($name, $pattern, $def) = split /\:/, $args;
- bless { name => $name, pattern => $pattern, def => $def }, $class;
+ my $self = bless { pattern => $pattern, def => $def }, $class;
+ # very old packages still work
+ if ($name =~ m|/|) {
+ $self->{pkgpath} = $name;
+ } else {
+ $self->{name} = $name;
+ }
+ return $self;
}
sub stringize($)
{
my $self = $_[0];
- return $self->{name}.':'.$self->{pattern}.':'.$self->{def};
+ return (defined $self->{name} ? $self->{name} : $self->{pkgpath}).
+ ':'.$self->{pattern}.':'.$self->{def};
}
package OpenBSD::PackingElement::LibDepend;
@@ -462,15 +470,22 @@ sub new
{
my ($class, $args) = @_;
my ($name, $libspec, $pattern, $def) = split /\:/, $args;
- bless { name => $name, libspec => $libspec, pattern => $pattern,
+ my $self = bless { libspec => $libspec, pattern => $pattern,
def => $def }, $class;
+ # very old packages still work
+ if ($name =~ m|/|) {
+ $self->{pkgpath} = $name;
+ } else {
+ $self->{name} = $name;
+ }
+ return $self;
}
sub stringize($)
{
my $self = $_[0];
- return $self->{name}.':'.$self->{libspec}.':'.$self->{pattern}.
- ':'.$self->{def};
+ return (defined $self->{name} ? $self->{name} : $self->{pkgpath}).
+ ':'.$self->{libspec}.':'.$self->{pattern}.':'.$self->{def};
}
package OpenBSD::PackingElement::Unique;
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index e3f6983c4dd..8aea3aa9ebd 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.35 2004/07/20 18:58:41 espie Exp $
+# $OpenBSD: pkg_add,v 1.36 2004/08/02 12:08:25 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -299,7 +299,7 @@ sub solve_dependencies
push(@$to_register, $dep->{name});
}
for my $dep (@{$plist->{newdepend}}, @{$plist->{libdepend}}) {
- next if $dep->{name} ne $plist->pkgname();
+ next if defined $dep->{name} and $dep->{name} ne $plist->pkgname();
my @candidates = OpenBSD::PackageName::pkgspec_match($dep->{pattern}, installed_packages());
if (@candidates >= 1) {
push(@$to_register, $candidates[0]);
@@ -629,7 +629,7 @@ while (my $pkg = shift @todo) {
}
for my $dep (@{$plist->{libdepend}}) {
# can't check libspecs yet
- next if $dep->{name} ne $plist->pkgname();
+ next if defined $dep->{name} and $dep->{name} ne $plist->pkgname();
if (!check_lib_specs($plist->pkgbase(), $dep->{libspec})) {
print "Can't install $pkg: incorrect libspec: ",
$dep->{libspec}, "\n";