parallel: Better error message if 'rsync' is not in $PATH.

This commit is contained in:
Ole Tange 2022-07-24 20:59:42 +02:00
parent 9a96fb0103
commit 14249876fc
12 changed files with 51 additions and 44 deletions

View file

@ -254,29 +254,24 @@ from:tange@gnu.org
to:parallel@gnu.org, bug-parallel@gnu.org to:parallel@gnu.org, bug-parallel@gnu.org
stable-bcc: Jesse Alama <jessealama@fastmail.fm> stable-bcc: Jesse Alama <jessealama@fastmail.fm>
Subject: GNU Parallel 20220722 ('Roe vs Wade') released Subject: GNU Parallel 20220822 ('<<>>') released
GNU Parallel 20220722 ('Roe vs Wade') has been released. It is available for download at: lbry://@GnuParallel:4 GNU Parallel 20220822 ('<<>>') has been released. It is available for download at: lbry://@GnuParallel:4
Quote of the month: Quote of the month:
The syntax for GNU Parallel is so slick that I often use it just to make my script read nicer, and the parallelism is a cherry on top. <<>>
-- Epistaxis@reddit
New in this release: New in this release:
* --colour-failed will color output red if the job fails. <<>>
* sql: support for InfluxDB.
* Polarhome.com is dead, so these OSs are no longer supported: AIX HPUX IRIX Minix OPENSTEP OpenIndiana OpenServer QNX Solaris Syllable Tru64 Ultrix UnixWare.
* Bug fixes and man page updates. * Bug fixes and man page updates.
News about GNU Parallel: News about GNU Parallel:
* GNU Parallel used in "Hitting the Target" https://www.centrefornetzero.org/wp-content/uploads/2022/05/ABM-Report-Final.pdf <<>>
GNU Parallel - For people who live life in the parallel lane. GNU Parallel - For people who live life in the parallel lane.

View file

@ -395,7 +395,7 @@ _parset_main() {
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
# shellcheck disable=SC2006 # shellcheck disable=SC2006
echo "parset 20220722 (GNU parallel `parallel --minversion 1`)" echo "parset 20220723 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -397,7 +397,7 @@ _parset_main() {
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
# shellcheck disable=SC2006 # shellcheck disable=SC2006
echo "parset 20220722 (GNU parallel `parallel --minversion 1`)" echo "parset 20220723 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -395,7 +395,7 @@ _parset_main() {
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
# shellcheck disable=SC2006 # shellcheck disable=SC2006
echo "parset 20220722 (GNU parallel `parallel --minversion 1`)" echo "parset 20220723 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -378,7 +378,7 @@ _parset_main() {
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
# shellcheck disable=SC2006 # shellcheck disable=SC2006
echo "parset 20220722 (GNU parallel `parallel --minversion 1`)" echo "parset 20220723 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -380,7 +380,7 @@ _parset_main() {
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
# shellcheck disable=SC2006 # shellcheck disable=SC2006
echo "parset 20220722 (GNU parallel `parallel --minversion 1`)" echo "parset 20220723 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -395,7 +395,7 @@ _parset_main() {
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
# shellcheck disable=SC2006 # shellcheck disable=SC2006
echo "parset 20220722 (GNU parallel `parallel --minversion 1`)" echo "parset 20220723 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -370,7 +370,7 @@ _parset_main() {
fi fi
if [ "$_parset_NAME" = "--version" ] ; then if [ "$_parset_NAME" = "--version" ] ; then
# shellcheck disable=SC2006 # shellcheck disable=SC2006
echo "parset 20220722 (GNU parallel `parallel --minversion 1`)" echo "parset 20220723 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software" echo "Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc." echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>" echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -26,7 +26,7 @@
use strict; use strict;
use Getopt::Long; use Getopt::Long;
$Global::progname="niceload"; $Global::progname="niceload";
$Global::version = 20220722; $Global::version = 20220723;
Getopt::Long::Configure("bundling","require_order"); Getopt::Long::Configure("bundling","require_order");
get_options_from_array(\@ARGV) || die_usage(); get_options_from_array(\@ARGV) || die_usage();
if($opt::version) { if($opt::version) {

View file

@ -2658,7 +2658,7 @@ sub check_invalid_option_combinations() {
sub init_globals() { sub init_globals() {
# Defaults: # Defaults:
$Global::version = 20220722; $Global::version = 20220723;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$::name = "GNU Parallel"; $::name = "GNU Parallel";
$Global::infinity = 2**31; $Global::infinity = 2**31;
@ -8644,36 +8644,48 @@ sub rsync_transfer_cmd($) {
$self->rsync()." $file ".$self->{'host'}.":$rsync_destdir"); $self->rsync()." $file ".$self->{'host'}.":$rsync_destdir");
} }
{
my $rsync_protocol;
sub rsync($) { sub rsync($) {
sub rsync_protocol { sub rsync_protocol {
# rsync 3.1.x uses protocol 31 which is unsupported by 2.5.7. # rsync 3.1.x uses protocol 31 which is unsupported by 2.5.7.
# If the version >= 3.1.0: downgrade to protocol 30 # If the version >= 3.1.0: downgrade to protocol 30
# Returns: # Returns:
# $rsync = "rsync" or "rsync --protocol 30" # $rsync = "rsync" or "rsync --protocol 30"
if(not $Global::rsync_protocol) { if(not $rsync_protocol) {
my @out = `rsync --version`; my @out = `rsync --version`;
if(not @out) {
if(::which("rsync")) {
::die_bug("'rsync --version' gave no output.");
} else {
::error("'rsync' is not in \$PATH.");
::wait_and_exit(255);
}
}
for (@out) { for (@out) {
# rsync version 3.1.3 protocol version 31 # rsync version 3.1.3 protocol version 31
# rsync version v3.2.3 protocol version 31 # rsync version v3.2.3 protocol version 31
if(/version v?(\d+.\d+)(.\d+)?/) { if(/version v?(\d+.\d+)(.\d+)?/) {
if($1 >= 3.1) { if($1 >= 3.1) {
# Version 3.1.0 or later: Downgrade to protocol 30 # Version 3.1.0 or later: Downgrade to protocol 30
$Global::rsync_protocol = "rsync --protocol 30"; $rsync_protocol = "rsync --protocol 30";
} else { } else {
$Global::rsync_protocol = "rsync"; $rsync_protocol = "rsync";
} }
} }
} }
$Global::rsync_protocol or $rsync_protocol or
::die_bug("Cannot figure out version of rsync: @out"); ::die_bug("Cannot figure out version of rsync: @out");
} }
return $Global::rsync_protocol; return $rsync_protocol;
} }
my $self = shift; my $self = shift;
return rsync_protocol()." ".$ENV{'PARALLEL_RSYNC_OPTS'}. return rsync_protocol()." ".$ENV{'PARALLEL_RSYNC_OPTS'}.
" -e".::Q($self->sshcmd()); " -e".::Q($self->sshcmd());
} }
}
sub cleanup_cmd($$$) { sub cleanup_cmd($$$) {
# Command to run to remove the remote file # Command to run to remove the remote file

View file

@ -122,7 +122,7 @@ GetOptions(
"help" => \$opt::dummy, "help" => \$opt::dummy,
) || exit(255); ) || exit(255);
$Global::progname = ($0 =~ m:(^|/)([^/]+)$:)[1]; $Global::progname = ($0 =~ m:(^|/)([^/]+)$:)[1];
$Global::version = 20220722; $Global::version = 20220723;
if($opt::version) { version(); exit 0; } if($opt::version) { version(); exit 0; }
@Global::sortoptions = grep { ! /^-D$/ } @Global::sortoptions = grep { ! /^-D$/ }
shell_quote(@ARGV_before[0..($#ARGV_before-$#ARGV-1)]); shell_quote(@ARGV_before[0..($#ARGV_before-$#ARGV-1)]);

View file

@ -667,7 +667,7 @@ $Global::Initfile && unlink $Global::Initfile;
exit ($err); exit ($err);
sub parse_options { sub parse_options {
$Global::version = 20220722; $Global::version = 20220723;
$Global::progname = 'sql'; $Global::progname = 'sql';
# This must be done first as this may exec myself # This must be done first as this may exec myself