From 41302357a6f17bff2670a6860ac5dfa34f78e40d Mon Sep 17 00:00:00 2001 From: espie Date: Mon, 23 Oct 2023 08:37:45 +0000 Subject: [PATCH] add some limited capability to -DVAR+=value to be used with REGRESSION_TESTING, where it's somewhat inconvenient to know the full list in advance. --- usr.sbin/pkg_add/OpenBSD/Subst.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/Subst.pm b/usr.sbin/pkg_add/OpenBSD/Subst.pm index be0a9fe3693..dbc15dc10b7 100644 --- a/usr.sbin/pkg_add/OpenBSD/Subst.pm +++ b/usr.sbin/pkg_add/OpenBSD/Subst.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Subst.pm,v 1.21 2023/06/20 14:50:06 espie Exp $ +# $OpenBSD: Subst.pm,v 1.22 2023/10/23 08:37:45 espie Exp $ # # Copyright (c) 2008 Marc Espie # @@ -46,11 +46,15 @@ sub value($self, $k) sub parse_option($self, $opt) { - if ($opt =~ m/^([^=]+)\=(.*)$/o) { - my ($k, $v) = ($1, $2); + if ($opt =~ m/^([^=+]+)(\+?)\=(.*)$/o) { + my ($k, $plus, $v) = ($1, $2, $3); $v =~ s/^\'(.*)\'$/$1/; $v =~ s/^\"(.*)\"$/$1/; - $self->add($k, $v); + if ($plus && defined $self->{k}) { + $self->{$k} .= " $v"): + } else { + $self->add($k, $v); + } } else { $self->add($opt, 1); } -- 2.20.1