parallel: --sqlmaster +DBURL works with different commands.

This commit is contained in:
Ole Tange 2017-01-13 15:47:13 +01:00
parent 84f4a855a5
commit 01088177aa

View file

@ -1259,7 +1259,7 @@ sub check_invalid_option_combinations {
sub init_globals { sub init_globals {
# Defaults: # Defaults:
$Global::version = 20170101; $Global::version = 20170111;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$Global::infinity = 2**31; $Global::infinity = 2**31;
$Global::debug = 0; $Global::debug = 0;
@ -9187,6 +9187,8 @@ sub replaced {
# $self is actually a CommandLine-object, # $self is actually a CommandLine-object,
# but it looks nice to be able to say {= $job->slot() =} # but it looks nice to be able to say {= $job->slot() =}
my $job = $self; my $job = $self;
$perl_expressions_as_re =
join("|", map {s/^-?\d+//; "\Q$_\E"} keys %{$self->{'replacecount'}});
# Fish out the words that have replacement strings in them # Fish out the words that have replacement strings in them
for my $word ( for my $word (
fish_out_words_containing_replacement_strings()) { fish_out_words_containing_replacement_strings()) {
@ -9197,13 +9199,11 @@ sub replaced {
# for each arg: # for each arg:
# replace replacement strings with replacement in the word value # replace replacement strings with replacement in the word value
# push to replace word value # push to replace word value
$perl_expressions_as_re ||=
join("|", map {s/^-?\d+//; "\Q$_\E"} keys %{$self->{'replacecount'}});
for my $arg (@$argref) { for my $arg (@$argref) {
my $val = $word; my $val = $word;
# Replace {= perl expr =} with value for each arg # Replace {= perl expr =} with value for each arg
$val =~ s{\257<(-?\d+)?($perl_expressions_as_re)\257>} $val =~ s{\257<(-?\d+)?($perl_expressions_as_re)\257>}
{ {
if($1) { if($1) {
# Positional replace # Positional replace
# Find the relevant arg and replace it # Find the relevant arg and replace it
@ -9216,7 +9216,7 @@ sub replaced {
$normal_replace ||= 1; $normal_replace ||= 1;
($arg ? $arg->replace($2,$quote_arg,$self) : ""); ($arg ? $arg->replace($2,$quote_arg,$self) : "");
} }
}goxe; }gxe;
if($quote) { if($quote) {
CORE::push(@{$replace{::shell_quote_scalar($word)}}, CORE::push(@{$replace{::shell_quote_scalar($word)}},
::shell_quote_scalar($val)); ::shell_quote_scalar($val));