]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
readglobalconfig: Support Include
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 6 Mar 2015 19:19:11 +0000 (19:19 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 24 Mar 2015 18:53:52 +0000 (18:53 +0000)
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Osstest.pm
README

index 8e6338977a8a3849853ff103bff62157a64ae279..9fbadbdd2016ebcd712804f640f0d6cf97304b54 100644 (file)
@@ -20,6 +20,7 @@ use strict;
 use warnings;
 
 use POSIX;
+use File::Basename;
 
 BEGIN {
     use Exporter ();
@@ -120,7 +121,13 @@ sub readglobalconfig () {
            s/\s+$//;
            next if m/^\#/;
            next unless m/\S/;
-           if (m/^($cfgvar_re)\s+(\S.*)$/) {
+           if (m/^include\s+(\S.*)$/i) {
+               my $newfn = $1;
+               if ($newfn !~ m#^/|^\./#) {
+                   $newfn = dirname($cfgfile)."/".$newfn;
+               }
+               $readcfg->($newfn, 0);
+           } elsif (m/^($cfgvar_re)\s+(\S.*)$/) {
                $c{$1} = $2;
            } elsif (m/^($cfgvar_re)=\s*\<\<(\'?)(.*)\2\s*$/) {
                my ($vn,$qu,$delim) = ($1,$2,$3);
diff --git a/README b/README
index 9634185afd7b15c08b880f20b2087df732d6019a..0aaba2cbc21bb80d06b11aae516acdb719b9e061 100644 (file)
--- a/README
+++ b/README
@@ -276,6 +276,9 @@ To set a value to the empty string, say
 For an example see  ./standalone-config-example
 Values later in the file, or in a later file, take precedence.
 
+You can say `Include <filename>'.  <filename> is relative to the file
+doing the including, unless it starts with `/' or `./'.
+
 ========================================
 
 Important config settings for standalone mode: