diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2010-04-05 16:07:11 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2010-04-05 16:07:11 +0000 |
commit | 6da221b8ee72710b19a4d413344b0503a97df644 (patch) | |
tree | 2f67019686bcfc552bef6da68fa253432f94e66b /usr.sbin | |
parent | 11082f4dd3a94332e8acdcbf00e683fa2bac3eb1 (diff) |
new keyword, @ask-update, to be used *very* sparingly (so far, only useful
for pgsql updates)
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 26 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 31 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingList.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/UpdateSet.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_create | 8 |
5 files changed, 64 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index f65f8022127..7b7e778628d 100644 --- a/usr.sbin/pkg_add/OpenBSD/Add.pm +++ b/usr.sbin/pkg_add/OpenBSD/Add.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Add.pm,v 1.106 2010/04/05 13:46:24 espie Exp $ +# $OpenBSD: Add.pm,v 1.107 2010/04/05 16:07:10 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -59,9 +59,9 @@ sub register_installation sub validate_plist { - my ($plist, $state) = @_; + my ($plist, $state, $set) = @_; - $plist->prepare_for_addition($state, $plist->pkgname); + $plist->prepare_for_addition($state, $plist->pkgname, $set); } sub record_partial_installation @@ -691,4 +691,24 @@ sub copy_info { } +package OpenBSD::PackingElement::AskUpdate; +sub prepare_for_addition +{ + my ($self, $state, $pkgname, $set) = @_; + my @old = $set->older_names; + if ($self->spec->match_ref(\@old) > 0) { + my $key = "update_".OpenBSD::PackageName::splitstem($pkgname); + return if $state->{defines}->{$key}; + if ($state->{interactive}) { + if ($state->confirm($self->{message}."\n". + "Do you want to update now", 0)) { + return; + } + } else { + $state->errsay("Can't update $pkgname now: $self->{message}"); + } + $state->{problems}++; + } +} + 1; diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 96bf62ebd30..4e2ab84a2c7 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.174 2010/04/05 14:08:56 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.175 2010/04/05 16:07:10 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -978,6 +978,35 @@ sub keyword() { "incompatibility" } __PACKAGE__->register_with_factory; sub category() { "incompatibility" } +package OpenBSD::PackingElement::AskUpdate; +our @ISA=qw(OpenBSD::PackingElement::Meta); + +sub new +{ + my ($class, $args) = @_; + my ($pattern, $message) = split /\s+/o, $args, 2; + bless { pattern => $pattern, message => $message}, $class; +} + +sub stringize +{ + my $self = shift; + return join(' ', map { $self->{$_}} + (qw(pattern message))); +} + +sub keyword() { "ask-update" } +__PACKAGE__->register_with_factory; +sub category() { "ask-update" } + +OpenBSD::Auto::cache(spec, + sub { + require OpenBSD::PkgSpec; + + my $self = shift; + return OpenBSD::PkgSpec->new($self->{pattern}) + }); + package OpenBSD::PackingElement::UpdateSet; our @ISA=qw(OpenBSD::PackingElement::Meta); diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index 7b1ec12eb4f..db3cb8fb17e 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingList.pm,v 1.102 2010/03/22 20:38:44 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.103 2010/04/05 16:07:10 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -450,7 +450,7 @@ our @unique_categories = (qw(name url digital-signature no-default-conflict manual-installation always-update explicit-update extrainfo localbase arch)); our @list_categories = - (qw(conflict pkgpath incompatibility updateset depend + (qw(conflict pkgpath incompatibility ask-update updateset depend wantlib define-tag groups users items)); our @cache_categories = diff --git a/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm b/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm index 2cf190eb1b2..8347fabad2a 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.53 2010/04/05 13:46:24 espie Exp $ +# $OpenBSD: UpdateSet.pm,v 1.54 2010/04/05 16:07:10 espie Exp $ # # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org> # @@ -296,7 +296,7 @@ sub validate_plists $state->{colliding} = []; for my $n ($self->newer) { require OpenBSD::Add; - OpenBSD::Add::validate_plist($n->{plist}, $state); + OpenBSD::Add::validate_plist($n->{plist}, $state, $self); } if (@{$state->{colliding}} > 0) { require OpenBSD::CollisionReport; diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create index 29036833ca8..902f1fa9521 100644 --- a/usr.sbin/pkg_add/pkg_create +++ b/usr.sbin/pkg_add/pkg_create @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_create,v 1.137 2010/04/05 14:47:05 espie Exp $ +# $OpenBSD: pkg_create,v 1.138 2010/04/05 16:07:10 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -346,6 +346,12 @@ sub avert_duplicates_and_other_checks $self->SUPER::avert_duplicates_and_other_checks($state); } +package OpenBSD::PackingElement::AskUpdate; +sub avert_duplicates_and_other_checks +{ + &OpenBSD::PackingElement::Depend::avert_duplicates_and_other_checks; +} + package OpenBSD::PackingElement::Dependency; sub avert_duplicates_and_other_checks { |