1 #!/usr/bin/perl -- -*- mode: cperl -*-
5 rrr-dirtyupdate - add a file with an old timestamp to the dataset
9 rrr-dirtyupdate [options] principalfile file [epoch]
11 rrr-dirtyupdate --force principalfile
19 my @opt = <<'=back' =~ /B<--(\S+)>/g;
23 Inject a delete event. If the epoch argument is missing, find the
24 according file event and set epoch to that epoch plus 1.
28 Force this run even without any arguments. E.g. just for the side
29 effect of running an aggregate call.
33 Prints a brief message and exists.
43 When you later discover missing files...
45 The principalfile argument is the path to local principal recentfile.
47 The file argument must be an existing file.
49 If the epoch argument is missing it is calculated from the
50 modification time of the file.
54 This is slow: it calls aggregate twice with force which took 2 x 10-20 seconds on PAUSE.
62 use File
::Find
qw(find);
63 use lib
"/home/k/sources/rersyncrecent/lib";
64 use File
::Rsync
::Mirror
::Recent
;
66 use Pod
::Usage
qw(pod2usage);
77 my $aggregate_only = 0;
84 } elsif (@ARGV >= 3) {
88 my($principal,$file,$epoch) = @ARGV;
89 my $recc = File
::Rsync
::Mirror
::Recent
->new
90 (local => $principal);
91 my($rf) = $recc->principal_recentfile;
93 unless ($aggregate_only) {
94 unless (defined $epoch) {
96 warn "not yet implemented???";
97 my $news = $recc->news(contains
=> $file);
99 print YAML
::Syck
::Dump
$news;
103 my(@stat) = stat $file or die "Could not stat '$file': $!";
107 my $type = $Opt{delete} ?
"delete" : "add";
108 $rf->update($file,$type,$epoch);
110 warn localtime()." starting first aggregate\n";
111 $rf->aggregate(force
=> 1);
112 warn localtime()." starting second aggregate\n";
113 $rf->aggregate(force
=> 1);
114 warn localtime()." finished\n";
123 # cperl-indent-level: 4