[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#264774: Not sure if this is still interesting.



# This five year old bug deserves some love!
owner 264774 !
thanks

Lucas Nussbaum wrote:
> On 17/07/09 at 00:10 +0200, Niels Thykier wrote:
>> Hi
>>
>> I noticed that nothing has happened for a while on this, nevertheless
>> assuming it is still relevant or of interest, I have spent 30 min
>> cooking together a proof-of-concept perl script that can report old
>> RFP/ITP bugs.
>>
>> When ever it finds an old bug, it prints a comma separated line
>> formatted like this:
>>
>> $BUG_ID, $REPORT_DATE, $TAGS, $SUBJECT
>>
>> Notes: It does not check if $SUBJECT contains comma's so filters should
>> abuse that there are only four fields to split it correctly if they care
>> about the subject.
>>
>> I hope you find it useful.
> 
> Hi Niels,
> 
> I think that this bug was "fixed" by a script that is run on a
> regular basis and closes old RFP. See for example
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=137712#22
> 
> However, I can't find any mention of this script still running: there
> are indeed old RFPs still open.
> 
> Now, looking specifically at your script, another way to list such RFPs
> would be to use UDD (http://udd.debian.org/). Your script is fine, but
> you might want to take a look anyway.

Hi again

Turns out that this UDD is not very hard (and vastly faster), so here
goes the UDD version - It still does not auto-close bugs though.

I did, however, have some fun creating a "create email" feature for
it[1] - though I think it would be better rewritten as a "one email per
bug" and piped to sendmail (or something like that) instead of the "CC
bomb" it is currently doing.

I am still going to send David Moreno Garza an email and ask about the
script - David may have thought of some things I forgot or did not consider.

~Niels

[1] The contents of the email is largely stolen from the original script.
#!/usr/bin/perl -T
#
# Polls UDD and finds old wnpp bugs based on 
# "last modified" date.
#
# Supports the following CGI parameters:
#  * packages=<int> - if non-zero add RFP/ITP bugs to output.
#  * orphaned=<int> - if non-zero add O bugs to output.
#  * adopts=<int>   - if non-zero add RFA/ITA bugs to output.
#  * rfhelp=<int>   - if non-zero add RFH bugs to output.
#
#  * email=<int>    - if non-zero it will ignore all of the above,
#                     scan for old RFP and create an email to 
#                     close them.
#  * from=<addr>    - if email is non-zero it is used as the 
#                     "from" address. It can be of the form
#                     "name <from@domain.com>" or 
#                     "<form@domain.com>". Others (should)
#                     cause a reject.
#
# If none of them are "enabled" (incl. email), it will default to
# showing RFP/ITP.
#
# Niels Thykier <niels@thykier.net>
#

use strict;
use warnings;

use CGI;
use DBI;


my $q = new CGI;
my $packs    = $q->param('packages')//0;
my $orphaned = $q->param('orphaned')//0;
my $adopts   = $q->param('adopts')//0;
my $rfhelp   = $q->param('rfhelp')//0;
my $email    = $q->param('email')//0;
my $from     = $q->param('from')//'debian-qa@debian.org';
my @req;
my $titles = '';
my $addregex = qr/[^\@<]+\@[^@]+\.[a-zA-Z]{2,4}/o;
my $age = "1 year";
my $bugtype = 'RFP';

if(!$email) {
    if(!($rfhelp || $orphaned || $adopts)){
	# Always do something!
	$packs = 1;
    }
    
    push(@req, "title LIKE 'RFP:%' OR title LIKE 'ITP:%'") if($packs);
    push(@req, "title LIKE 'O:%'") if($orphaned);
    push(@req, "title LIKE 'RFA:%' OR title LIKE 'ITA:%'") if($adopts);
    push(@req, "title LIKE 'RFH:%'") if($rfhelp);
    $titles = join(' OR ', @req);
} else {
    if($from !~ m/^${addregex}$/ && 
	$from !~ m/^[^<]+<${addregex}>[ \t]*$/){
	die("At least try to make the from email look like a valid address, ");
    }
    $titles = "title LIKE '" . ${bugtype}. ":%'";
}

my $s = <<EOF
	SELECT id, last_modified, title FROM bugs
	WHERE 
	       package = 'wnpp' AND
	       NOT EXISTS (
		   SELECT 1 FROM bugs_tags 
		   WHERE bugs_tags.id = bugs.id AND (
		       bugs_tags.tag = 'fixed' OR
		       bugs_tags.tag = 'pending'
		   )
	       ) AND done = '' AND status <> 'reopened' AND
	       last_modified < (NOW() - interval '$age') AND
	       (
		   $titles
	       )
EOF
; 

my $dbh = DBI->connect("dbi:Pg:dbname=udd;port=5441;host=localhost", "guest") or die $!;
my $sth = $dbh->prepare( $s );


$sth->execute() or print "$s\n" and die($!);

print $q->header(-type => 'text/plain');


if($email){
    my $at = '@';
    my $address;
    $from=~m/($addregex)/;
    $address = $1;
    print <<EOF
To: Debian QA <debian-qa${at}bugs.debian.org>
From: $from
EOF
;

    while(my @row = $sth->fetchrow_array() ) {
	print "CC: ". $row[0] . "-done${at}bugs.debian.org\n"
    }
    print "Subject: Auto-close of old ${bugtype} bugs.\n";

    print <<EOF

Hello,

This is an automatic mail sent to close the ${bugtype} you have reported or 
are involved with.

Your ${bugtype} wnpp bug is being closed because of the following reasons:
- It is, as of today, older than $age.
- It haven\'t had any activity recently.
- The amount of ITPs on the Debian BTS is huge and we need to
  clean up a bit the place.

As this an automatic procedure, it could of course have done 
something wrong and probably it would be closing some bugs that are 
not intended by owners and submitters (like you) to be closed, for
example if the ${bugtype} is still of your interest, or there has been 
some kind of activity around it. In that case, please reopen the
bug, do it, DO IT NOW! (I don\'t want to be blamed because of
mass closing and not let people know that they can easily reopen
their bugs ;-).

To re-open it, you simply have to mail <control${at}bugs.debian.org>
with a body text like this:

reopen 123456
thanks

Replacing '123456' for the number of your ${bugtype} bug. The subject of the
mail is ignored. Or if you have any kind of problems when dealing with
the BTS, feel free to contact me and I\'d be more than happy to help
you on this: <$address>

Thanks for your cooperation,
EOF
;

} else {
    print "$s\n\n";

    while(my @row = $sth->fetchrow_array() ) {
	print join("\t", @row) . "\n";
    }
}

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: