parallel: Fixed {= {= =} =}, {= =}=}, {={= =}

Conflicts:
	doc/release_new_version
This commit is contained in:
Ole Tange 2015-01-02 22:32:00 +01:00
parent 98ff943df2
commit 2b33c5b034
7 changed files with 91 additions and 15 deletions

View file

@ -226,9 +226,9 @@ cc:Tim Cuthbertson <tim3d.junk@gmail.com>,
Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>,
Jesse Alama <jesse.alama@gmail.com>
Subject: GNU Parallel 20141222 ('') released
Subject: GNU Parallel 20141222 ('Manila') released
GNU Parallel 20141222 ('') has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/
GNU Parallel 20141222 ('Manila') has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/
Haiku of the month:
@ -238,6 +238,10 @@ New in this release:
* GNU Parallel was cited in: Parallel post-processing with MPI-Bash http://dl.acm.org/citation.cfm?id=2691137
* GNU Parallel: Open Source For You (OSFY) magazine, October 2013 edition http://www.shakthimaan.com/posts/2014/11/27/gnu-parallel/news.html
* コマンドを並列に実行するGNU parallelがとても便利 http://bicycle1885.hatenablog.com/entry/2014/08/10/143612
* Bug fixes and man page updates.
GNU Parallel - For people who live life in the parallel lane.

View file

@ -78,7 +78,7 @@ NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am README
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \

View file

@ -780,7 +780,7 @@ sub get_options_from_array {
sub parse_options {
# Returns: N/A
# Defaults:
$Global::version = 20141123;
$Global::version = 20141209;
$Global::progname = 'parallel';
$Global::infinity = 2**31;
$Global::debug = 0;
@ -6934,6 +6934,7 @@ sub new {
}
}
# Replace replacement strings with {= perl expr =}
@command = merge_rpl_parts(@command);
# Protect matching inside {= perl expr =}
# by replacing {= and =} with \257< and \257>
for(@command) {
@ -6941,7 +6942,10 @@ sub new {
::error("Command cannot contain the character \257. Use a function for that.\n");
::wait_and_exit(255);
}
s/\Q$Global::parensleft\E(.*?)\Q$Global::parensright\E/\257<$1\257>/gx;
# Needs to match rightmost left parens (Perl defaults to leftmost)
# to deal with: {={==}
# Disallow \257 to avoid nested {= {= =} =}
while(s/([^\257]*) \Q$Global::parensleft\E ([^\257]*?) \Q$Global::parensright\E /$1\257<$2\257>/gx) {}
}
for my $rpl (keys %Global::rpl) {
# Replace the short hand string with the {= perl expr =} in $command and $opt::tagstring
@ -7048,6 +7052,41 @@ sub new {
}, ref($class) || $class;
}
sub merge_rpl_parts {
# '{=' 'perlexpr' '=}' => '{= perlexpr =}'
# Input:
# @in = the @command as given by the user
# Uses:
# $Global::parensleft
# $Global::parensright
# Returns:
# @command with parts merged to keep {= and =} as one
my @in = @_;
my @out;
my $l = quotemeta($Global::parensleft);
my $r = quotemeta($Global::parensright);
while(@in) {
my $s = shift @in;
$_ = $s;
# Remove matching (right most) parens
while(s/(.*)$l.*?$r/$1/o) {}
if(/$l/o) {
# Missing right parens
while(@in) {
$s .= " ".shift @in;
$_ = $s;
while(s/(.*)$l.*?$r/$1/o) {}
if(not /$l/o) {
last;
}
}
}
push @out, $s;
}
return @out;
}
sub get {
my $self = shift;
if(@{$self->{'unget'}}) {

View file

@ -3058,7 +3058,7 @@ To submit your jobs to the queue:
You can of course use B<-S> to distribute the jobs to remote
computers:
true >jobqueue; tail -f jobqueue | parallel -S ..
true >jobqueue; tail -n+0 -f jobqueue | parallel -S ..
There is a a small issue when using GNU B<parallel> as queue
system/batch manager: You have to submit JobSlot number of jobs before

View file

@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "PARALLEL_TUTORIAL 1"
.TH PARALLEL_TUTORIAL 1 "2014-11-10" "20141022" "parallel"
.TH PARALLEL_TUTORIAL 1 "2014-11-26" "20141122" "parallel"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l

View file

@ -23,11 +23,22 @@ echo '### Test bug #43284: {%} and {#} with --xapply';
echo '**'
echo '### Test bug #43376: {%} and {#} with --pipe'
echo foo | parallel -q --pipe -k echo {#}
echo foo | parallel --pipe -k echo {%}
echo foo | parallel -q --pipe -k echo {%}
echo foo | parallel --pipe -k echo {#}
echo foo | parallel -q --pipe -k echo {#}
echo foo | parallel --pipe -k echo {%}
echo foo | parallel -q --pipe -k echo {%}
echo foo | parallel --pipe -k echo {#}
echo '**'
echo '### {= and =} in different groups'
parallel echo {= s/a/b/ =} ::: a
parallel echo {= s/a/b/=} ::: a
parallel echo {= s/a/b/=}{= s/a/b/=} ::: a
parallel echo {= s/a/b/=}{=s/a/b/=} ::: a
parallel echo {= s/a/b/=}{= {= s/a/b/=} ::: a
parallel echo {= s/a/b/=}{={=s/a/b/=} ::: a
parallel echo {= s/a/b/ =} {={==} ::: a
parallel echo {={= =} ::: a
parallel echo {= {= =} ::: a
parallel echo {= {= =} =} ::: a
EOF

View file

@ -16,13 +16,35 @@ echo '**'
**
echo '### Test bug #43376: {%} and {#} with --pipe'
### Test bug #43376: {%} and {#} with --pipe
echo foo | parallel -q --pipe -k echo {#}
echo foo | parallel -q --pipe -k echo {#}
1
echo foo | parallel --pipe -k echo {%}
echo foo | parallel --pipe -k echo {%}
1
echo foo | parallel -q --pipe -k echo {%}
echo foo | parallel -q --pipe -k echo {%}
1
echo foo | parallel --pipe -k echo {#}
echo foo | parallel --pipe -k echo {#}
1
echo '**'
**
echo '### {= and =} in different groups'
### {= and =} in different groups
parallel echo {= s/a/b/ =} ::: a
b
parallel echo {= s/a/b/=} ::: a
b
parallel echo {= s/a/b/=}{= s/a/b/=} ::: a
bb
parallel echo {= s/a/b/=}{=s/a/b/=} ::: a
bb
parallel echo {= s/a/b/=}{= {= s/a/b/=} ::: a
b{= b
parallel echo {= s/a/b/=}{={=s/a/b/=} ::: a
b{=b
parallel echo {= s/a/b/ =} {={==} ::: a
b {=a
parallel echo {={= =} ::: a
{=a
parallel echo {= {= =} ::: a
{= a
parallel echo {= {= =} =} ::: a
{= a =}