repurpose rrr-dirtyupdate to debug recentfiles that do not exist
[rersyncrecent.git] / bin / rrr-dirtyupdate
blob8757eaa78639f6fdbd173b51b4bfb1702d622d7b
1 #!/usr/bin/perl -- -*- mode: cperl -*-
3 =head1 NAME
5 rrr-dirtyupdate - add a file with an old timestamp to the dataset
7 =head1 SYNOPSIS
9 rrr-dirtyupdate [options] file epoch
11 =head1 OPTIONS
13 =over 8
15 =cut
17 my @opt = <<'=back' =~ /B<--(\S+)>/g;
19 =item B<--dry-run!>
21 (TBD) Do not really run the command, ...
23 =item B<--help|h>
25 Prints a brief message and exists.
27 =item B<--verbose|v+>
29 More feedback.
31 =back
33 =head1 DESCRIPTION
35 When you later discover missing files...
37 =head1 BUGS
39 This is slow: it calls aggregate twice with force which took 2 x 10-15 seconds on PAUSE.
41 =cut
44 use strict;
45 use warnings;
47 use File::Find qw(find);
48 use File::Rsync::Mirror::Recent;
49 use Getopt::Long;
50 use Pod::Usage qw(pod2usage);
52 our %Opt;
53 GetOptions(\%Opt,
54 @opt,
55 ) or pod2usage(1);
57 if ($Opt{help}) {
58 pod2usage(0);
61 unless (@ARGV) {
62 pod2usage(1);
65 # my($file,$epoch) = @ARGV; # XXX
67 if ($Opt{'dry-run'}) {
68 die "FIXME: not yet implemented";
71 my $rf = File::Rsync::Mirror::Recentfile->new_from_file
73 "/home/ftp/pub/PAUSE/authors/RECENT-1h.yaml",
75 unless ($rf) {
76 die "ALERT: Could not create an rf: $@";
78 my $sleep = 2;
79 warn "prove of concept for one file only. Last chance to hit ^C now to interrupt. sleeping $sleep";
80 sleep $sleep;
81 my $recent = File::Rsync::Mirror::Recent->new
83 local => "/home/ftp/pub/PAUSE/authors/RECENT-1h.yaml",
85 my $recentev = $recent->news();
86 for my $re (@$recentev) {
87 my $recfile = "/home/ftp/pub/PAUSE/authors/".$re->{path};
88 next if -f $recfile;
89 print "Not found: $recfile\n";
92 __END__
95 # Local Variables:
96 # mode: cperl
97 # coding: utf-8
98 # cperl-indent-level: 4
99 # End: