diff -r 2552664b674a -r 19639ba80436 bin/waitfordeb --- a/bin/waitfordeb Thu Apr 19 21:28:37 2012 +0200 +++ b/bin/waitfordeb Fri Aug 04 15:44:30 2017 +0200 @@ -15,13 +15,13 @@ $inotify->blocking(0); my %size; -my $exit_after; +my $deadline; my $ME = basename $0; sub delay_exit { my $fn = shift; - $exit_after = time + $to if $size{ basename $fn}; + $deadline = time + $to if $size{ basename $fn}; } sub verify_size { @@ -36,6 +36,8 @@ my $nfiles = 0; my $c = "$incoming/$ARGV[0]"; +my @cmd = ("$ENV{HOME}/bin/rpi", $c); + open C, '<', $c or die "Can't open '<$c': $!\n"; my $skip = 1; while () { @@ -64,12 +66,41 @@ do { $inotify->poll; - if (time > $exit_after) { + if (time > $deadline) { warn "$ME: file upload timed out.\n"; $done = 1; } $done = 1 unless %size; - exec "$ENV{HOME}/bin/rpi" if $done; + + if ($done) { + exec @cmd if @cmd; + exit; + } } while (sleep 1); + +__END__ + +=head1 NAME + +waitfordeb - watch incoming directory for debian package upload completion + +=head1 SYNOPSIS + +waitfordeb changesfile + +waitfordeb -m|--man + -h|--help + +=head1 DESCRIPTION + +In an ideal world every package maintainer would use a tool which reliably +uploads the changes file as the last file. But sometimes this does not happen +and reprepro may fail the import. + +=head1 AUTHORS + +Matthias Förste L<> + +=cut