From 77f83e62703d80aad4383cc266ffc826c191c3c8 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Fri, 3 Dec 2010 00:04:12 +0100 Subject: [PATCH] basenamereplace and basenameextensionreplace activated. Testsuite of {/} {/.} {#/.} {#/}. --- doc/promo | 6 ++++ doc/release_new_version | 7 +++-- packager/obs/Makefile | 8 ++---- packager/obs/README | 5 +++- src/parallel | 40 +++++++++++++------------- testsuite/tests-to-run/test42.sh | 34 ++++++++++++++++++++++ testsuite/wanted-results/test42 | 48 ++++++++++++++++++++++++++++++++ 7 files changed, 120 insertions(+), 28 deletions(-) create mode 100644 testsuite/tests-to-run/test42.sh create mode 100644 testsuite/wanted-results/test42 diff --git a/doc/promo b/doc/promo index 937bfde4..99d6a6c2 100644 --- a/doc/promo +++ b/doc/promo @@ -25,6 +25,12 @@ http://nd.gd/0s http://www.youtube.com/watch?v=OpaiGYxkSuQ http://nd.gd/0t http://en.wikipedia.org/wiki/Xargs#The_separator_problem http://nd.gd/3k http://www.gnu.org/software/parallel/man.html#differences_between_xargs_and_gnu_parallel +If you like xargs you may love GNU Parallel: http://nd.gd/0s + + +With GNU Parallel (http://nd.gd/0s) you can do: +ls | grep jpeg | parallel mv {} {.}.jpg + Watch the intro video for GNU Parallel: http://nd.gd/0s If your input file names are generated by users, you need to deal with diff --git a/doc/release_new_version b/doc/release_new_version index 2f7d8a90..e3de93f7 100644 --- a/doc/release_new_version +++ b/doc/release_new_version @@ -81,8 +81,9 @@ Content from release mail: https://savannah.gnu.org/news/submit.php?group=parallel https://savannah.gnu.org/news/approve.php?group=parallel -doc/pod2savannah_publicinfo src/parallel | klipper-stdin -https://savannah.gnu.org/project/admin/editgroupinfo.php?group=parallel +# No longer updated. Too long and too buggy +# doc/pod2savannah_publicinfo src/parallel | klipper-stdin +# https://savannah.gnu.org/project/admin/editgroupinfo.php?group=parallel == Update website == @@ -101,7 +102,7 @@ http://freshmeat.net/projects/parallel/releases/new == Update Twitter == -#GNU Parallel 20101113 released. See what is new in this release +New version of #GNU Parallel released. See what is new in this release http://nd.gd/2j Watch the intro video http://nd.gd/0s https://savannah.gnu.org/news/?group=parallel diff --git a/packager/obs/Makefile b/packager/obs/Makefile index 58c925ba..669a4a84 100644 --- a/packager/obs/Makefile +++ b/packager/obs/Makefile @@ -1,7 +1,5 @@ all: -# cd ../debian/ && make -# cp ../debian/parallel_*.dsc ../debian/parallel_*.tar.gz home\:tange/parallel/ + cd ../debian/ && make + cp ../debian/parallel_*.dsc ../debian/parallel_*.tar.gz home\:tange/parallel/ cp `ls ../../parallel-*.tar.bz2|tail -n1` home\:tange/parallel/ - cd home\:tange/parallel/ && osc up && osc add *.dsc *.tar.gz && osc ci - - + cd home\:tange/parallel/ && osc up && osc add *.dsc *.tar.gz *.spec *.tar.bz2 && osc ci diff --git a/packager/obs/README b/packager/obs/README index 891e733b..de11edcf 100644 --- a/packager/obs/README +++ b/packager/obs/README @@ -1 +1,4 @@ -https://build.opensuse.org/package/show?package=parallel&project=home%3Atange +make +Edit parallel.spec +Then go to https://build.opensuse.org/package/files?package=parallel&project=home%3Atange +and add all the files diff --git a/src/parallel b/src/parallel index a3f440e7..a95c4645 100755 --- a/src/parallel +++ b/src/parallel @@ -84,7 +84,7 @@ B<{.}> can be used the same places as B<{}>. The replacement string B<{.}> can be changed with B<-U>. -=item B<{/}> (unimplemented) +=item B<{/}> (beta testing) Basename of input line. This is a specialized replacement string with the directory part removed. @@ -93,7 +93,7 @@ B<{/}> can be used the same places as B<{}>. The replacement string B<{/}> can be changed with B<--basenamereplace>. -=item B<{/.}> (unimplemented) +=item B<{/.}> (beta testing) Basename of input line without extension. This is a specialized replacement string with the directory and extension part removed. It @@ -119,7 +119,7 @@ extension. It is a combination of B<{>IB<}> and B<{.}>. B<{>I.B<}> can be used the same places as B<{>IB<}>. -=item B<{>I/B<}> (unimplemented) +=item B<{>I/B<}> (beta testing) Basename of argument from argument file I or the I'th argument. It is a combination of B<{>IB<}> and B<{/}>. See B<-a> and B<-N>. @@ -127,7 +127,7 @@ It is a combination of B<{>IB<}> and B<{/}>. See B<-a> and B<-N>. B<{>I/B<}> can be used the same places as B<{>IB<}>. -=item B<{>I/.B<}> (unimplemented) +=item B<{>I/.B<}> (beta testing) Basename of argument from argument file I or the I'th argument without extension. It is a combination of B<{>IB<}>, B<{/}>, and @@ -191,7 +191,7 @@ B<{6}> will refer to the line with the same line number from the 6th file. -=item B<--arg-file-sep> I (beta testing) +=item B<--arg-file-sep> I Use I instead of B<::::> as separator string between command and argument files. Useful if B<::::> is used for something else by the @@ -200,7 +200,7 @@ command. See also: B<::::>. -=item B<--arg-sep> I (beta testing) +=item B<--arg-sep> I Use I instead of B<:::> as separator string. Useful if B<:::> is used for something else by the command. @@ -223,12 +223,12 @@ Multiple B<-B> can be specified to transfer more basefiles. The I will be transferred the same way as B<--transfer>. -=item B<--basenamereplace> I (unimplemented) +=item B<--basenamereplace> I (beta testing) Use the replacement string I instead of B<{/}> for basename of input line. -=item B<--basenameextensionreplace> I (unimplemented) +=item B<--basenameextensionreplace> I (beta testing) Use the replacement string I instead of B<{/.}> for basename of input line without extension. @@ -264,9 +264,9 @@ removed on the remote server. Directories created will not be removed B<--cleanup> is ignored when not used with B<--transfer> or B<--return>. -=item B<--colsep> I (beta testing) +=item B<--colsep> I -=item B<-C> I (beta testing) +=item B<-C> I Column separator. The input will be treated as a table with I separating the columns. The n'th column can be access using @@ -460,13 +460,13 @@ If the evaluated number is less than 1 then 1 will be used. See also B<--use-cpus-instead-of-cores>. -=item B<--jobs> I (beta test) +=item B<--jobs> I -=item B<-j> I (beta test) +=item B<-j> I -=item B<--max-procs> I (beta test) +=item B<--max-procs> I -=item B<-P> I (beta test) +=item B<-P> I Read parameter from file. Use the content of I as parameter for I<-j>. E.g. I could contain the string 100% or +2 or @@ -558,9 +558,9 @@ GNU B will exit. Implies B<-X> unless B<-m> is set. -=item B<--max-replace-args>=I (beta test) +=item B<--max-replace-args>=I -=item B<-N> I (beta test) +=item B<-N> I Use at most I arguments per command line. Like B<-n> but also makes replacement strings B<{1}> .. B<{>IB<}> that @@ -696,7 +696,7 @@ operating system and the B<-s> option. Pipe the input from /dev/null to do anything. -=item B<--semaphore> (beta testing) +=item B<--semaphore> Work as a counting semaphore. B<--semaphore> will cause GNU B to start I in the background. When the number of @@ -713,7 +713,7 @@ Used with B<--fg>, B<--wait>, and B<--semaphorename>. The command B is an alias for B. -=item B<--semaphorename> I (beta testing) +=item B<--semaphorename> I =item B<--id> I @@ -844,7 +844,7 @@ Transfer, Return, Cleanup. Short hand for: B<--transfer> B<--return> I B<--cleanup> -=item B<--trim> (beta testing) +=item B<--trim> Trim white space in input. @@ -2578,6 +2578,8 @@ sub get_options_from_array { "quote|q" => \$::opt_q, "I=s" => \$::opt_I, "extensionreplace|U=s" => \$::opt_U, + "basenamereplace=s" => \$::opt_basenamereplace, + "basenameextensionreplace=s" => \$::opt_basenameextensionreplace, "jobs|j=s" => \$::opt_P, "max-line-length-allowed" => \$::opt_max_line_length_allowed, "number-of-cpus" => \$::opt_number_of_cpus, diff --git a/testsuite/tests-to-run/test42.sh b/testsuite/tests-to-run/test42.sh new file mode 100644 index 00000000..06b9e01e --- /dev/null +++ b/testsuite/tests-to-run/test42.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +echo "### Test --basenamereplace" +parallel -k -X --basenamereplace FOO echo FOO ::: /a/b.c a/b.c b.c /a/b a/b b +parallel -k --basenamereplace FOO echo FOO ::: /a/b.c a/b.c b.c /a/b a/b b + +echo "### Test --basenameextensionreplace" +parallel -k -X --basenameextensionreplace FOO echo FOO ::: /a/b.c a/b.c b.c /a/b a/b b +parallel -k --basenameextensionreplace FOO echo FOO ::: /a/b.c a/b.c b.c /a/b a/b b + +echo "### Test {/}" +parallel -k -X echo {/} ::: /a/b.c a/b.c b.c /a/b a/b b + +echo "### Test {/.}" +parallel -k -X echo {/.} ::: /a/b.c a/b.c b.c /a/b a/b b + +echo "### Test {#/.}" +parallel -k -X echo {2/.} ::: /a/number1.c a/number2.c number3.c /a/number4 a/number5 number6 + +echo "### Test {#/}" +parallel -k -X echo {2/} ::: /a/number1.c a/number2.c number3.c /a/number4 a/number5 number6 + +echo "### Test {#.}" +parallel -k -X echo {2.} ::: /a/number1.c a/number2.c number3.c /a/number4 a/number5 number6 + +SERVER1=parallel-server3 +SERVER2=parallel-server2 + +echo "### Test combined --return {/}_{/.}_{#/.}_{#/}_{#.}" +stdout parallel -k -Xv --cleanup --return tmp/{/}_{/.}_{2/.}_{2/}_{2.}/file -S parallel@$SERVER2 \ +mkdir -p tmp/{/}_{/.}_{2/.}_{2/}_{2.} \;touch tmp/{/}_{/.}_{2/.}_{2/}_{2.}/file \ +::: /a/number1.c a/number2.c number3.c /a/number4 a/number5 number6 +find tmp +rm -rf tmp diff --git a/testsuite/wanted-results/test42 b/testsuite/wanted-results/test42 new file mode 100644 index 00000000..9543c158 --- /dev/null +++ b/testsuite/wanted-results/test42 @@ -0,0 +1,48 @@ +### Test --basenamereplace +b.c b.c b.c b b b +b.c +b.c +b.c +b +b +b +### Test --basenameextensionreplace +b b b b b b +b +b +b +b +b +b +### Test {/} +b.c b.c b.c b b b +### Test {/.} +b b b b b b +### Test {#/.} +number2 +### Test {#/} +number2.c +### Test {#.} +a/number2 +### Test combined --return {/}_{/.}_{#/.}_{#/}_{#.} +Warning: using -X or -m with --sshlogin may fail +mkdir -p tmp/number1.c_number1_number2_number2.c_a/number2 tmp/number2.c_number2_number2_number2.c_a/number2 tmp/number3.c_number3_number2_number2.c_a/number2 tmp/number4_number4_number2_number2.c_a/number2 tmp/number5_number5_number2_number2.c_a/number2 tmp/number6_number6_number2_number2.c_a/number2 ;touch tmp/number1.c_number1_number2_number2.c_a/number2/file tmp/number2.c_number2_number2_number2.c_a/number2/file tmp/number3.c_number3_number2_number2.c_a/number2/file tmp/number4_number4_number2_number2.c_a/number2/file tmp/number5_number5_number2_number2.c_a/number2/file tmp/number6_number6_number2_number2.c_a/number2/file +tmp +tmp/number6_number6_number2_number2.c_a +tmp/number6_number6_number2_number2.c_a/number2 +tmp/number6_number6_number2_number2.c_a/number2/file +tmp/number3.c_number3_number2_number2.c_a +tmp/number3.c_number3_number2_number2.c_a/number2 +tmp/number3.c_number3_number2_number2.c_a/number2/file +tmp/number5_number5_number2_number2.c_a +tmp/number5_number5_number2_number2.c_a/number2 +tmp/number5_number5_number2_number2.c_a/number2/file +tmp/number2.c_number2_number2_number2.c_a +tmp/number2.c_number2_number2_number2.c_a/number2 +tmp/number2.c_number2_number2_number2.c_a/number2/file +tmp/number1.c_number1_number2_number2.c_a +tmp/number1.c_number1_number2_number2.c_a/number2 +tmp/number1.c_number1_number2_number2.c_a/number2/file +tmp/number4_number4_number2_number2.c_a +tmp/number4_number4_number2_number2.c_a/number2 +tmp/number4_number4_number2_number2.c_a/number2/file