summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2016-06-21 10:40:38 +0000
committerMarc Espie <espie@cvs.openbsd.org>2016-06-21 10:40:38 +0000
commit8d8fcf0f7d6881a4930a288aec42dc596d821446 (patch)
treeb2ec0f3ff43e55113d96d7fbbad3719d73c45c6e /usr.sbin/pkg_add
parent5c73943d26a35f577297998a34857106f719cf45 (diff)
pass file name thru to Subst for better error messages.
reported by Adam Wolk
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCreate.pm10
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Subst.pm8
2 files changed, 9 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
index 47ce044eb35..32e95eb2433 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
@@ -1,6 +1,6 @@
#! /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>
#
@@ -1027,9 +1027,9 @@ our @ISA = qw(OpenBSD::AddCreateDelete);
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;
@@ -1067,7 +1067,7 @@ sub read_fragments
$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;
}
@@ -1235,8 +1235,8 @@ sub create_plist
$state->set_status("reading plist");
}
$self->read_all_fragments($state, $plist);
-
$plist->set_pkgname($pkgname);
+
$self->add_elements($plist, $state);
return $plist;
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Subst.pm b/usr.sbin/pkg_add/OpenBSD/Subst.pm
index 5a94cee98c5..322f96cc184 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.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>
#
@@ -101,18 +101,18 @@ sub copy
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";
}
}