diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-11-11 12:15:29 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-11-11 12:15:29 +0000 |
commit | 23d05ccb96d2d52db2f5a2e8228c7faf1558d828 (patch) | |
tree | 2dfab51d740ecaf7370f61ed8c30c5df4d2d494f | |
parent | b6e8afcb3ecdec918a42939544690380b1a29825 (diff) |
restrict update operation less: we're not bothered by @exec or INSTALL,
only DEINSTALL or @unexec (we should need to run symetric checks on
the package we're going to install, though...)
allows forced replacement: script running, and breaking forward dependencies.
Communicate more about what may break.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 23 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add.1 | 6 |
2 files changed, 23 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 34120c68a86..b70b3ec0a35 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.21 2004/11/11 11:16:40 espie Exp $ +# $OpenBSD: Update.pm,v 1.22 2004/11/11 12:15:28 espie Exp $ # # Copyright (c) 2004 Marc Espie <espie@openbsd.org> # @@ -111,10 +111,14 @@ sub extract package OpenBSD::PackingElement::ScriptFile; sub updatable() { 0 } -package OpenBSD::PackingElement::ExeclikeAction; +package OpenBSD::PackingElement::FINSTALL; +sub updatable() { 1 } + +package OpenBSD::PackingElement::Unexec; sub updatable() { 0 } package OpenBSD::PackingElement::LibDepend; +use OpenBSD::Error; sub validate_depend { my ($self, $state, $wanting, $toreplace, $replacement) = @_; @@ -125,7 +129,7 @@ sub validate_depend return unless OpenBSD::PkgSpec::match($self->{pattern}, $toreplace); if (!OpenBSD::PkgSpec::match($self->{pattern}, $replacement)) { $state->{okay} = 0; - return; + Warn "Can't update forward dependency of $wanting on $toreplace\n"; } } @@ -156,6 +160,7 @@ sub unmark_lib } package OpenBSD::PackingElement::NewDepend; +use OpenBSD::Error; sub validate_depend { my ($self, $state, $wanting, $toreplace, $replacement) = @_; @@ -166,6 +171,7 @@ sub validate_depend return unless OpenBSD::PkgSpec::match($self->{pattern}, $toreplace); if (!OpenBSD::PkgSpec::match($self->{pattern}, $replacement)) { $state->{okay} = 0; + Warn "Can't update forward dependency of $wanting on $toreplace\n"; } } @@ -173,10 +179,11 @@ package OpenBSD::Update; use OpenBSD::RequiredBy; use OpenBSD::PackingList; use OpenBSD::PackageInfo; +use OpenBSD::Error; sub can_do { - my ($toreplace, $replacement, $state) = @_; + my ($toreplace, $replacement, $state, $forced) = @_; my $wantlist = []; my $r = OpenBSD::RequiredBy->new($toreplace); @@ -185,7 +192,10 @@ sub can_do my $plist = OpenBSD::PackingList->from_installation($toreplace); $plist->visit('can_update', $state); if ($state->{okay} == 0) { - print "Old package contains impossible to update elements\n"; + Warn "Old package contains impossible to update elements\n"; + } + if ($forced->{update}) { + $state->{okay} = 1; } if (-f $$r) { $wantlist = $r->list(); @@ -200,6 +210,9 @@ sub can_do } } + if ($forced->{updatedepends}) { + $state->{okay} = 1; + } eval { OpenBSD::Delete::validate_plist($plist, $state->{destdir}); }; diff --git a/usr.sbin/pkg_add/pkg_add.1 b/usr.sbin/pkg_add/pkg_add.1 index ff84f9fb06c..2220029d2d1 100644 --- a/usr.sbin/pkg_add/pkg_add.1 +++ b/usr.sbin/pkg_add/pkg_add.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_add.1,v 1.20 2004/11/07 13:47:12 espie Exp $ +.\" $OpenBSD: pkg_add.1,v 1.21 2004/11/11 12:15:28 espie Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -170,6 +170,10 @@ library specifications may not be fulfilled. install even if not running as root. .It Ar scripts install scripts may fail. +.It Ar update +unsafe update: old packing-list will run scripts that may fail. +.It Ar updatedepends +force update even if forward dependencies no longer match. .El .It Fl L Ar localbase Install a package under |