diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-11-28 16:46:21 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-11-28 16:46:21 +0000 |
commit | 4e8369711d04972616a280b4f583157058dbbbc1 (patch) | |
tree | 0c4fb8fef5556ad592833ae666419823b999201c /usr.sbin/pkg_add | |
parent | f8780ed819f7e633598dfbe337c3ff7b6a7d534c (diff) |
prepare for "better" merge: we can't just wipe the old set, we have to point
it to the new set, as tracker stuff may still know about it.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Tracker.pm | 22 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/UpdateSet.pm | 22 |
2 files changed, 41 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Tracker.pm b/usr.sbin/pkg_add/OpenBSD/Tracker.pm index 6107c1a209d..45ae344bd95 100644 --- a/usr.sbin/pkg_add/OpenBSD/Tracker.pm +++ b/usr.sbin/pkg_add/OpenBSD/Tracker.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Tracker.pm,v 1.10 2009/11/24 11:35:18 espie Exp $ +# $OpenBSD: Tracker.pm,v 1.11 2009/11/28 16:46:20 espie Exp $ # # Copyright (c) 2009 Marc Espie <espie@openbsd.org> # @@ -100,10 +100,28 @@ sub mark_installed } } +sub is +{ + my ($self, $k, $pkg) = @_; + + my $set = $self->{$k}->{$pkg}; + if (ref $set) { + return $set->real_set; + } else { + return $set; + } +} + sub is_installed { my ($self, $pkg) = @_; - return $self->{installed}->{$pkg}; + return $self->is('installed', $pkg); +} + +sub is_to_update +{ + my ($self, $pkg) = @_; + return $self->is('to_update', $pkg); } sub installed diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm index 5b215fa729f..7f1aac3fea7 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.28 2009/11/24 10:50:18 espie Exp $ +# $OpenBSD: UpdateSet.pm,v 1.29 2009/11/28 16:46:20 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # @@ -52,12 +52,21 @@ package OpenBSD::hint2; our @ISA = qw(OpenBSD::hint); package OpenBSD::UpdateSet; + sub new { my $class = shift; return bless {newer => {}, older => {}, hints => []}, $class; } +sub set_error +{ + my ($self, $error) = @_; + for my $h ($self->older) { + $h->set_error($error); + } +} + sub add_newer { my $self = shift; @@ -245,10 +254,21 @@ sub merge $tracker->remove_set($set); # ... and mark it as already done $set->{finished} = 1; + # XXX and mark it as merged, for eventual updates + $set->{merged} = $self; } # then regen tracker info for $self $tracker->add_set($self); return $self; } +sub real_set +{ + my $set = shift; + while (defined $set->{merged}) { + $set = $set->{merged}; + } + return $set; +} + 1; |