From b625ec4ca173b166b6eed5bafd2aa02064886be0 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Mon, 14 May 2007 10:43:46 +0000 Subject: name tweaks: match -> match_list, match_repo -> match --- usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 8 +++++--- usr.sbin/pkg_add/OpenBSD/PackageName.pm | 6 +++--- usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm | 6 +++--- usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 6 ++++-- usr.sbin/pkg_add/OpenBSD/PkgCfl.pm | 4 ++-- usr.sbin/pkg_add/OpenBSD/PkgSpec.pm | 6 +++--- usr.sbin/pkg_add/OpenBSD/Replace.pm | 6 +++--- 7 files changed, 23 insertions(+), 19 deletions(-) (limited to 'usr.sbin/pkg_add/OpenBSD') diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 435c5897eec..46cf895a348 100644 --- a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm +++ b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Dependencies.pm,v 1.23 2007/05/14 09:49:27 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.24 2007/05/14 10:43:45 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie # @@ -29,7 +29,7 @@ use OpenBSD::Interactive; sub find_candidate { my $spec = shift; - my @candidates = $spec->match(@_); + my @candidates = $spec->match_list(@_); if (@candidates >= 1) { return $candidates[0]; } else { @@ -137,7 +137,9 @@ sub find_old_lib my ($state, $base, $pattern, $lib, $dependencies) = @_; my $spec = OpenBSD::PkgSpec->new(".libs-".$pattern); - for my $try ($spec->match(installed_packages())) { + require OpenBSD::PackageRepository::Installed; + + for my $try (OpenBSD::PackageRepository::Installed->new->match($spec)) { OpenBSD::SharedLibs::add_package_libs($try); if (check_lib_spec($base, $lib, {$try => 1})) { $dependencies->{$try} = 1; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm index e9c10232a1c..1ceabd06aab 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageName.pm,v 1.23 2007/05/14 10:00:08 espie Exp $ +# $OpenBSD: PackageName.pm,v 1.24 2007/05/14 10:43:45 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie # @@ -321,7 +321,7 @@ sub split return $class->new(OpenBSD::PackageName::splitstem($pkgname)); } -sub match_repo +sub match { my ($self, $o) = @_; return $o->stemlist->find($self->{stem}); @@ -336,7 +336,7 @@ sub to_pattern return '*.'.$o->{stem}.'*-*'; } -sub match_repo +sub match { my ($self, $o) = @_; return $o->stemlist->find_partial($self->{stem}); diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm index b621d71a77c..2aa06cf45f0 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Installed.pm,v 1.3 2007/05/14 10:24:58 espie Exp $ +# $OpenBSD: Installed.pm,v 1.4 2007/05/14 10:43:45 espie Exp $ # # Copyright (c) 2007 Marc Espie # @@ -30,9 +30,9 @@ sub match { my ($self, $search, $filter) = @_; if (defined $filter) { - return &$filter($search->match_repo($self)); + return &$filter($search->match($self)); } else { - return $search->match_repo($self); + return $search->match($self); } } diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index aae57ff8000..679d83857ea 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.106 2007/05/13 10:08:11 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.107 2007/05/14 10:43:45 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie # @@ -740,8 +740,10 @@ sub add my ($class, $plist, $args) = @_; require OpenBSD::PkgSpec; + require OpenBSD::PackageRepository::Installed; - my @candidates = OpenBSD::PkgSpec->new($args)->match(installed_packages()); + my @candidates = OpenBSD::PackageRepository::Installed->new + ->match(OpenBSD::PkgSpec->new($args)); if (@candidates == 1) { if (!defined $installed_modules->{$candidates[0]}) { # pull in the module right here and now; diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm index 1e9ef79fb95..af63362c251 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PkgCfl.pm,v 1.18 2007/05/12 14:48:45 espie Exp $ +# $OpenBSD: PkgCfl.pm,v 1.19 2007/05/14 10:43:45 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie # @@ -54,7 +54,7 @@ sub conflicts_with my ($self, @pkgnames) = @_; my @l = (); for my $cfl (@$self) { - push(@l, $cfl->match(@pkgnames)); + push(@l, $cfl->match_list(@pkgnames)); } return @l; } diff --git a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm index c8009f7fb92..2b4cd2badc1 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PkgSpec.pm,v 1.9 2007/05/13 12:55:54 espie Exp $ +# $OpenBSD: PkgSpec.pm,v 1.10 2007/05/14 10:43:45 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie # @@ -217,13 +217,13 @@ sub match_ref return @l; } -sub match_repo +sub match { my ($self, $o) = @_; return $self->match_ref($o->list); } -sub match +sub match_list { my ($self, @list) = @_; return $self->match_ref(\@list); diff --git a/usr.sbin/pkg_add/OpenBSD/Replace.pm b/usr.sbin/pkg_add/OpenBSD/Replace.pm index cfffe49942a..1a25b358c2b 100644 --- a/usr.sbin/pkg_add/OpenBSD/Replace.pm +++ b/usr.sbin/pkg_add/OpenBSD/Replace.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Replace.pm,v 1.10 2007/05/12 22:50:31 espie Exp $ +# $OpenBSD: Replace.pm,v 1.11 2007/05/14 10:43:45 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie # @@ -159,9 +159,9 @@ sub check_replacement_spec my ($self, $state, $wanting, $toreplace, $replacement) = @_; # nothing to validate if old dependency doesn't concern us. - return unless $self->spec->match($toreplace); + return unless $self->spec->match_list($toreplace); # nothing to do if new dependency just matches - return if $self->spec->match($replacement); + return if $self->spec->match_list($replacement); if ($state->{forced}->{updatedepends}) { Warn "Forward dependency of $wanting on $toreplace doesn't match $replacement, forcing it\n"; -- cgit v1.2.3