5 rrr-news - list files added to the dataset
17 my @opt = <<'=back' =~ /B<--(\S+)>/g;
21 List all new files after this point in time. The format of the
22 timestamp is the unix epoch in floating point notation as used by
23 recentfiles in general.
27 List all new files before this point in time. The format of the
28 timestamp is the unix epoch in floating point notation as used by
29 recentfiles in general.
31 =item B<--contains_epoch=s>
33 List this file if the epoch is in the collection. Implies --max=1. Can
34 be combined with the other contains_* options to form a logical AND.
36 =item B<--contains_path=s>
38 List this file if the path is in the collection. Implies --max=1. Can
39 be combined with the other contains_* options to form a logical AND.
41 =item B<--contains_type=s>
43 List this file if the type is in the collection. Implies --max=1. Can
44 be combined with the other contains_* options to form a logical AND.
48 (TBD) Do not really run the command, ...
52 Prints a brief message and exists.
56 Specifies a local principal file. Nothing is mirrored, the list is
57 constructed from local resources. Cannot be combined with the
60 =item B<--localroot=s>
62 Specifies the local root directory. C<--remote> must also be specified
63 and mirroring is happening implicitly. If missing, a temporary
64 directory is created to hold the data before constructing the list
65 (but this is inefficient in case the program is called again later
66 because the temporary directory is not persistent).
70 Limit the list to at max this many items.
74 Specifies the remote principal file in rsync notation. This implies
75 that the necessary remote files will be mirrored before constructing
78 =item B<--rsync_options|rsync=s@>
80 Multiple options in the form of key=value pairs. E.g.
82 --rsync=compress=1 --rsync=links=1
84 The options are passed to the underlying L<File::Rsync> objects.
86 =item B<--skip-deletes!>
88 Boolean. If true then delete events are skipped.
98 rersyncrecent is a project to get speedy rsync operation on large
99 trees over multiple hosts. It maintains a collection of files with
100 metadata (so called recentfiles) that represent adjacent overlapping
101 timespans of file change events.
103 rrr-news extracts from the recentfiles the new files added or
104 modified. The remote-principal-file is the rsync-notation for the
105 remote recentfile. The second argument is the path to the local mirror
106 directory. If you omit the second argument, a temporary directory is
115 use lib
"/home/k/sources/rersyncrecent/lib";
116 use File
::Rsync
::Mirror
::Recent
;
118 use Pod
::Usage
qw(pod2usage);
133 if ($Opt{'dry-run'}) {
134 die "FIXME: not yet implemented";
138 for my $opt (qw(local remote localroot)) {
139 if (defined $Opt{$opt}) {
140 push @constr, $opt => $Opt{$opt};
143 my $rf = File
::Rsync
::Mirror
::Recent
->new
146 # stupid, need no rsync options when running with -local!
155 unless ($rf->localroot) {
157 my $ldir = File
::Temp
::tempdir
(
161 $rf->localroot($ldir);
163 } elsif ($rf->local) {
165 die "need either --local option or both of --remote and --localroot";
167 for my $passthrough (
171 if (my $x = $Opt{$passthrough}) {
172 $rf->$passthrough($x);
177 for my $rsopt (@
{$Opt{rsync_options
}||[]}) {
178 my($key,$value) = $rsopt =~ /([^=]+)=(.+)/s;
179 $rsopt{$key} = $value;
181 $rf->rsync_options(\
%rsopt);
184 for my $opt (qw(after before max skip-deletes)) {
185 if (defined $Opt{$opt}) {
186 push @nopt, $opt => $Opt{$opt}
190 for my $opt (qw(path epoch type)) {
191 if (defined $Opt{"contains_$opt"}) {
192 $contains->{$opt} = $Opt{"contains_$opt"};
196 push @nopt, max
=> 1, contains
=> $contains;
202 scalar localtime($_->{epoch
}),
204 )} @
{ $rf->news(@nopt) };
212 # cperl-indent-level: 4