From 153ecd142ee2ebe6e98d7e0ca3353ccc46fffe58 Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Fri, 10 Sep 2010 21:17:36 +0200 Subject: [PATCH] Add gen-email Signed-off-by: Joerg Jaspert --- tools/gen-emails.pl | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 tools/gen-emails.pl diff --git a/tools/gen-emails.pl b/tools/gen-emails.pl new file mode 100755 index 00000000..cde1dd3a --- /dev/null +++ b/tools/gen-emails.pl @@ -0,0 +1,62 @@ +#!/usr/bin/perl + +# Copyright (C) 2010 Alexander Wirt +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, see . + +use warnings; +use strict; +use DBI; + +my $outfile = shift; + +if (! $outfile) { + print "Output Filename needed\n"; + exit 1; +} + +my $dbh = DBI->connect("DBI:Pg:dbname=backports"); + + +my $sth = $dbh->prepare( " + SELECT maintainer.name, + source.source, + max(source.version) + FROM source,source_suite, + maintainer + WHERE source.id = source_suite.src + AND source.changedby = maintainer.id + AND ( suite_name = 'lenny-backports' or suite_name = 'squeeze-backports' ) + GROUP BY source.source,maintainer.name; +"); + +if ( !defined $sth ) { + die "Cannot prepare statement: $DBI::errstr\n"; +} + +$sth->execute or die "Could not execute query: $DBI::errstr\n"; + +open (my $fh, '>', $outfile) or die "Could not open File $outfile for writing: $!"; + +while (my $row = $sth->fetchrow_hashref) { + my $email; + if ($row->{'name'} =~ /<([^>]+)>/) { + $email = $1; + } else { + next; + } + printf($fh "%s: %s\n", $row->{'source'}, $email); +} + +close($fh); + -- 2.39.2