Subject: | compare-dest, copy-dest and link-dest do not support multiple entries |
The rsync options:
compare-dest
copy-dest
link-dest
can be given multiple times using a recent rsync executable but only
once with the File::Rsync wrapper. I wrote a small quick-and-dirty
proof-of-concept patch against version 0.42 which implements multiple
'link-dest' options (see attachment) by copying code also used for the
'exclude' option. It would be also nice if single link-dest could be
given as scalar and multiple as array, not always as array.
Subject: | Rsync.pm.patch |
--- File/Rsync.pm.bak 2008-10-01 13:59:21.000000000 +0100
+++ File/Rsync.pm 2008-10-01 13:55:46.000000000 +0100
@@ -184,7 +184,7 @@
'scalar' => {
qw(
address 0 include-from 0 protocol 0
- backup-dir 0 link-dest 0 read-batch 0
+ backup-dir 0 read-batch 0
block-size 0 log-format 0 rsh 0
bwlimit 0 max-delete 0 rsync-path 0
checksum-seed 0 max-size 0 suffix 0
@@ -202,10 +202,11 @@
# these can be specified multiple times and are additive, the doc also
# specifies that it is an ordered list so we must preserve that order
- 'exclude' => [],
- 'include' => [],
- 'filter' => [],
- 'literal' => [],
+ 'exclude' => [],
+ 'include' => [],
+ 'link-dest' => [],
+ 'filter' => [],
+ 'literal' => [],
# hostname of source, used if 'source' is an array reference
'srchost' => '',
@@ -337,6 +338,7 @@
if ( $hashopt eq 'exclude'
or $hashopt eq 'include'
or $hashopt eq 'filter'
+ or $hashopt eq 'link-dest'
or $hashopt eq 'literal' )
{
$tag = $hashopt;
@@ -435,7 +437,8 @@
or $opt eq 'srchost'
or $opt eq 'quote-dst'
or $opt eq 'quote-src'
- or $opt eq 'literal' )
+ or $opt eq 'literal'
+ or $opt eq 'link-dest' )
{
$self->{$opt} = $opts->{$opt};
}
@@ -493,6 +496,7 @@
}
foreach my $opt (
qw(path-to-rsync exclude include filter source srchost
+ link-dest
debug dest outfun errfun infun quote-dst quote-src literal)
)
{
@@ -569,6 +573,9 @@
foreach my $opt ( @{ $merged->{'filter'} } ) {
push @cmd, "--filter=$opt";
}
+ foreach my $opt ( @{ $merged->{'link-dest'} } ) {
+ push @cmd, "--link-dest=$opt";
+ }
if ( $merged->{'source'} ) {
if ( $merged->{'srchost'} ) {
push @cmd, "$merged->{'srchost'}:" . join ' ',