1 #!/usr/bin/perl -- -*- mode: cperl -*-
5 rrr-news - list files added to the dataset
17 my $optpod = <<'=back';
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.
33 (TBD) Do not really run the command, ...
37 Prints a brief message and exists.
41 Specifies a local principal file. Nothing is mirrored, the list is
42 constructed from local resources. Cannot be combined with the
45 =item B<--localroot=s>
47 Specifies the local root directory. C<--remote> must also be specified
48 and mirroring is happening implicitly. If missing, a temporary
49 directory is created to hold the data before constructing the list
50 (but this is inefficient in case the program is called again later
51 because the temporary directory is not persistent).
55 Limit the list to at max this many items.
59 Specifies the remote principal file in rsync notation. This implies
60 that the necessary remote files will be mirrored before constructing
63 =item B<--rsync_options|rsync=s@>
65 Multiple options in the form of key=value pairs. E.g.
67 --rsync=compress=1 --rsync=links=1
69 The options are passed to the underlying L<File::Rsync> objects.
71 =item B<--skip-deletes!>
73 Boolean. If true then delete events are skipped.
83 rersyncrecent is a project to get speedy rsync operation on large
84 trees over multiple hosts. It maintains a collection of files with
85 metadata (so called recentfiles) that represent overlapping timespans
86 of file change events.
88 rrr-news extracts from the recentfiles the new files added or
89 modified. The remote-principal-file is the rsync-notation for the
90 remote recentfile. The second argument is the path to the local mirror
91 directory. If you omit the second argument, a temporary directory is
100 use File
::Rsync
::Mirror
::Recent
;
102 use Pod
::Usage
qw(pod2usage);
105 my @opt = $optpod =~ /B<--(\S+)>/g;
119 if ($Opt{'dry-run'}) {
120 die "FIXME: not yet implemented";
124 for my $opt (qw(local remote localroot)) {
125 if (defined $Opt{$opt}) {
126 push @constr, $opt => $Opt{$opt};
129 my $rf = File
::Rsync
::Mirror
::Recent
->new
132 # stupid, need no rsync options when running wiht -local!
141 unless ($rf->localroot) {
143 my $ldir = File
::Temp
::tempdir
(
147 $rf->localroot($ldir);
149 } elsif ($rf->local) {
151 die "need either --local option or both of --remote and --localroot";
153 for my $passthrough (
157 if (my $x = $Opt{$passthrough}) {
158 $rf->$passthrough($x);
163 for my $rsopt (@
{$Opt{rsync_options
}||[]}) {
164 my($key,$value) = $rsopt =~ /([^=]+)=(.+)/s;
165 $rsopt{$key} = $value;
167 $rf->rsync_options(\
%rsopt);
170 for my $opt (qw(after before max skip-deletes)) {
171 if (defined $Opt{$opt}) {
172 push @nopt, $opt => $Opt{$opt}
175 print map { sprintf "%-20s %s\n", scalar localtime($_->{epoch
}), substr($_->{path
},8) } @
{ $rf->news(@nopt) };
183 # cperl-indent-level: 4