Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[configure] Provide an additional pattern by which an entry in the 'g…

…eneral' section of a configuration file can be matched against a double-quoted string containing whitespace. Per git Issue #233.
  • Loading branch information...
commit f7cc9f9a82005046bf3456c160bc4245782226f7 1 parent 9691780
@jkeenan jkeenan authored
View
8 Configure.pl
@@ -459,7 +459,7 @@ =head1 CONFIGURATION-FILE INTERFACE
I<=variables> section of the configuration file (as above).
In addition, should you wish to use an option whose value contains whitespace
-and would, if presented on the command-line, require quoting, you should
+and would, if presented on the command-line, require quoting, you may
assign that string to a variable and then use the variable in the C<general>
section below.
@@ -494,6 +494,12 @@ =head1 CONFIGURATION-FILE INTERFACE
intval=$LONGLONG
+Alternatively, if assignment of a value to an option on the command-line would
+require quoting due to the presence of whitespace in the value, you may assign
+it to a value in the I<=general> section by double-quoting the value.
+
+ intval="long long"
+
=item *
You I<may> list options here which are I<conceptually> limited to a single
View
2  MANIFEST
@@ -524,6 +524,7 @@ examples/c/test_main.c [examples]
examples/compilers/Makefile [examples]
examples/compilers/japhc.c [examples]
examples/config/file/configcompiler [examples]
+examples/config/file/configverbose [examples]
examples/config/file/configwithfatalstep [examples]
examples/embed/Makefile [examples]
examples/embed/Makefile.msvc [examples]
@@ -1628,7 +1629,6 @@ t/configure/testlib/init/lambda.pm [test]
t/configure/testlib/init/mu.pm [test]
t/configure/testlib/init/zeta.pm [test]
t/configure/testlib/inter/theta.pm [test]
-t/configure/testlib/verbosefoobar [test]
t/distro/manifest.t [test]
t/distro/manifest_generated.t [test]
t/dynoplibs/bit.t [test]
View
1  examples/config/file/configcompiler
@@ -9,6 +9,7 @@ CX=/usr/bin/g++
cc=$CC
link=$CX
ld=/usr/bin/g++
+intval="long long"
=steps
View
0  t/configure/testlib/verbosefoobar → examples/config/file/configverbose
File renamed without changes
View
12 lib/Parrot/Configure/Options/Conf/File.pm
@@ -90,7 +90,17 @@ sub _set_general {
my ($data, $substitutions, $general, $optsref) = @_;
my @general = split /\n/, $general;
foreach my $g (@general) {
- next unless $g =~ m/^([-\w]+)(?:=(\$?[^\s\$]+))?$/;
+ next unless ( $g =~ m/^
+ ([-\w]+)
+ (?:=(
+ \S+ # Usual case: regular identifier; no spaces allowed in identifier
+ |
+ \$\S+ # Variable substitution; no spaces allowed in identifier
+ )
+ )?
+ $/x )
+ or
+ ( $g =~ m/^([-\w]+)="([^"]+)"$/ ); # Double-quoted string; spaces allowed
my ($k, $v, $prov, $var);
if ($2) {
($k, $prov) = ($1, $2);
View
59 t/configure/008-file_based_configuration.t
@@ -1,5 +1,5 @@
#! perl
-# Copyright (C) 2007-2010, Parrot Foundation.
+# Copyright (C) 2007-2011, Parrot Foundation.
# 008-file_based_configuration.t
use strict;
@@ -11,7 +11,7 @@ BEGIN {
our $topdir = realpath($Bin) . "/../..";
unshift @INC, qq{$topdir/lib};
}
-use Test::More tests => 30;
+use Test::More tests => 31;
use Carp;
use Parrot::Configure::Options qw| process_options |;
@@ -20,22 +20,22 @@ use Parrot::Configure::Options qw| process_options |;
my ($args, $steps_list_ref) = _test_good_config_file($configfile);
ok(! defined $args->{maintainer},
- "Configuring from testfoobar: 'maintainer' not defined, as expected");
+ "Configuring from $configfile: 'maintainer' not defined, as expected");
is($args->{'verbose-step'}, 'init::hints',
- "Configuring from testfoobar: 'init::hints' is verbose step");
+ "Configuring from $configfile: 'init::hints' is verbose step");
is($args->{'fatal-step'}, 'init::hints',
- "Configuring from testfoobar: 'init::hints' is fatal step");
+ "Configuring from $configfile: 'init::hints' is fatal step");
ok($args->{nomanicheck},
- "Configuring from testfoobar: will omit check of MANIFEST");
+ "Configuring from $configfile: will omit check of MANIFEST");
is($args->{file}, $configfile,
- "Configuring from testfoobar: config file correctly stored");
+ "Configuring from $configfile: config file correctly stored");
ok($args->{debugging},
- "Configuring from testfoobar: debugging turned on");
+ "Configuring from $configfile: debugging turned on");
my %steps_seen = map {$_ => 1} @{ $steps_list_ref };
ok(exists $steps_seen{'init::manifest'},
- "Configuring from testfoobar: init::manifest is in list even though it will be skipped");
+ "Configuring from $configfile: init::manifest is in list even though it will be skipped");
ok(! exists $steps_seen{'auto::perldoc'},
- "Configuring from testfoobar: auto::perldoc not in list");
+ "Configuring from $configfile: auto::perldoc not in list");
}
{
@@ -44,52 +44,55 @@ use Parrot::Configure::Options qw| process_options |;
my $c_compiler = '/usr/bin/gcc';
my $cplusplus_compiler = '/usr/bin/g++';
+ my $intval_setting = 'long long';
ok(! defined $args->{maintainer},
- "Configuring from yourfoobar: 'maintainer' not defined as expected");
+ "Configuring from $configfile: 'maintainer' not defined as expected");
is($args->{'verbose-step'}, 'init::hints',
- "Configuring from yourfoobar: 'init::hints' is verbose step");
+ "Configuring from $configfile: 'init::hints' is verbose step");
ok($args->{nomanicheck},
- "Configuring from yourfoobar: will omit check of MANIFEST");
+ "Configuring from $configfile: will omit check of MANIFEST");
is($args->{file}, $configfile,
- "Configuring from yourfoobar: config file correctly stored");
+ "Configuring from $configfile: config file correctly stored");
ok($args->{debugging},
- "Configuring from yourfoobar: debugging turned on");
+ "Configuring from $configfile: debugging turned on");
is($args->{cc}, $c_compiler,
- "Configuring from yourfoobar: C compiler is $c_compiler");
+ "Configuring from $configfile: C compiler is $c_compiler");
is($args->{link}, $cplusplus_compiler,
- "Configuring from yourfoobar: linker is $cplusplus_compiler");
+ "Configuring from $configfile: linker is $cplusplus_compiler");
is($args->{ld}, $cplusplus_compiler,
- "Configuring from yourfoobar: shared library loader is $cplusplus_compiler");
+ "Configuring from $configfile: shared library loader is $cplusplus_compiler");
+ is($args->{intval}, $intval_setting,
+ "Configuring from $configfile: 'intval' setting is $intval_setting");
my %steps_seen = map {$_ => 1} @{ $steps_list_ref };
ok(exists $steps_seen{'init::manifest'},
- "Configuring from yourfoobar: init::manifest is in list even though it will be skipped");
+ "Configuring from $configfile: init::manifest is in list even though it will be skipped");
ok(! exists $steps_seen{'auto::perldoc'},
- "Configuring from yourfoobar: auto::perldoc not in list");
+ "Configuring from $configfile: auto::perldoc not in list");
}
{
- my $configfile = q{t/configure/testlib/verbosefoobar};
+ my $configfile = q{examples/config/file/configverbose};
my ($args, $steps_list_ref) = _test_good_config_file($configfile);
ok(! defined $args->{maintainer},
- "Configuring from verbosefoobar: 'maintainer' not defined as expected");
+ "Configuring from $configfile: 'maintainer' not defined as expected");
ok($args->{nomanicheck},
- "Configuring from verbosefoobar: will omit check of MANIFEST");
+ "Configuring from $configfile: will omit check of MANIFEST");
is($args->{file}, $configfile,
- "Configuring from verbosefoobar: config file correctly stored");
+ "Configuring from $configfile: config file correctly stored");
ok($args->{debugging},
- "Configuring from verbosefoobar: debugging turned on");
+ "Configuring from $configfile: debugging turned on");
is($args->{verbose}, 1,
- "Configuring from verbosefoobar: verbose output is on");
+ "Configuring from $configfile: verbose output is on");
my %steps_seen = map {$_ => 1} @{ $steps_list_ref };
ok(exists $steps_seen{'init::manifest'},
- "Configuring from verbosefoobar: init::manifest is in list even though it will be skipped");
+ "Configuring from $configfile: init::manifest is in list even though it will be skipped");
ok(! exists $steps_seen{'auto::perldoc'},
- "Configuring from verbosefoobar: auto::perldoc not in list");
+ "Configuring from $configfile: auto::perldoc not in list");
}
{
Please sign in to comment.
Something went wrong with that request. Please try again.