diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-12-04 10:48:15 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-12-04 10:48:15 +0000 |
commit | bd5d15826a8ebbed24d92a36c8709bf6fe17bdf7 (patch) | |
tree | e1841a66851ae2b0a45237a3b2d17e49f639b7eb /usr.sbin | |
parent | 818d7eaaff82adeea0f6a2331ddad02befac2623 (diff) |
set-up for quirks, just don't do it yet.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 19 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 39 |
2 files changed, 54 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index edb050e5cf7..befe05ee91f 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.107 2009/11/30 18:45:14 espie Exp $ +# $OpenBSD: Update.pm,v 1.108 2009/12/04 10:48:14 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -87,15 +87,28 @@ sub process_handle return 0; } + if ($state->quirks) { + if ($state->quirks->is_base_system($h)) { + $h->{update_found} = 1; + return 1; + } + } my $plist = OpenBSD::PackingList->from_installation($pkgname, \&OpenBSD::PackingList::UpdateInfoOnly); if (!defined $plist) { Fatal("Can't locate $pkgname"); } - my @search = (); - push(@search, OpenBSD::Search::Stem->split($pkgname)); + my $s; + if ($state->quirks) { + $s = $state->quirks->search_object($h); + } + if (!$s) { + $s = OpenBSD::Search::Stem->split($pkgname); + } + 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 a01fc5cf66d..4b0fe24cd3f 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.409 2009/12/02 11:36:27 espie Exp $ +# $OpenBSD: pkg_add,v 1.410 2009/12/04 10:48:14 espie Exp $ # # Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org> # @@ -113,6 +113,13 @@ sub tracker return $state->{tracker}; } +sub quirks +{ + my $state = shift; + + return $state->{quirks}; +} + package OpenBSD::UpdateSet; use OpenBSD::PackageInfo; use OpenBSD::Error; @@ -610,6 +617,13 @@ sub install_set really_add($set, $state); $set->cleanup; $state->tracker->mark_installed($set); + # if we have a quirks object, we try to create the object that goes + # with it. + if ($set->{quirks}) { + require OpenBSD::Quirks; + # interface version number. + $state->{quirks} = OpenBSD::Quirks->new(0); + } return (); } @@ -683,6 +697,23 @@ sub inform_user_of_problems } } +# if we already have quirks, we update it. If not, we try to install it. +sub quirk_set +{ + require OpenBSD::PackageRepository::Installed; + require OpenBSD::Search; + + my $set = OpenBSD::UpdateSet->new; + $set->{quirks} = 1; + my $l = OpenBSD::PackageRepository::Installed->new->match_locations(OpenBSD::Search::Stem->new('quirks')); + if (@$l > 0) { + $set->add_older(@$l); + } else { + $set->add_hints2('quirks'); + } + return $set; +} + sub process_parameters { # match fuzzily against a list @@ -728,6 +759,9 @@ sub process_parameters push(@todo2, OpenBSD::UpdateSet->new->$m($pkgname)); } } + if ($state->{allow_replacing}) { +# unshift(@todo2, quirk_set()); + } } sub finish_display @@ -762,6 +796,9 @@ sub { $state->progress->set_header("Looking for packages"); $state->{todo} = scalar @todo2; unshift(@todo2, install_set($set, $state)); + if ($state->quirks) { + $state->quirks->tweak_list(\@todo2); + } } }); |