summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/AddDelete.pm26
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgAdd.pm26
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgDelete.pm30
-rw-r--r--usr.sbin/pkg_add/OpenBSD/UpdateSet.pm13
4 files changed, 58 insertions, 37 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/AddDelete.pm b/usr.sbin/pkg_add/OpenBSD/AddDelete.pm
index 61b82c0194e..3edba67dee3 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.47 2011/07/12 10:06:57 espie Exp $
+# $OpenBSD: AddDelete.pm,v 1.48 2011/07/13 12:32:15 espie Exp $
#
# Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org>
#
@@ -286,30 +286,6 @@ sub status
return $self->{status};
}
-sub updateset
-{
- my $self = shift;
- require OpenBSD::UpdateSet;
-
- return OpenBSD::UpdateSet->new($self);
-}
-
-sub updateset_with_new
-{
- my ($self, $pkgname) = @_;
-
- return $self->updateset->add_newer(
- OpenBSD::Handle->create_new($pkgname));
-}
-
-sub updateset_from_location
-{
- my ($self, $location) = @_;
-
- return $self->updateset->add_newer(
- OpenBSD::Handle->from_location($location));
-}
-
OpenBSD::Auto::cache(ldconfig,
sub {
my $self = shift;
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
index dfbb6dc5537..175b06e786a 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgAdd.pm,v 1.25 2011/07/13 11:58:41 espie Exp $
+# $OpenBSD: PkgAdd.pm,v 1.26 2011/07/13 12:32:15 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -198,6 +198,30 @@ sub set_name_from_handle
$state->log->set_context($extra.$h->pkgname);
}
+sub updateset
+{
+ my $self = shift;
+ require OpenBSD::UpdateSet;
+
+ return OpenBSD::UpdateSet->new($self);
+}
+
+sub updateset_with_new
+{
+ my ($self, $pkgname) = @_;
+
+ return $self->updateset->add_newer(
+ OpenBSD::Handle->create_new($pkgname));
+}
+
+sub updateset_from_location
+{
+ my ($self, $location) = @_;
+
+ return $self->updateset->add_newer(
+ OpenBSD::Handle->from_location($location));
+}
+
OpenBSD::Auto::cache(updater,
sub {
require OpenBSD::Update;
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm b/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm
index af67efff284..1d0fab3158a 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgDelete.pm
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgDelete.pm,v 1.14 2011/07/12 10:56:03 espie Exp $
+# $OpenBSD: PkgDelete.pm,v 1.15 2011/07/13 12:32:15 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -129,6 +129,20 @@ sub stem2location
return $state->choose_location($name, $l);
}
+sub deleteset
+{
+ my $self = shift;
+ require OpenBSD::UpdateSet;
+
+ return OpenBSD::DeleteSet->new($self);
+}
+
+sub deleteset_from_location
+{
+ my ($self, $location) = @_;
+ return $self->deleteset->add_older(OpenBSD::Handle->from_location($location));
+}
+
package OpenBSD::PkgDelete;
our @ISA = qw(OpenBSD::AddDelete);
@@ -144,7 +158,7 @@ sub add_location
{
my ($self, $state, $l) = @_;
push(@{$state->{setlist}},
- $state->updateset->add_older(OpenBSD::Handle->from_location($l)));
+ $state->deleteset_from_location($l));
}
sub create_locations
@@ -159,7 +173,7 @@ sub create_locations
$name);
$state->{bad}++;
} else {
- push(@$result, $state->updateset->add_older(OpenBSD::Handle->from_location($l)));
+ push(@$result, $state->deleteset_from_location($l));
}
}
return $result;
@@ -206,11 +220,11 @@ sub really_remove
} else {
$state->status->what("Deleting");
}
- if (!$state->progress->set_header($set->delete_print)) {
+ if (!$state->progress->set_header($set->print)) {
$state->say($state->{not} ?
"Pretending to delete #1" :
"Deleting #1",
- $set->delete_print) if $state->verbose;
+ $set->print) if $state->verbose;
}
for my $pkgname ($set->older_names) {
$state->log->set_context('-'.$pkgname);
@@ -285,7 +299,7 @@ sub remove_set
}
if (keys %$bad2 > 0) {
$state->errsay("#1 depends on non-existant #2",
- $set->delete_print, join(' ', sort keys %$bad2));
+ $set->print, join(' ', sort keys %$bad2));
if (fix_bad_dependencies($state)) {
for my $pkg (keys %$bad2) {
delete $bad->{$pkg};
@@ -296,7 +310,7 @@ sub remove_set
if (keys %$bad > 0) {
if (!$state->{automatic} || $state->verbose) {
$state->errsay("can't delete #1 without deleting #2",
- $set->delete_print, join(' ', sort keys %$bad));
+ $set->print, join(' ', sort keys %$bad));
}
if (!$state->{automatic}) {
if (delete_dependencies($state)) {
@@ -330,7 +344,7 @@ sub remove_set
$pkg->complete_old;
if ($pkg->plist->has('manual-installation')) {
$state->say("Won't delete manually installed #1",
- $set->delete_print) if $state->verbose;
+ $set->print) if $state->verbose;
$set->cleanup(OpenBSD::Handle::CANT_DELETE);
$state->tracker->done($set);
return ();
diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
index 073896ab720..50d3b0a757c 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.66 2011/07/12 10:30:29 espie Exp $
+# $OpenBSD: UpdateSet.pm,v 1.67 2011/07/13 12:32:15 espie Exp $
#
# Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org>
#
@@ -260,7 +260,7 @@ sub print
$result = "[".join('+', sort $self->kept_names)."]";
}
if ($self->older > 0) {
- $result .= $self->delete_print."->";
+ $result .= $self->old_print."->";
}
if ($self->newer > 0) {
$result .= join('+', sort $self->newer_names);
@@ -270,7 +270,7 @@ sub print
return $result;
}
-sub delete_print
+sub old_print
{
my $self = shift;
return join('+', sort $self->older_names);
@@ -409,4 +409,11 @@ sub real_set
return $set;
}
+package OpenBSD::DeleteSet;
+our @ISA = qw(OpenBSD::UpdateSet);
+sub print
+{
+ &OpenBSD::UpdateSet::old_print;
+}
+
1;