5 read the build directories and the /tmp and the home directory and
6 merge them in such a way that we can say which distro dropped
16 use Time
::HiRes
qw(sleep);
18 my %ignore = map { ;"/tmp/$_" => 1; } ".X121-lock", ".UUID_NODEID";
19 for my $de (qw(.aptitude backup .bash_history .bash_logout .bash_profile .bashrc bin .ccache .cpan .cpanplus .cpanreporter .crossfire )) {
20 $ignore{"/home/sand/$de"} = 1;
23 cleanup
=> 30, # only for /tmp
26 GetOptions
(\
my %config,
27 (map { "$_=s" } keys %Config),
32 while (my($k,$v) = each %config) {
38 for my $dir (qw(/tmp /home/sand/.cpan/build /home/k/.cpan/build)) {
39 opendir my $dh, $dir or die "Couldn't opendir: $!";
40 push @all, map { "$dir/$_" } readdir $dh;
42 @all = grep { ! exists $ignore{$_} } @all;
43 my @rall = sort { $a->[1] <=> $b->[1] }
44 map { [$_, (stat$_)[9]] } @all;
45 DIRENT
: for my $dirent (@rall) {
46 if (my $cleanup_time = $Config{cleanup
}) {
47 if ($dirent->[0] =~ m
|^/tmp/........|) {
48 my $age = sprintf "%.4f", -M
$dirent->[0];
49 if ($age > $cleanup_time) {
51 warn "Going to rmtree '$dirent->[0]' age[$age]\n";
53 File
::Path
::rmtree
($dirent->[0]);
59 my @t = localtime($dirent->[1]);
62 my $sigil = -d
$dirent->[0] ?
"/" : "";
63 printf "%04d-%02d-%02dT%02d:%02d:%02d %6d %s%s\n", @t[5,4,3,2,1,0], -s
$dirent->[0], $dirent->[0], $sigil;
64 # printf "%s\n", $dirent->[0];