#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgCreate.pm,v 1.120 2016/04/25 10:12:58 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.121 2016/06/21 10:40:37 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
sub handle_fragment
{
- my ($self, $state, $old, $not, $frag, undef, $cont) = @_;
+ my ($self, $state, $old, $not, $frag, undef, $cont, $msg) = @_;
my $def = $frag;
- if ($state->{subst}->has_fragment($def, $frag)) {
+ if ($state->{subst}->has_fragment($def, $frag, $msg)) {
return undef if defined $not;
} else {
return undef unless defined $not;
$l = '@comment $'.'OpenBSD: '.basename($file->name).',v$';
}
if ($l =~ m/^(\!)?\%\%(.*)\%\%$/) {
- if (my $f2 = $self->handle_fragment($state, $file, $1, $2, $l, $cont)) {
+ if (my $f2 = $self->handle_fragment($state, $file, $1, $2, $l, $cont, $filename)) {
push(@$stack, $file);
$file = $f2;
}
$state->set_status("reading plist");
}
$self->read_all_fragments($state, $plist);
-
$plist->set_pkgname($pkgname);
+
$self->add_elements($plist, $state);
return $plist;
}
# ex:ts=8 sw=4:
-# $OpenBSD: Subst.pm,v 1.16 2014/03/18 18:53:29 espie Exp $
+# $OpenBSD: Subst.pm,v 1.17 2016/06/21 10:40:37 espie Exp $
#
# Copyright (c) 2008 Marc Espie <espie@openbsd.org>
#
sub has_fragment
{
- my ($self, $def, $frag) = @_;
+ my ($self, $def, $frag, $msg) = @_;
my $v = $self->value($def);
if (!defined $v) {
- die "Error: unknown fragment $frag";
+ die "Error: unknown fragment $frag in $msg";
} elsif ($v == 1) {
return 1;
} elsif ($v == 0) {
return 0;
} else {
- die "Incorrect define for $frag";
+ die "Incorrect define for $frag in $msg";
}
}