~ubuntu-branches/ubuntu/hardy/sbuild/hardy

« back to all changes in this revision

Viewing changes to lib/Sbuild/Conf.pm

  • Committer: Bazaar Package Importer
  • Author(s): Roger Leigh, Jan-Marek Glogowski
  • Date: 2008-01-01 11:36:55 UTC
  • mfrom: (8.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080101113655-rxlefdonr61fnikq
Tags: 0.57.0-1
* Sbuild/*.pm: Reindent to increase readability.
* Sbuild/Chroot.pm: set APT::Install-Recommends to false inside the
  chroot (Closes: #449253).
* Sbuild/Conf.pm: Add and export $check_depends_algorithm.
  [Jan-Marek Glogowski]
* sbuild:
  - Reindent to increase readability.
  - Add additional syntax checks.  Thanks to Jan-Marek Glogowski.
  - build: Use unicode line drawing characters instead of ASCII.
  - filter_dependencies: Remove redundant conditional.
    [Jan-Marek Glogowski]
  - Add check for check-depends-algorithm option. [Jan-Marek Glogowski]
  - filter_dependencies: Change dependency behaviour depending upon
    check_depends_algorithm.  [Jan-Marek Glogowski]
  - Move to bin/.
* avg-pkg-build-time:
  - Move to bin/.
* bin/*: Reindent to increase readability.
* chroot/*: Reindent to increase readability.
* bin/sbuild-createchroot:
  - Moved from chroot/buildd.chroot.
  - Also install fakeroot and build-essential.
* sbuild-createchroot.1.in: Add manual page.
* chroot/buildd.chroot:
  - Add GPL boilerplate.
  - Remove /etc/passwd creation (already done by debootstrap).
  - Remove sbuild directory creation (already done by schroot).
  - Use here doc to set up /etc/apt/sources.list.
  - List sources.list.
* chroot/README: Rename from README.buildd-chroot.  Remove
  buildd.chroot section.
* example.sbuildrc: Add missing variable types.  [Jan-Marek Glogowski]
* example.sbuildrc: Add missing variable types and add
  $check_depends_algorithm.  [Jan-Marek Glogowski]
* sbuild.1: Document --check-depends-algorithm [Jan-Marek Glogowski]
* Move manual pages to man/.
* debian/manpages: Move manual pages to man/.
* sbuild.conf: Move to etc/.
* example.sbuildrc: Move to etc/.
* debian/compat: Move to debhelper v6 compatibility level.
* debian/control: Update to Standards-Version 3.7.3.
* debian/copyright:
  - Update git repository location.
  - Update GPL boilerplate.
* debian/sbuild.dirs:
  - Rename from debian/dirs.
  - Remove all but -var/lib/sbuild/srcdep-lock.
* debian/manpages: Remove.
* debian/sbuild.postinst: Rename from debian/postinst.
* debian/sbuild.preinst: Rename from debian/preinst.
* debian/sbuild.postrm: Rename from debian/postrm.
* debian/sbuild.install:
  - New file.
  - Install files from usr/sbin and usr/share/man/man8.
* debian/rules:
  - Install sbuild-createchroot, and add buildd.chroot compatibility
    symlink.
  - Move -stamp files to debian/.
  - Remove GENFILES.
  - Run configure, make, and make install in appropriate rules.
  - Use dh_install.
  - Remove all special-cased installation rules (now handled by automake).
* Note: All upstream changes are now in an upstream ChangeLog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Conf.pm: configuration library for sbuild
 
3
# Copyright © 2005 Ryan Murray <rmurray@debian.org>
 
4
# Copyright © 2006 Roger Leigh <rleigh@debian.org>
 
5
#
 
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.
 
10
#
 
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.
 
15
#
 
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/>.
 
19
#
 
20
#######################################################################
 
21
 
 
22
package Sbuild::Conf;
 
23
 
 
24
use strict;
 
25
use warnings;
 
26
use Cwd qw(cwd);
 
27
 
 
28
BEGIN {
 
29
    use Exporter ();
 
30
    our (@ISA, @EXPORT);
 
31
 
 
32
    @ISA = qw(Exporter);
 
33
 
 
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); }
 
47
 
 
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'};
 
52
our $cwd = cwd();
 
53
our $verbose = 0;
 
54
our $nolog = 0;
 
55
 
 
56
# Defaults.
 
57
# TODO: Remove $source_dependencies after Lenny.
 
58
our $source_dependencies;
 
59
our $mailprog = "/usr/sbin/sendmail";
 
60
our $dpkg = "/usr/bin/dpkg";
 
61
our $sudo;
 
62
our $su = "/bin/su";
 
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";
 
76
our $mailto = "";
 
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
 
84
our $chroot_only;
 
85
# TODO: Remove $chroot_mode after Lenny
 
86
our $chroot_mode;
 
87
our $apt_policy = 1;
 
88
our $check_watches = 1;
 
89
our @ignore_watches_no_build_deps = qw();
 
90
our %watches;
 
91
# TODO: Remove $build_dir after Lenny
 
92
our $build_dir = undef;
 
93
our $sbuild_mode = "user";
 
94
our $debug = 0;
 
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";
 
98
our $maintainer_name;
 
99
our $uploader_name;
 
100
our $key_id;
 
101
our %alternatives = ("info-browser"             => "info",
 
102
                     "httpd"                    => "apache",
 
103
                     "postscript-viewer"        => "ghostview",
 
104
                     "postscript-preview"       => "psutils",
 
105
                     "www-browser"              => "lynx",
 
106
                     "awk"                      => "gawk",
 
107
                     "c-shell"                  => "tcsh",
 
108
                     "wordlist"                 => "wenglish",
 
109
                     "tclsh"                    => "tcl8.4",
 
110
                     "wish"                     => "tk8.4",
 
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",
 
125
                     "xserver"                  => "xvfb",
 
126
                     "mysql-dev"                => "libmysqlclient-dev",
 
127
                     "giflib-dev"               => "libungif4-dev",
 
128
                     "freetype2-dev"            => "libttf-dev");
 
129
 
 
130
our @no_auto_upgrade = qw(dpkg apt bash libc6 libc6-dev dpkg-dev);
 
131
our $check_depends_algorithm = "first-only";
 
132
 
 
133
# read conf files
 
134
require "/etc/sbuild/sbuild.conf" if -r "/etc/sbuild/sbuild.conf";
 
135
require "$HOME/.sbuildrc" if -r "$HOME/.sbuildrc";
 
136
 
 
137
sub init {
 
138
    # some checks
 
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;
 
151
 
 
152
    die "mailto not set\n" if !$Sbuild::Conf::mailto;
 
153
 
 
154
    if (!defined($Sbuild::Conf::build_dir)) {
 
155
        $Sbuild::Conf::build_dir = $Sbuild::Conf::cwd;
 
156
    }
 
157
    if (! -d "$Sbuild::Conf::build_dir") {
 
158
        die "Build directory $Sbuild::Conf::build_dir does not exist";
 
159
    }
 
160
 
 
161
    # TODO: Remove chroot_mode, chroot_only, sudo and
 
162
    # source_dependencies after Lenny.
 
163
 
 
164
    if (defined($chroot_mode)) {
 
165
        die "chroot_mode is obsolete";
 
166
    }
 
167
 
 
168
    if (defined($chroot_only)) {
 
169
        die "chroot_only is obsolete";
 
170
    }
 
171
 
 
172
    if (defined($sudo)) {
 
173
        die "sudo is obsolete";
 
174
    }
 
175
 
 
176
    if (defined($source_dependencies)) {
 
177
        die "Source dependencies are obsolete";
 
178
    }
 
179
 
 
180
}
 
181
 
 
182
1;