summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-01-01 12:47:15 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-01-01 12:47:15 +0000
commitd3352204880a02be7097b2b718ef50927391786b (patch)
tree3d075fe034e4c415643b30108aff838a8a731056 /usr.sbin/pkg_add
parent7b556f7f62d98a664f37d321a025cb22e44817fd (diff)
make updatesets aware of repository paths
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/UpdateSet.pm42
1 files changed, 41 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
index 6b95aede097..09703d6cce6 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.46 2010/01/01 12:46:09 espie Exp $
+# $OpenBSD: UpdateSet.pm,v 1.47 2010/01/01 12:47:14 espie Exp $
#
# Copyright (c) 2007-2009 Marc Espie <espie@openbsd.org>
#
@@ -69,6 +69,39 @@ sub new
$class;
}
+sub path
+{
+ my $set = shift;
+
+ return $set->{path};
+}
+
+sub add_repositories
+{
+ my ($set, @repos) = @_;
+
+ if (!defined $set->{path}) {
+ require OpenBSD::PackageRepositoryList;
+
+ $set->{path} = OpenBSD::PackageRepositoryList->new;
+ }
+ $set->{path}->add(@repos);
+}
+
+sub match_locations
+{
+ my ($set, @spec) = @_;
+ my $r = [];
+ if (defined $set->{path}) {
+ $r = $set->{path}->match_locations(@spec);
+ }
+ if (@$r == 0) {
+ require OpenBSD::PackageLocator;
+ $r = OpenBSD::PackageLocator->match_locations(@spec);
+ }
+ return $r;
+}
+
sub cleanup
{
my ($self, $error, $errorinfo) = @_;
@@ -315,6 +348,13 @@ sub merge
$self->add_newer($set->newer);
$self->add_older($set->older);
$self->add_kept($set->kept);
+ if (defined $set->path) {
+ if (!defined $self->path) {
+ $self->{path} = $set->path;
+ } elsif ($set->{path} ne $self->path) {
+ $self->add_path(@{$set->{path}});
+ }
+ }
# ... and mark it as already done
$set->{finished} = 1;
$tracker->handle_set($set);