X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=tools%2Fdebianqueued-0.9%2Fdebianqueued;h=7b025518e9aa1d054ab0fbc10e6f9d597f587a1e;hb=HEAD;hp=46ce787f64386c2246d09261f5e206fb388c278f;hpb=511f3b5c368cddd4cd4dc90a7741f7bc3989d479;p=dak.git diff --git a/tools/debianqueued-0.9/debianqueued b/tools/debianqueued-0.9/debianqueued index 46ce787f..7b025518 100755 --- a/tools/debianqueued-0.9/debianqueued +++ b/tools/debianqueued-0.9/debianqueued @@ -67,7 +67,7 @@ package main; ($main::hostname, undef, undef, undef, undef) = gethostbyname(hostname()); my %packages = (); -my $re_file_safe_prefix = qr/\A([a-zA-Z0-9][a-zA-Z0-9_.:~+-]*)/s; +my $re_file_safe_prefix = qr/\A([a-zA-Z0-9.][a-zA-Z0-9_.:~+-]*)/s; my $re_file_safe = qr/$re_file_safe_prefix\z/s; # extract -r and -k args @@ -622,7 +622,7 @@ sub process_changes($\@) { my ( $pgplines, @files, @filenames, @changes_stats, $failure_file, $retries, $last_retry, $upload_time, - $file, $do_report, $ls_l, $problems_reported, + $file, $do_report, $ls_l, $errs, $pkgname, $signator, $extralines ); local (*CHANGES); @@ -829,16 +829,6 @@ outer_loop: while () { } ## end for $file (@files) $do_report = ( time - $upload_time ) > $conf::problem_report_timeout; - $problems_reported = $changes_stats[ST_MODE] & S_ISGID; - - # if any of the files is newer than the .changes' ctime (the time - # we sent a report and set the sticky bit), send new problem reports - if ( $problems_reported && $changes_stats[ST_CTIME] < $upload_time ) { - $problems_reported = 0; - chmod +( $changes_stats[ST_MODE] &= ~S_ISGID ), $changes; - debug("upload_time>changes-ctime => resetting problems reported"); - } - debug("do_report=$do_report problems_reported=$problems_reported"); # now check all files for correct size and md5 sum for $file (@files) { @@ -847,12 +837,7 @@ outer_loop: while () { # could be an upload that isn't complete yet, be quiet, # but don't process the file; - msg( "log,mail", "$filename doesn't exist\n" ) - if $do_report && !$problems_reported; - msg( "log", "$filename doesn't exist (ignored for now)\n" ) - if !$do_report; - msg( "log", "$filename doesn't exist (already reported)\n" ) - if $problems_reported; + msg( "log", "$filename doesn't exist (ignored for now)\n" ); ++$errs; } elsif ( $file->{"stats"}->[ST_SIZE] < $file->{"size"} && !$do_report ) @@ -889,22 +874,7 @@ outer_loop: while () { msg( "log,mail", "All files it mentions are also removed:\n" ); msg( "log,mail", " ", join( ", ", @filenames ), "\n" ); rm( $changes, @filenames, $failure_file ); - } elsif ( $do_report && !$problems_reported ) { - - # otherwise, send a problem report, if not done already - msg( - "mail", - "Due to the errors above, the .changes file couldn't ", - "be processed.\n", - "Please fix the problems for the upload to happen.\n" - ); - - # remember we already have sent a mail regarding this file - debug("Sending problem report mail and setting SGID bit"); - my $mode = $changes_stats[ST_MODE] |= S_ISGID; - msg( "log", "chmod failed: $!" ) - if ( chmod( $mode, $changes ) != 1 ); - } ## end elsif ( $do_report && !$problems_reported) + } # else: be quiet @@ -1097,7 +1067,7 @@ sub process_commands($) { my $commands = shift; my ( @cmds, $cmd, $pgplines, $signator ); local (*COMMANDS); - my ( @files, $file, @removed, $target_delay ); + my ($file, @removed, $target_delay ); format_status_str( $main::current_changes, $commands ); $main::dstat = "c"; @@ -1190,6 +1160,7 @@ outer_loop: while () { next if @word < 1; if ( $word[0] eq "rm" ) { + my @files = (); foreach ( @word[ 1 .. $#word ] ) { my $origword = $_; if (m,^DELAYED/([0-9]+)-day/,) { @@ -2274,11 +2245,7 @@ sub send_mail($$$) { my $package = keys %main::packages ? join( ' ', keys %main::packages ) : ""; - use Email::Send; - - unless ( defined($Email::Send::Sendmail::SENDMAIL) ) { - $Email::Send::Sendmail::SENDMAIL = $conf::mail; - } + use Email::Sender::Simple; if ($conf::overridemail) { $addr = $conf::overridemail; @@ -2304,17 +2271,7 @@ __MESSAGE__ $message .= "\n$text"; $message .= "\nGreetings,\n\n\tYour Debian queue daemon (running on host $main::hostname)\n"; - my $mail = Email::Send->new; - for (qw[Sendmail SMTP]) { - $mail->mailer($_) and last if $mail->mailer_available($_); - } - - my $ret = $mail->send($message); - if ( $ret && $ret !~ /Message sent|success/ ) { - return 0; - } - - return 1; + return Email::Sender::Simple->try_to_send($message); } ## end sub send_mail($$$) #