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 exits.
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 File
::Rsync
::Mirror
::Recent
;
117 use Pod
::Usage
qw(pod2usage);
132 if ($Opt{'dry-run'}) {
133 die "FIXME: not yet implemented";
137 for my $opt (qw(local remote localroot)) {
138 if (defined $Opt{$opt}) {
139 push @constr, $opt => $Opt{$opt};
142 my $rf = File
::Rsync
::Mirror
::Recent
->new
145 # stupid, need no rsync options when running with -local!
154 unless ($rf->localroot) {
156 my $ldir = File
::Temp
::tempdir
(
160 $rf->localroot($ldir);
162 } elsif ($rf->local) {
164 die "need either --local option or both of --remote and --localroot";
166 for my $passthrough (
170 if (my $x = $Opt{$passthrough}) {
171 $rf->$passthrough($x);
176 for my $rsopt (@
{$Opt{rsync_options
}||[]}) {
177 my($key,$value) = $rsopt =~ /([^=]+)=(.+)/s;
178 $rsopt{$key} = $value;
180 $rf->rsync_options(\
%rsopt);
183 for my $opt (qw(after before max skip-deletes)) {
184 if (defined $Opt{$opt}) {
185 push @nopt, $opt => $Opt{$opt}
189 for my $opt (qw(path epoch type)) {
190 if (defined $Opt{"contains_$opt"}) {
191 $contains->{$opt} = $Opt{"contains_$opt"};
195 push @nopt, max
=> 1, contains
=> $contains;
201 scalar localtime($_->{epoch
}),
203 )} @
{ $rf->news(@nopt) };
211 # cperl-indent-level: 4