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
#######################################################################
34
@EXPORT = qw($HOME %alternatives $apt_policy $check_watches $cwd
35
$username $verbose $nolog $mailprog $dpkg $su
36
$schroot $schroot_options $fakeroot $apt_get
37
$apt_cache $dpkg_source $md5sum $avg_time_db
38
$avg_space_db $package_checklist $build_env_cmnd
39
$pgp_options $log_dir $mailto $mailfrom
40
@no_auto_upgrade $check_depends_algorithm
41
$purge_build_directory @toolchain_regex
42
$stalled_pkg_timeout $srcdep_lock_dir
43
$srcdep_lock_wait @ignore_watches_no_build_deps
44
$build_dir $sbuild_mode $debug $force_orig_source
45
%individual_stalled_pkg_timeout $path
46
$maintainer_name $uploader_name %watches $key_id); }
48
# Originally from the main namespace.
49
(our $HOME = $ENV{'HOME'})
50
or die "HOME not defined in environment!\n";
51
our $username = (getpwuid($<))[0] || $ENV{'LOGNAME'} || $ENV{'USER'};
57
# TODO: Remove $source_dependencies after Lenny.
58
our $source_dependencies;
59
our $mailprog = "/usr/sbin/sendmail";
60
our $dpkg = "/usr/bin/dpkg";
63
our $schroot = "/usr/bin/schroot";
64
our $schroot_options = "-q";
65
our $fakeroot = "/usr/bin/fakeroot";
66
our $apt_get = "/usr/bin/apt-get";
67
our $apt_cache = "/usr/bin/apt-cache";
68
our $dpkg_source = "/usr/bin/dpkg-source";
69
our $md5sum = "/usr/bin/md5sum";
70
our $avg_time_db = "/var/lib/sbuild/avg-build-times";
71
our $avg_space_db = "/var/lib/sbuild/avg-build-space";
72
our $package_checklist = "/var/lib/sbuild/package-checklist";
73
our $build_env_cmnd = "";
74
our $pgp_options = "-us -uc";
75
our $log_dir = "$HOME/logs";
77
our $mailfrom = "Source Builder <sbuild>";
78
our $purge_build_directory = "successful";
79
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$');
80
our $stalled_pkg_timeout = 150; # minutes
81
our $srcdep_lock_dir = "/var/lib/sbuild/srcdep-lock";
82
our $srcdep_lock_wait = 1; # minutes
83
# TODO: Remove $chroot_only after Lenny
85
# TODO: Remove $chroot_mode after Lenny
88
our $check_watches = 1;
89
our @ignore_watches_no_build_deps = qw();
91
# TODO: Remove $build_dir after Lenny
92
our $build_dir = undef;
93
our $sbuild_mode = "user";
95
our $force_orig_source = 0;
96
our %individual_stalled_pkg_timeout = ();
97
our $path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/usr/games";
101
our %alternatives = ("info-browser" => "info",
103
"postscript-viewer" => "ghostview",
104
"postscript-preview" => "psutils",
105
"www-browser" => "lynx",
108
"wordlist" => "wenglish",
111
"c-compiler" => "gcc",
112
"fortran77-compiler" => "g77",
113
"java-compiler" => "jikes",
114
"libc-dev" => "libc6-dev",
115
"libgl-dev" => "xlibmesa-gl-dev",
116
"libglu-dev" => "xlibmesa-glu-dev",
117
"libncurses-dev" => "libncurses5-dev",
118
"libz-dev" => "zlib1g-dev",
119
"libg++-dev" => "libstdc++6-4.0-dev",
120
"emacsen" => "emacs21",
121
"mail-transport-agent" => "ssmtp",
122
"mail-reader" => "mailx",
123
"news-transport-system" => "inn",
124
"news-reader" => "nn",
126
"mysql-dev" => "libmysqlclient-dev",
127
"giflib-dev" => "libungif4-dev",
128
"freetype2-dev" => "libttf-dev");
130
our @no_auto_upgrade = qw(dpkg apt bash libc6 libc6-dev dpkg-dev);
131
our $check_depends_algorithm = "first-only";
134
require "/etc/sbuild/sbuild.conf" if -r "/etc/sbuild/sbuild.conf";
135
require "$HOME/.sbuildrc" if -r "$HOME/.sbuildrc";
139
die "mailprog binary $Sbuild::Conf::mailprog does not exist or isn't executable\n"
140
if !-x $Sbuild::Conf::mailprog;
141
die "schroot binary $Sbuild::Conf::schroot does not exist or isn't executable\n"
142
if !-x $Sbuild::Conf::schroot;
143
die "apt-get binary $Sbuild::Conf::apt_get does not exist or isn't executable\n"
144
if !-x $Sbuild::Conf::apt_get;
145
die "apt-cache binary $Sbuild::Conf::apt_cache does not exist or isn't executable\n"
146
if !-x $Sbuild::Conf::apt_cache;
147
die "dpkg-source binary $Sbuild::Conf::dpkg_source does not exist or isn't executable\n"
148
if !-x $Sbuild::Conf::dpkg_source;
149
die "$Sbuild::Conf::srcdep_lock_dir is not a directory\n"
150
if ! -d $Sbuild::Conf::srcdep_lock_dir;
152
die "mailto not set\n" if !$Sbuild::Conf::mailto;
154
if (!defined($Sbuild::Conf::build_dir)) {
155
$Sbuild::Conf::build_dir = $Sbuild::Conf::cwd;
157
if (! -d "$Sbuild::Conf::build_dir") {
158
die "Build directory $Sbuild::Conf::build_dir does not exist";
161
# TODO: Remove chroot_mode, chroot_only, sudo and
162
# source_dependencies after Lenny.
164
if (defined($chroot_mode)) {
165
die "chroot_mode is obsolete";
168
if (defined($chroot_only)) {
169
die "chroot_only is obsolete";
172
if (defined($sudo)) {
173
die "sudo is obsolete";
176
if (defined($source_dependencies)) {
177
die "Source dependencies are obsolete";