~ubuntu-branches/ubuntu/oneiric/sbuild/oneiric

« back to all changes in this revision

Viewing changes to bin/wanna-build

  • Committer: Bazaar Package Importer
  • Author(s): Lorenzo De Liso
  • Date: 2011-05-01 16:55:16 UTC
  • mfrom: (8.1.19 upstream) (3.3.17 sid)
  • Revision ID: james.westby@ubuntu.com-20110501165516-8g3uwrnhv2bzjt8y
Tags: 0.62.2-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/patches/do-not-install-debfoster-into-chroots.patch: 
    do not install debfoster into the chroots because it is in universe and 
    not needed for package building itself.
  - debian/patches/run-pre-build-hooks-as-root.patch: 
    run pre-build hooks as root (Closes: #607228)
* Now that the package uses a patch system, don't modify the files directly;
  instead, put the changes in the respective patches and add the DEP-3
  patch tagging guidelines to them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/perl
2
 
#
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
6
 
#
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.
11
 
#
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.
16
 
#
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/>.
20
 
#
21
 
#######################################################################
22
 
 
23
 
use strict;
24
 
use warnings;
25
 
 
26
 
use POSIX;
27
 
use Sbuild qw(isin usage_error);
28
 
use WannaBuild::Conf;
29
 
use Sbuild::Sysconfig;
30
 
use Sbuild::DB::Info;
31
 
use Sbuild::DB::MLDBM;
32
 
use Sbuild::DB::Postgres;
33
 
use WannaBuild::Database;
34
 
use WannaBuild::Options;
35
 
 
36
 
# global vars
37
 
$| = 1;
38
 
 
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);
45
 
 
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" );
57
 
 
58
 
 
59
 
my $progname;
60
 
($progname = $0) =~ s,.*/,,;
61
 
 
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);
67
 
}
68
 
 
69
 
# All logging is to standard out and error; no log stream to set.
70
 
my $status = $database->run();
71
 
 
72
 
exit $status;
73
 
 
74
 
END {
75
 
    if (defined($database)) {
76
 
        my $databases = $database->get('Databases');
77
 
        foreach (keys %{$databases}) {
78
 
            $databases->{$_}->close();
79
 
            undef $databases->{$_};
80
 
        }
81
 
    }
82
 
}