diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-12-05 10:54:12 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-12-05 10:54:12 +0000 |
commit | 468de125fb88e1183ff58c3af24712070aaac078 (patch) | |
tree | e7197bfb39f8e80515fb4efa4f148c129336b52d | |
parent | dc4aea04ea679bfff765c4acadcc22a94ccbe466 (diff) |
better quirks interface: pass the search object that was built, so we can
adjust it (eventually, pass the whole list ?)
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 20 |
2 files changed, 17 insertions, 15 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 23f9f36a53b..ec501696dd1 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.110 2009/12/05 10:43:49 espie Exp $ +# $OpenBSD: Update.pm,v 1.111 2009/12/05 10:54:11 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -102,15 +102,11 @@ sub process_handle } my @search = (); - my $s; + push(@search, OpenBSD::Search::Stem->split($pkgname)); + if ($state->quirks) { - $s = $state->quirks->search_object($h, $state); - } - if (!$s) { - $s = OpenBSD::Search::Stem->split($pkgname); + $state->quirks->tweak_search(\@search, $h, $state); } - push(@search, $s); - my $found; my $oldfound = 0; diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 2369b9a5c1b..a8272be91e3 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.413 2009/12/05 10:10:40 espie Exp $ +# $OpenBSD: pkg_add,v 1.414 2009/12/05 10:54:11 espie Exp $ # # Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org> # @@ -710,6 +710,17 @@ sub quirk_set return $set; } +sub do_quirks +{ + my $state = shift; + + install_set(quirk_set(), $state); + eval { + require OpenBSD::Quirks; + # interface version number. + $state->{quirks} = OpenBSD::Quirks->new(1); + } +} sub process_parameters { # match fuzzily against a list @@ -786,12 +797,7 @@ sub { $state->tracker->add_sets(@todo2); if ($state->{allow_replacing}) { $state->{todo} = (scalar @todo2) + 1; - install_set(quirk_set(), $state); - eval { - require OpenBSD::Quirks; - # interface version number. - $state->{quirks} = OpenBSD::Quirks->new(0); - } + do_quirks($state); } # This is the actual very small loop that adds all packages while (my $set = shift @todo2) { |