summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-11-28 16:46:21 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-11-28 16:46:21 +0000
commit4e8369711d04972616a280b4f583157058dbbbc1 (patch)
tree0c4fb8fef5556ad592833ae666419823b999201c /usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
parentf8780ed819f7e633598dfbe337c3ff7b6a7d534c (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/OpenBSD/UpdateSet.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/UpdateSet.pm22
1 files changed, 21 insertions, 1 deletions
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;