summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-12-05 10:08:59 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-12-05 10:08:59 +0000
commitf33f629a49453174492956759bc949345d57f7ee (patch)
tree559be6baded9ba0633858d7af964b9bcb72226f9 /usr.sbin/pkg_add/OpenBSD
parentc677bcc310dc42aedd5d17834ce87a0b9816fd07 (diff)
make quirks silent. Track # of updates found, instead of newer size, since
we may end up updating sets with newer == 0
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/AddDelete.pm6
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm25
-rw-r--r--usr.sbin/pkg_add/OpenBSD/UpdateSet.pm6
3 files changed, 23 insertions, 14 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
index 046f5b7de1c..c8831a2cc78 100644
--- a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: AddDelete.pm,v 1.4 2009/11/17 10:17:21 espie Exp $
+# $OpenBSD: AddDelete.pm,v 1.5 2009/12/05 10:08:58 espie Exp $
#
# Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org>
#
@@ -308,9 +308,9 @@ sub check_root
sub choose_location
{
- my ($state, $name, $list) = @_;
+ my ($state, $name, $list, $is_quirks) = @_;
if (@$list == 0) {
- $state->say("Can't find $name");
+ $state->say("Can't find $name") unless $is_quirks;
return undef;
} elsif (@$list == 1) {
return $list->[0];
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index befe05ee91f..66221226c69 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.108 2009/12/04 10:48:14 espie Exp $
+# $OpenBSD: Update.pm,v 1.109 2009/12/05 10:08:58 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -87,12 +87,14 @@ sub process_handle
return 0;
}
+
if ($state->quirks) {
- if ($state->quirks->is_base_system($h)) {
+ if ($state->quirks->is_base_system($h, $state)) {
$h->{update_found} = 1;
return 1;
}
}
+
my $plist = OpenBSD::PackingList->from_installation($pkgname,
\&OpenBSD::PackingList::UpdateInfoOnly);
if (!defined $plist) {
@@ -102,7 +104,7 @@ sub process_handle
my @search = ();
my $s;
if ($state->quirks) {
- $s = $state->quirks->search_object($h);
+ $s = $state->quirks->search_object($h, $state);
}
if (!$s) {
$s = OpenBSD::Search::Stem->split($pkgname);
@@ -242,7 +244,8 @@ sub process_hint2
$h = 'OpenBSD::PackageLocator';
$path = "";
}
- my $l = $state->updater->stem2location($h, $pkgname, $state);
+ my $l = $state->updater->stem2location($h, $pkgname, $state,
+ $set->{quirks});
if (defined $l) {
$self->add_location($set, $hint, $l);
} else {
@@ -264,14 +267,18 @@ sub process_set
my $problem;
for my $h ($set->older, $set->hints) {
next if $h->{update_found};
- if (!defined $h->update($self, $set, $state)) {
+ my $r = $h->update($self, $set, $state);
+
+ if (!defined $r) {
$problem = 1;
+ } else {
+ $set->{updates} += $r;
}
}
if ($problem) {
- $state->tracker->mark_cant_update($set);
+ $state->tracker->mark_cant_update($set) if !$set->{quirks};
return 0;
- } elsif ($set->newer == 0) {
+ } elsif ($set->{updates} == 0) {
$state->tracker->mark_uptodate($set);
return 0;
}
@@ -281,12 +288,12 @@ sub process_set
sub stem2location
{
- my ($self, $repo, $name, $state) = @_;
+ my ($self, $repo, $name, $state, $is_quirks) = @_;
my $l = $repo->match_locations(OpenBSD::Search::Stem->new($name));
if (@$l > 1 && !$state->{defines}->{allversions}) {
$l = OpenBSD::Search::FilterLocation->keep_most_recent->filter_locations($l);
}
- return $state->choose_location($name, $l);
+ return $state->choose_location($name, $l, $is_quirks);
}
1;
diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
index eeec7822851..dba90f70850 100644
--- a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
+++ b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: UpdateSet.pm,v 1.32 2009/12/02 11:36:27 espie Exp $
+# $OpenBSD: UpdateSet.pm,v 1.33 2009/12/05 10:08:58 espie Exp $
#
# Copyright (c) 2007 Marc Espie <espie@openbsd.org>
#
@@ -56,7 +56,8 @@ package OpenBSD::UpdateSet;
sub new
{
my $class = shift;
- return bless {newer => {}, older => {}, hints => []}, $class;
+ return bless {newer => {}, older => {}, hints => [], updates => 0},
+ $class;
}
sub cleanup
@@ -263,6 +264,7 @@ sub merge
$set->{finished} = 1;
# XXX and mark it as merged, for eventual updates
$set->{merged} = $self;
+ $self->{updates} += $set->{updates};
}
# then regen tracker info for $self
$tracker->add_set($self);