2
# Conf.pm: configuration library for sbuild
3
# Copyright © 2005 Ryan Murray <rmurray@debian.org>
4
# Copyright © 2006 Roger Leigh <rleigh@debian.org>
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
# General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see
18
# <http://www.gnu.org/licenses/>.
20
#######################################################################
36
@EXPORT = qw($HOME %alternatives $apt_policy $apt_update
37
$apt_allow_unauthenticated $check_watches $cwd
38
$username $verbose $nolog $mailprog $dpkg $su
39
$schroot $schroot_options $fakeroot $apt_get
40
$apt_cache $dpkg_source $dcmd $md5sum $avg_time_db
41
$avg_space_db $stats_dir $package_checklist
42
$build_env_cmnd $pgp_options $log_dir $mailto
43
$mailfrom @no_auto_upgrade $check_depends_algorithm
44
$purge_build_directory @toolchain_regex
45
$stalled_pkg_timeout $srcdep_lock_dir
46
$srcdep_lock_wait $max_lock_trys $lock_interval
47
@ignore_watches_no_build_deps $build_dir $sbuild_mode
48
$debug $force_orig_source
49
%individual_stalled_pkg_timeout $path
50
$maintainer_name $uploader_name %watches $key_id);
57
# Originally from the main namespace.
58
(our $HOME = $ENV{'HOME'})
59
or die "HOME not defined in environment!\n";
60
our $username = (getpwuid($<))[0] || $ENV{'LOGNAME'} || $ENV{'USER'};
66
# TODO: Remove $source_dependencies after Lenny.
67
our $source_dependencies;
68
our $mailprog = "/usr/sbin/sendmail";
69
our $dpkg = "/usr/bin/dpkg";
72
our $schroot = "/usr/bin/schroot";
73
our $schroot_options = "-q";
74
our $fakeroot = "/usr/bin/fakeroot";
75
our $apt_get = "/usr/bin/apt-get";
76
our $apt_cache = "/usr/bin/apt-cache";
77
our $dpkg_source = "/usr/bin/dpkg-source";
78
our $dcmd = "/usr/bin/dcmd";
79
our $md5sum = "/usr/bin/md5sum";
80
our $avg_time_db = "/var/lib/sbuild/avg-build-times";
81
our $avg_space_db = "/var/lib/sbuild/avg-build-space";
82
our $stats_dir = "$HOME/stats";
83
our $package_checklist = "/var/lib/sbuild/package-checklist";
84
our $build_env_cmnd = "";
85
our $pgp_options = "-us -uc";
86
our $log_dir = "$HOME/logs";
88
our $mailfrom = "Source Builder <sbuild>";
89
our $purge_build_directory = "successful";
90
our @toolchain_regex = ( 'binutils$', 'gcc-[\d.]+$', 'g\+\+-[\d.]+$', 'libstdc\+\+', 'libc[\d.]+-dev$', 'linux-kernel-headers$', 'linux-libc-dev$', 'gnumach-dev$', 'hurd-dev$', 'kfreebsd-kernel-headers$');
91
our $stalled_pkg_timeout = 150; # minutes
92
our $srcdep_lock_dir = "/var/lib/sbuild/srcdep-lock";
93
our $srcdep_lock_wait = 1; # minutes
94
our $max_lock_trys = 120;
95
our $lock_interval = 5;
96
# TODO: Remove $chroot_only after Lenny
98
# TODO: Remove $chroot_mode after Lenny
101
our $check_watches = 1;
102
our @ignore_watches_no_build_deps = qw();
104
# TODO: Remove $build_dir after Lenny
105
our $build_dir = undef;
106
our $sbuild_mode = "user";
108
our $force_orig_source = 0;
109
our %individual_stalled_pkg_timeout = ();
110
our $path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/games";
111
our $maintainer_name;
115
our $apt_allow_unauthenticated = 0;
116
our %alternatives = ("info-browser" => "info",
118
"postscript-viewer" => "ghostview",
119
"postscript-preview" => "psutils",
120
"www-browser" => "lynx",
123
"wordlist" => "wenglish",
126
"c-compiler" => "gcc",
127
"fortran77-compiler" => "g77",
128
"java-compiler" => "jikes",
129
"libc-dev" => "libc6-dev",
130
"libgl-dev" => "xlibmesa-gl-dev",
131
"libglu-dev" => "xlibmesa-glu-dev",
132
"libncurses-dev" => "libncurses5-dev",
133
"libz-dev" => "zlib1g-dev",
134
"libg++-dev" => "libstdc++6-4.0-dev",
135
"emacsen" => "emacs21",
136
"mail-transport-agent" => "ssmtp",
137
"mail-reader" => "mailx",
138
"news-transport-system" => "inn",
139
"news-reader" => "nn",
141
"mysql-dev" => "libmysqlclient-dev",
142
"giflib-dev" => "libungif4-dev",
143
"freetype2-dev" => "libttf-dev");
145
our @no_auto_upgrade = qw(dpkg apt bash libc6 libc6-dev dpkg-dev);
146
our $check_depends_algorithm = "first-only";
149
require "/etc/sbuild/sbuild.conf" if -r "/etc/sbuild/sbuild.conf";
150
require "$HOME/.sbuildrc" if -r "$HOME/.sbuildrc";
154
die "mailprog binary $Sbuild::Conf::mailprog does not exist or isn't executable\n"
155
if !-x $Sbuild::Conf::mailprog;
156
die "schroot binary $Sbuild::Conf::schroot does not exist or isn't executable\n"
157
if !-x $Sbuild::Conf::schroot;
158
die "apt-get binary $Sbuild::Conf::apt_get does not exist or isn't executable\n"
159
if !-x $Sbuild::Conf::apt_get;
160
die "apt-cache binary $Sbuild::Conf::apt_cache does not exist or isn't executable\n"
161
if !-x $Sbuild::Conf::apt_cache;
162
die "dpkg-source binary $Sbuild::Conf::dpkg_source does not exist or isn't executable\n"
163
if !-x $Sbuild::Conf::dpkg_source;
164
die "$Sbuild::Conf::srcdep_lock_dir is not a directory\n"
165
if ! -d $Sbuild::Conf::srcdep_lock_dir;
167
die "mailto not set\n" if !$Sbuild::Conf::mailto && $sbuild_mode eq "buildd";
169
if (!defined($Sbuild::Conf::build_dir)) {
170
$Sbuild::Conf::build_dir = $Sbuild::Conf::cwd;
172
if (! -d "$Sbuild::Conf::build_dir") {
173
die "Build directory $Sbuild::Conf::build_dir does not exist";
176
# TODO: Remove chroot_mode, chroot_only, sudo and
177
# source_dependencies after Lenny.
179
if (defined($chroot_mode)) {
180
die "chroot_mode is obsolete";
183
if (defined($chroot_only)) {
184
die "chroot_only is obsolete";
187
if (defined($sudo)) {
188
die "sudo is obsolete";
191
if (defined($source_dependencies)) {
192
die "Source dependencies are obsolete";