5 use Pod
::Usage
qw(pod2usage);
9 rrr-client - continously mirror recent updates
15 rrr-client --source some.mirror::module/ --target /some/dir/
23 my @opt = <<'=back' =~ /B<--(\S+)>/g;
27 Prints a brief message and exists.
31 Source to mirror from, including the name of the RECENT metadata file.
32 For example C<cpan-rsync.perl.org::CPAN/RECENT.recent>.
36 Destination directory for the mirror.
40 Username if the rsync source requires it.
44 Password if the rsync source requires it. Can also be set by setting
45 the environment variable RSYNC_PASSWORD.
47 =item B<--runstatusfile=s>
49 Only needed for debugging. Path to the internally used status file.
50 Argument is passed through to the File::Rsync::Mirror::Recent object.
52 =item B<--skip-deletes!>
54 Defaults to false. If true, skips all delete events in the index files
55 which means no files are being deleted that have been deleted upstream.
59 Directory for temporary files; should be on the same file system
60 partition as the C<--target> directory.
64 Defaults to false. Note: Older versions of rrr-client defaulted to
67 =item B<--verboselog=s>
69 Path to the logfile to write verbose progress information to.
75 Mirror a remote directory based on a set of RECENT* files provided by
89 pod2usage
(1) unless $Opt{source
} and $Opt{target
};
91 $ENV{RSYNC_PASSWORD
} = $Opt{password
} if $Opt{password
};
93 $Opt{"skip-deletes"} ||=0;
95 use File
::Rsync
::Mirror
::Recent
;
96 my $rrr = File
::Rsync
::Mirror
::Recent
->new
98 ignore_link_stat_errors
=> 1,
99 localroot
=> $Opt{target
},
100 ($Opt{tmpdir
} ?
(tempdir
=> $Opt{tmpdir
}) : ()),
101 remote
=> ($Opt{user
} ?
$Opt{user
} . '@' : '') . $Opt{source
},
102 max_files_per_connection
=> 20000,
109 timeout
=> 30, # do not allow rsync to hang for too long
110 ($Opt{tmpdir
} ?
('temp-dir' => $Opt{tmpdir
}) : ()),
112 verbose
=> $Opt{verbose
},
113 ($Opt{verboselog
} ?
(verboselog
=> $Opt{verboselog
}) : ()),
114 ($Opt{runstatusfile
} ?
(runstatusfile
=> $Opt{runstatusfile
}) : ()),
115 # _logfilefordone => "recent-rmirror-donelog.log",
118 $rrr->rmirror ( "skip-deletes" => $Opt{"skip-deletes"}, loop => 1 );