diff options
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 27 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 6 |
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"; |