diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2018-07-03 09:27:28 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2018-07-03 09:27:28 +0000 |
commit | 81d13ae5dfaa10acaebc5017c555c9f5fc8e9bc8 (patch) | |
tree | e344d03539014ed41028bf2b752e168ab404ee2a /usr.sbin/pkg_add | |
parent | 76119618f3bcaa0e790949f5a610bcf555028e62 (diff) |
add "superseded" scaffold.
fix logic of at-end tags, only execute the base tag when removing
and not replacing
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index c7e31ecb094..96aa1cfe519 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.263 2018/06/28 18:05:21 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.264 2018/07/03 09:27:27 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -1396,6 +1396,7 @@ my $cache = {}; my $subclass = { 'at-end' => 'Atend', + 'supersedes' => 'Supersedes', 'cleanup' => 'Cleanup' }; sub new @@ -1443,7 +1444,7 @@ sub add_tag $self->{list}{$tag->{expanded}} = 1; } # special case: we have to run things *now* if deleting - if ($mode eq 'delete' && $tag->{found_in_self}) { + if ($mode eq 'delete' && $tag->{found_in_self} && !$state->replacing) { $self->run_tag($state); delete $state->{atend}{$self->name}; } else { @@ -1502,6 +1503,20 @@ sub need_params 1 } +package OpenBSD::PackingElement::DefineTag::Supersedes; +our @ISA = qw(OpenBSD::PackingElement::DefineTag); + +sub add_tag +{ + my ($self, $tag, $mode, $state) = @_; + $state->{superseded}{$self->{params}} = 1; +} + +sub need_params +{ + 0 +} + package OpenBSD::PackingElement::Exec; our @ISA=qw(OpenBSD::PackingElement::ExeclikeAction); |