svn commit: r255790 - user/des/tinderbox
Dag-Erling Smørgrav
des at FreeBSD.org
Sun Sep 22 14:22:29 UTC 2013
Author: des
Date: Sun Sep 22 14:22:28 2013
New Revision: 255790
URL: http://svnweb.freebsd.org/changeset/base/255790
Log:
Add support for include statements.
Modified:
user/des/tinderbox/tbmaster.1
user/des/tinderbox/tbmaster.pl
Modified: user/des/tinderbox/tbmaster.1
==============================================================================
--- user/des/tinderbox/tbmaster.1 Sun Sep 22 14:21:40 2013 (r255789)
+++ user/des/tinderbox/tbmaster.1 Sun Sep 22 14:22:28 2013 (r255790)
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 22, 2013
+.Dd September 23, 2013
.Dt TBMASTER 1
.Os
.Sh NAME
@@ -110,7 +110,14 @@ Whitespace around the equal sign and aro
multiple values is optional.
.Pp
Blank lines are ignored, as is anything following a hash sign
-.Pq Dq # .
+.Pq Sq # .
+.Pp
+Additionally, the
+.Cm include
+statement can be used to include one configuration in another:
+.Bl -tag
+.It Cm include Ar otherconfig
+.El
.Pp
The following configuration variables are defined:
.Bl -tag -width 12n
@@ -166,7 +173,7 @@ A list of environment variables to pass
script.
Each value is the name and value of an environment variable, separated
by an equal sign
-.Pq Dq = .
+.Pq Sq = .
No default value.
.It HOME
.Pq Vt single
@@ -224,7 +231,7 @@ No default value.
Which architectures and machines to build for.
Each value is the name of an architecture, optionally followed by a
forward slash
-.Pq Dq /
+.Pq Sq /
and a machine name.
If the machine name is not specified, it is assumed to be identical to
the architecture name.
Modified: user/des/tinderbox/tbmaster.pl
==============================================================================
--- user/des/tinderbox/tbmaster.pl Sun Sep 22 14:21:40 2013 (r255789)
+++ user/des/tinderbox/tbmaster.pl Sun Sep 22 14:22:28 2013 (r255790)
@@ -154,6 +154,7 @@ sub clearconf() {
#
# Read in a configuration file
#
+sub readconf($);
sub readconf($) {
my $fn = shift;
@@ -167,34 +168,39 @@ sub readconf($) {
s/\s*(\#.*)?$//;
$line .= $_;
if (length($line) && $line !~ s/\\$/ /) {
- die("$fn: syntax error on line $n\n")
- unless ($line =~ m/^(\w+)\s*([+]?=)\s*(.*)$/);
- my ($key, $op, $val) = (uc($1), $2, $3);
- $val = ''
- unless defined($val);
- die("$fn: unknown keyword on line $n\n")
- unless (exists($CONFIG{$key}));
- if (ref($CONFIG{$key})) {
- my @a = split(/\s*,\s*/, $val);
- foreach (@a) {
- s/^\'([^\']*)\'$/$1/;
- }
- if ($op eq '=') {
- $CONFIG{$key} = \@a;
- } elsif ($op eq '+=') {
- push(@{$CONFIG{$key}}, @a);
+ if ($line =~ m/^include\s+([\w-]+)$/) {
+ readconf("$1.rc")
+ or die("$fn: include $1: $!\n");
+ } elsif ($line =~ m/^(\w+)\s*([+]?=)\s*(.*)$/) {
+ my ($key, $op, $val) = (uc($1), $2, $3);
+ $val = ''
+ unless defined($val);
+ die("$fn: $key is not a known keyword on line $n\n")
+ unless (exists($CONFIG{$key}));
+ if (ref($CONFIG{$key})) {
+ my @a = split(/\s*,\s*/, $val);
+ foreach (@a) {
+ s/^\'([^\']*)\'$/$1/;
+ }
+ if ($op eq '=') {
+ $CONFIG{$key} = \@a;
+ } elsif ($op eq '+=') {
+ push(@{$CONFIG{$key}}, @a);
+ } else {
+ die("can't happen\n");
+ }
} else {
- die("can't happen\n");
+ $val =~ s/^\'([^\']*)\'$/$1/;
+ if ($op eq '=') {
+ $CONFIG{$key} = $val;
+ } elsif ($op eq '+=') {
+ die("$fn: $key is not an array on line $n\n");
+ } else {
+ die("can't happen\n");
+ }
}
} else {
- $val =~ s/^\'([^\']*)\'$/$1/;
- if ($op eq '=') {
- $CONFIG{$key} = $val;
- } elsif ($op eq '+=') {
- die("$fn: invalid operator on line $n\n");
- } else {
- die("can't happen\n");
- }
+ die("$fn: syntax error on line $n\n")
}
$line = "";
}
More information about the svn-src-user
mailing list