453302dd8926e2280b3ce82e5d65843ee3096c96
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
66 After you have setup a tree watch it with inotify and keep it
67 uptodate. Depends on inotify which probably only exists on linux.
80 pod2usage
(1) unless $Opt{source
} and $Opt{target
};
82 $ENV{RSYNC_PASSWORD
} = $Opt{password
} if $Opt{password
};
84 $Opt{"skip-deletes"} ||=0;
86 use File
::Rsync
::Mirror
::Recent
;
87 my $rrr = File
::Rsync
::Mirror
::Recent
->new
89 ignore_link_stat_errors
=> 1,
90 localroot
=> $Opt{target
},
91 ($Opt{tmpdir
} ?
(tempdir
=> $Opt{tmpdir
}) : ()),
92 remote
=> ($Opt{user
} ?
$Opt{user
} . '@' : '') . $Opt{source
},
93 max_files_per_connection
=> 20000,
100 timeout
=> 30, # do not allow rsync to hang for too long
101 ($Opt{tmpdir
} ?
('temp-dir' => $Opt{tmpdir
}) : ()),
103 verbose
=> $Opt{verbose
},
104 _runstatusfile
=> "recent-rmirror-state.yml",
105 # _logfilefordone => "recent-rmirror-donelog.log",
108 $rrr->rmirror ( "skip-deletes" => $Opt{"skip-deletes"}, loop => 1 );