diff options
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Dependencies.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageInfo.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageName.pm | 39 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCfl.pm | 10 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgSpec.pm | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 6 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_info | 8 |
10 files changed, 44 insertions, 47 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Dependencies.pm b/usr.sbin/pkg_add/OpenBSD/Dependencies.pm index 46cf895a348..895b66db2aa 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.24 2007/05/14 10:43:45 espie Exp $ +# $OpenBSD: Dependencies.pm,v 1.25 2007/05/14 10:53:31 espie Exp $ # # Copyright (c) 2005-2007 Marc Espie <espie@openbsd.org> # @@ -136,7 +136,7 @@ sub find_old_lib { my ($state, $base, $pattern, $lib, $dependencies) = @_; - my $spec = OpenBSD::PkgSpec->new(".libs-".$pattern); + my $spec = OpenBSD::Search::PkgSpec->new(".libs-".$pattern); require OpenBSD::PackageRepository::Installed; for my $try (OpenBSD::PackageRepository::Installed->new->match($spec)) { diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm index acdd0dd9d87..e2a52641331 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageInfo.pm,v 1.26 2007/05/14 10:00:08 espie Exp $ +# $OpenBSD: PackageInfo.pm,v 1.27 2007/05/14 10:53:31 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -209,7 +209,7 @@ sub solve_installed_names if (OpenBSD::PackageName::is_stem($pkgname)) { require OpenBSD::PackageRepository; - my @l = OpenBSD::PackageRepository::Installed->new->match(OpenBSD::PackageName::Stem->new($pkgname)); + my @l = OpenBSD::PackageRepository::Installed->new->match(OpenBSD::Search::Stem->new($pkgname)); if (@l == 0) { print "Can't resolve $pkgname to an installed package name\n"; $bad = 1; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm index 1ceabd06aab..085d1026997 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.24 2007/05/14 10:43:45 espie Exp $ +# $OpenBSD: PackageName.pm,v 1.25 2007/05/14 10:53:31 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -308,6 +308,20 @@ sub to_pattern return $o->{stem}.'-*'; } +package OpenBSD::PackageName::Name; +sub to_string +{ + my $o = shift; + return join('-', $o->{stem}, $o->{version}->to_string, @{$o->{flavors}}); +} + +sub to_pattern +{ + my $o = shift; + return join('-', $o->{stem}, '*', @{$o->{flavors}}); +} + +package OpenBSD::Search::Stem; sub new { my ($class, $stem) = @_; @@ -327,14 +341,8 @@ sub match return $o->stemlist->find($self->{stem}); } -package OpenBSD::PackageName::PartialStem; -our @ISA=(qw(OpenBSD::PackageName::Stem)); - -sub to_pattern -{ - my $o = shift; - return '*.'.$o->{stem}.'*-*'; -} +package OpenBSD::Search::PartialStem; +our @ISA=(qw(OpenBSD::Search::Stem)); sub match { @@ -342,17 +350,4 @@ sub match return $o->stemlist->find_partial($self->{stem}); } -package OpenBSD::PackageName::Name; -sub to_string -{ - my $o = shift; - return join('-', $o->{stem}, $o->{version}->to_string, @{$o->{flavors}}); -} - -sub to_pattern -{ - my $o = shift; - return join('-', $o->{stem}, '*', @{$o->{flavors}}); -} - 1; diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 679d83857ea..47871a7580d 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.107 2007/05/14 10:43:45 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.108 2007/05/14 10:53:31 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -691,7 +691,7 @@ sub spec my $self = shift; if (!defined $self->{spec}) { require OpenBSD::PkgSpec; - $self->{spec} = OpenBSD::PkgSpec->new($self->{pattern}); + $self->{spec} = OpenBSD::Search::PkgSpec->new($self->{pattern}); } return $self->{spec}; } @@ -743,7 +743,7 @@ sub add require OpenBSD::PackageRepository::Installed; my @candidates = OpenBSD::PackageRepository::Installed->new - ->match(OpenBSD::PkgSpec->new($args)); + ->match(OpenBSD::Search::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 af63362c251..29f90927fb3 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.19 2007/05/14 10:43:45 espie Exp $ +# $OpenBSD: PkgCfl.pm,v 1.20 2007/05/14 10:53:31 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -35,15 +35,15 @@ sub make_conflict_list my $stem = OpenBSD::PackageName::splitstem($pkgname); unless (defined $plist->{'no-default-conflict'}) { - push(@$l, OpenBSD::PkgSpec->new("$stem-*|partial-$stem-*")); + push(@$l, OpenBSD::Search::PkgSpec->new("$stem-*|partial-$stem-*")); } else { $pkgname =~ s/p\d+$//; - push(@$l, OpenBSD::PkgSpec->new("$pkgname|partial-$pkgname")); + push(@$l, OpenBSD::Search::PkgSpec->new("$pkgname|partial-$pkgname")); } - push(@$l, OpenBSD::PkgSpec->new(".libs-$stem-*")); + push(@$l, OpenBSD::Search::PkgSpec->new(".libs-$stem-*")); if (defined $plist->{conflict}) { for my $cfl (@{$plist->{conflict}}) { - push(@$l, OpenBSD::PkgSpec->new($cfl->{name})); + push(@$l, OpenBSD::Search::PkgSpec->new($cfl->{name})); } } bless $l, $class; diff --git a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm index 2b4cd2badc1..7850f1a6f7e 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.10 2007/05/14 10:43:45 espie Exp $ +# $OpenBSD: PkgSpec.pm,v 1.11 2007/05/14 10:53:31 espie Exp $ # # Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org> # @@ -206,13 +206,15 @@ sub subpattern_match return @result; } +package OpenBSD::Search::PkgSpec; + sub match_ref { my ($self, $r) = @_; my @l = (); for my $subpattern (@{$self->{patterns}}) { - push(@l, subpattern_match($subpattern, $r)); + push(@l, OpenBSD::PkgSpec::subpattern_match($subpattern, $r)); } return @l; } diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 5c3fc71d5bc..b9da98c7916 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.75 2007/05/14 09:29:07 espie Exp $ +# $OpenBSD: Update.pm,v 1.76 2007/05/14 10:53:31 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -63,7 +63,7 @@ sub process_package print "Not updating $pkgname, remember to clean it\n"; return; } - my $stem = OpenBSD::PackageName::Stem->split($pkgname); + my $stem = OpenBSD::Search::Stem->split($pkgname); my $found; my $plist; diff --git a/usr.sbin/pkg_add/pkg b/usr.sbin/pkg_add/pkg index e65b3f8fd9f..be672d124ae 100644 --- a/usr.sbin/pkg_add/pkg +++ b/usr.sbin/pkg_add/pkg @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg,v 1.6 2007/05/14 10:43:45 espie Exp $ +# $OpenBSD: pkg,v 1.7 2007/05/14 10:53:31 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -26,7 +26,7 @@ sub check_dependencies($) require OpenBSD::PackageRepository::Installed; my $dependency = shift; my @m = OpenBSD::PackageRepository::Installed->new - ->match(OpenBSD::PkgSpec->new($dependency)); + ->match(OpenBSD::Search::PkgSpec->new($dependency)); return (@m != 0) ? 1 : 0; } diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 0894dd90346..2ccf7e463c7 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.242 2007/05/14 10:43:45 espie Exp $ +# $OpenBSD: pkg_add,v 1.243 2007/05/14 10:53:31 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -331,7 +331,7 @@ sub really_add($$) for my $op (@toreplace) { OpenBSD::ProgressMeter::set_header($op->pkgname." (deleting)"); $state->set_pkgname($op->pkgname); - if (OpenBSD::PkgSpec->new("mozilla-thunderbird-<=1.0.2p0")->match_list($op->pkgname)) { + if (OpenBSD::Search::PkgSpec->new("mozilla-thunderbird-<=1.0.2p0")->match_list($op->pkgname)) { thunderbird_special_case($plist); } require OpenBSD::Delete; @@ -591,7 +591,7 @@ sub find_truenames $h = 'OpenBSD::PackageLocator'; $path = ""; } - my @l = $h->match(OpenBSD::PackageName::Stem->new($pkgname)); + my @l = $h->match(OpenBSD::Search::Stem->new($pkgname)); if (@l > 1 && !$state->{forced}->{allversions}) { @l = OpenBSD::PackageName::keep_most_recent(@l); } diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info index 409493f087a..7f8ed3d7ae1 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.52 2007/05/14 10:43:45 espie Exp $ +# $OpenBSD: pkg_info,v 1.53 2007/05/14 10:53:31 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -78,7 +78,7 @@ sub find_pkg return; } if (OpenBSD::PackageName::is_stem($pkgname)) { - my @l = sort ($repo->match(OpenBSD::PackageName::Stem->new($pkgname))); + my @l = sort ($repo->match(OpenBSD::Search::Stem->new($pkgname))); if (@l != 0) { for my $p (@l) { &$code($p, $repo->find($p)); @@ -142,7 +142,7 @@ sub find_by_spec require OpenBSD::PkgSpec; require OpenBSD::PackageRepository::Installed; - return sort(OpenBSD::PackageRepository::Installed->new->match(OpenBSD::PkgSpec->new($pat))); + return sort(OpenBSD::PackageRepository::Installed->new->match(OpenBSD::Search::PkgSpec->new($pat))); } sub filter_files @@ -370,7 +370,7 @@ if ($opt_Q) { require OpenBSD::PackageLocator; print "PKG_PATH=$ENV{PKG_PATH}\n" if $opt_v; - my $partial = OpenBSD::PackageName::PartialStem->new($opt_Q); + my $partial = OpenBSD::Search::PartialStem->new($opt_Q); for my $p (sort OpenBSD::PackageLocator->match($partial)) { print $p, is_installed($p) ? " (installed)" : "" , "\n"; |