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<--skip-deletes!>
49 Defaults to false. If true, skips all delete events in the index files
50 which means no files are being deleted that have been deleted upstream.
54 Directory for temporary files; should be on the same file system
55 partition as the C<--target> directory.
59 Defaults to false. Note: Older versions of rrr-client defaulted to
62 =item B<--verboselog=s>
64 Path to the logfile to write verbose progress information to.
70 Mirror a remote directory based on a set of RECENT* files provided by
84 pod2usage
(1) unless $Opt{source
} and $Opt{target
};
86 $ENV{RSYNC_PASSWORD
} = $Opt{password
} if $Opt{password
};
88 $Opt{"skip-deletes"} ||=0;
90 use File
::Rsync
::Mirror
::Recent
;
91 my $rrr = File
::Rsync
::Mirror
::Recent
->new
93 ignore_link_stat_errors
=> 1,
94 localroot
=> $Opt{target
},
95 ($Opt{tmpdir
} ?
(tempdir
=> $Opt{tmpdir
}) : ()),
96 remote
=> ($Opt{user
} ?
$Opt{user
} . '@' : '') . $Opt{source
},
97 max_files_per_connection
=> 20000,
104 timeout
=> 30, # do not allow rsync to hang for too long
105 ($Opt{tmpdir
} ?
('temp-dir' => $Opt{tmpdir
}) : ()),
107 verbose
=> $Opt{verbose
},
108 ($Opt{verboselog
} ?
(verboselog
=> $Opt{verboselog
}) : ()),
109 _runstatusfile
=> "recent-rmirror-state.yml",
110 # _logfilefordone => "recent-rmirror-donelog.log",
113 $rrr->rmirror ( "skip-deletes" => $Opt{"skip-deletes"}, loop => 1 );