#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgCreate.pm,v 1.191 2023/06/13 09:07:17 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.192 2023/06/20 14:50:05 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
package OpenBSD::PkgCreate;
our @ISA = qw(OpenBSD::AddCreateDelete);
-sub handle_fragment($self, $state, $old, $not, $frag, $, $, $msg)
+sub handle_fragment($self, $state, $old, $not, $frag, $location)
{
my $def = $frag;
- if ($state->{subst}->has_fragment($def, $frag, $msg)) {
+ if ($state->{subst}->has_fragment($state, $def, $frag, $location)) {
return undef if defined $not;
} else {
return undef unless defined $not;
if ($l =~ m/^(\!)?\%\%(.*)\%\%$/) {
$self->record_fragment($plist, $1, $2,
$file);
- if (my $f2 = $self->handle_fragment($state, $file, $1, $2, $l, $cont, $filename)) {
+ if (my $f2 = $self->handle_fragment($state, $file, $1, $2, $filename)) {
push(@$stack, $file);
$file = $f2;
}
# ex:ts=8 sw=4:
-# $OpenBSD: Subst.pm,v 1.20 2023/06/13 09:07:17 espie Exp $
+# $OpenBSD: Subst.pm,v 1.21 2023/06/20 14:50:06 espie Exp $
#
# Copyright (c) 2008 Marc Espie <espie@openbsd.org>
#
return $dest;
}
-sub has_fragment($self, $def, $frag, $msg)
+sub has_fragment($self, $state, $def, $frag, $location)
{
my $v = $self->value($def);
if (!defined $v) {
- die "Error: unknown fragment $frag in $msg";
+ $state->fatal("Unknown fragment #1 in #2",
+ $frag, $location);
} elsif ($v == 1) {
return 1;
} elsif ($v == 0) {
return 0;
} else {
- die "Incorrect define for $frag in $msg";
+ $state->fatal("Invalid fragment define #1=#2", $frag, $v);
}
}