summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-10-19 14:07:27 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-10-19 14:07:27 +0000
commit7094a1d6c3f904768d247810bcb24097c6bc2351 (patch)
treed6ad8868338e3b79e80c9bb0ee4a78f8df3f0300 /usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
parent5ee5e2e3fe83bf75469c502000e0990d8e369b8d (diff)
basic routines to handle the merging of updatesets: mark updatesets as
already done, separate remove/mark_installed in tracker, create a merge method that allows the merging of updatesets.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/UpdateSet.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/UpdateSet.pm24
1 files changed, 23 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
index ce651f2e8ac..a8c38d0c13c 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.9 2009/10/15 10:45:47 espie Exp $
+# $OpenBSD: UpdateSet.pm,v 1.10 2009/10/19 14:07:26 espie Exp $
#
# Copyright (c) 2007 Marc Espie <espie@openbsd.org>
#
@@ -267,6 +267,28 @@ sub from_location
return $set;
}
+# Merge several updatesets together
+sub merge
+{
+ my ($self, $tracker, @sets) = @_;
+ # Apparently simple, just add the missing parts
+ for my $set (@sets) {
+ for my $p ($set->newer) {
+ $self->add_newer($p);
+ }
+ for my $p ($set->older) {
+ $self->add_older($p);
+ }
+ # BUT XXX tell the tracker we killed the set
+ $tracker->remove_set($set);
+ # ... and mark it as already done
+ $set->{finished} = 1;
+ }
+ # then regen tracker info for $self
+ $tracker->add_set($self);
+ return $self;
+}
+
package OpenBSD::PackingList;
sub compute_size
{