3
# Copyright © 1998 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
4
# Copyright © 2005-2008 Ryan Murray <rmurray@debian.org>
5
# Copyright © 2008 Roger Leigh <rleigh@debian.org
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 2 of the License, or
10
# (at your option) any later version.
12
# This program is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see
19
# <http://www.gnu.org/licenses/>.
21
#######################################################################
27
use Sbuild qw(isin usage_error);
29
use Sbuild::Sysconfig;
31
use Sbuild::DB::MLDBM;
32
use Sbuild::DB::Postgres;
33
use WannaBuild::Database;
34
use WannaBuild::Options;
39
my $conf = WannaBuild::Conf::new();
40
exit 1 if !defined($conf);
41
my $options = WannaBuild::Options->new($conf, "wanna-build", 1);
42
exit 1 if !defined($options);
43
my $database = Wannabuild::Database->new($conf);
44
exit 1 if !defined($database);
46
# map program invocation names to operation modes
47
my %prognames = ( "uploaded-build" => "set-uploaded",
48
"failed-build" => "set-failed",
49
"no-build" => "set-not-for-us",
50
"give-back-build" => "set-needs-build",
51
"dep-wait-build" => "set-dep-wait",
52
"forget-build" => "forget",
53
"merge-quinn" => "merge-quinn",
54
"merge-packages" => "merge-packages",
55
"merge-sources" => "merge-sources",
56
"build-info" => "info" );
60
($progname = $0) =~ s,.*/,,;
62
if ($prognames{$progname}) {
63
$conf->set('DB_OPERATION', $prognames{$progname});
64
} elsif ($progname =~ /^list-(.*)$/) {
65
$conf->set('DB_OPERATION', 'list');
66
$conf->set('DB_LIST_STATE', ($1 eq "all") ? "" : $1);
69
# All logging is to standard out and error; no log stream to set.
70
my $status = $database->run();
75
if (defined($database)) {
76
my $databases = $database->get('Databases');
77
foreach (keys %{$databases}) {
78
$databases->{$_}->close();
79
undef $databases->{$_};