1
|
|
-#!/usr/bin/perl
|
2
|
|
-
|
3
|
|
-# Copyright (C) 2010 Alexander Wirt <formorer@debian.org>
|
4
|
|
-#
|
5
|
|
-# This program is free software; you can redistribute it and/or modify it under
|
6
|
|
-# the terms of the GNU General Public License as published by the Free Software
|
7
|
|
-# Foundation; either version 2 of the License, or (at your option) any later
|
8
|
|
-# version.
|
9
|
|
-#
|
10
|
|
-# This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
11
|
|
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
12
|
|
-# PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
13
|
|
-#
|
14
|
|
-# You should have received a copy of the GNU General Public License along with
|
15
|
|
-# this program; if not, see <http://www.gnu.org/licenses/>.
|
16
|
|
-
|
17
|
|
-use warnings;
|
18
|
|
-use strict;
|
19
|
|
-use DBI;
|
20
|
|
-
|
21
|
|
-my $outfile = shift;
|
22
|
|
-
|
23
|
|
-if (! $outfile) {
|
24
|
|
- print "Output Filename needed\n";
|
25
|
|
- exit 1;
|
26
|
|
-}
|
27
|
|
-
|
28
|
|
-my $dbh = DBI->connect("DBI:Pg:dbname=backports");
|
29
|
|
-
|
30
|
|
-
|
31
|
|
-my $sth = $dbh->prepare( "
|
32
|
|
- SELECT maintainer.name,
|
33
|
|
- source.source,
|
34
|
|
- max(source.version)
|
35
|
|
- FROM source,source_suite,
|
36
|
|
- maintainer
|
37
|
|
- WHERE source.id = source_suite.src
|
38
|
|
- AND source.changedby = maintainer.id
|
39
|
|
- AND ( suite_name = 'squeeze-backports' )
|
40
|
|
- GROUP BY source.source,maintainer.name;
|
41
|
|
-");
|
42
|
|
-
|
43
|
|
-if ( !defined $sth ) {
|
44
|
|
- die "Cannot prepare statement: $DBI::errstr\n";
|
45
|
|
-}
|
46
|
|
-
|
47
|
|
-$sth->execute or die "Could not execute query: $DBI::errstr\n";
|
48
|
|
-
|
49
|
|
-open (my $fh, '>', $outfile) or die "Could not open File $outfile for writing: $!";
|
50
|
|
-
|
51
|
|
-while (my $row = $sth->fetchrow_hashref) {
|
52
|
|
- my $email;
|
53
|
|
- if ($row->{'name'} =~ /<([^>]+)>/) {
|
54
|
|
- $email = $1;
|
55
|
|
- } else {
|
56
|
|
- next;
|
57
|
|
- }
|
58
|
|
- printf($fh "%s: %s\n", $row->{'source'}, $email);
|
59
|
|
-}
|
60
|
|
-
|
61
|
|
-close($fh);
|
62
|
|
-
|