~ubuntu-branches/ubuntu/lucid/sbuild/lucid

« back to all changes in this revision

Viewing changes to lib/Sbuild/Conf.pm

  • Committer: Bazaar Package Importer
  • Author(s): Roger Leigh, Roger Leigh
  • Date: 2009-05-19 22:16:46 UTC
  • mfrom: (8.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090519221646-iyxt2sohtaxtwgjr
Tags: 0.58.4-1
[ Roger Leigh ]
* New release. 
* sbuild:
  - A $purge_build_deps configuration option, and --purge-deps
    command-line option have been added to control build-dependency
    removal (Closes: #528312).
  - Use the isin function from the Sbuild module (Closes: #529470).
    Thanks to Gustavo Noronha Silva for spotting this.
* Sbuild:
  - Use Filesys::Df (libfilesys-df-perl) in place of invoking /bin/df
    and parsing its output.  This is more robust and efficient, and
    works whatever the user environment (Closes: #509133).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#
2
2
# Conf.pm: configuration library for sbuild
3
3
# Copyright © 2005      Ryan Murray <rmurray@debian.org>
4
 
# Copyright © 2006-2008 Roger Leigh <rleigh@debian.org>
 
4
# Copyright © 2006-2009 Roger Leigh <rleigh@debian.org>
5
5
#
6
6
# This program is free software: you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License as published by
25
25
use warnings;
26
26
 
27
27
use Cwd qw(cwd);
 
28
use POSIX qw(getgroups getgid);
28
29
use Sbuild qw(isin);
29
30
use Sbuild::ConfBase;
30
31
use Sbuild::Sysconfig;
226
227
        'MAILFROM'                              => {
227
228
            DEFAULT => "Source Builder <sbuild>"
228
229
        },
 
230
        'PURGE_BUILD_DEPS'                      => {
 
231
            CHECK => sub {
 
232
                my $self = shift;
 
233
                my $entry = shift;
 
234
                my $key = $entry->{'NAME'};
 
235
 
 
236
                die "Bad purge mode \'" .
 
237
                    $self->get('PURGE_BUILD_DEPS') . "\'"
 
238
                    if !isin($self->get('PURGE_BUILD_DEPS'),
 
239
                             qw(always successful never));
 
240
            },
 
241
            DEFAULT => 'always'
 
242
        },
229
243
        'PURGE_BUILD_DIRECTORY'                 => {
230
244
            CHECK => sub {
231
245
                my $self = shift;
237
251
                    if !isin($self->get('PURGE_BUILD_DIRECTORY'),
238
252
                             qw(always successful never));
239
253
            },
240
 
            DEFAULT => 'successful'
 
254
            DEFAULT => 'always'
241
255
        },
242
256
        'TOOLCHAIN_REGEX'                       => {
243
257
            DEFAULT => ['binutils$',
476
490
    my %mailto;
477
491
    undef %mailto;
478
492
    my $mailfrom = undef;
 
493
    my $purge_build_deps = undef;
479
494
    my $purge_build_directory = undef;
480
495
    my @toolchain_regex;
481
496
    undef @toolchain_regex;
554
569
    $self->set('MAILTO_HASH', \%mailto)
555
570
        if (%mailto);
556
571
    $self->set('MAILFROM', $mailfrom);
 
572
    $self->set('PURGE_BUILD_DEPS', $purge_build_deps);
557
573
    $self->set('PURGE_BUILD_DIRECTORY', $purge_build_directory);
558
574
    $self->set('TOOLCHAIN_REGEX', \@toolchain_regex)
559
575
        if (@toolchain_regex);
631
647
    }
632
648
 
633
649
    if (!$in_group) {
634
 
        print STDERR "User $user is not a member of group $name\n";
 
650
        print STDERR "User $user is not a member of group $name in the system group database\n";
635
651
        print STDERR "See \"User Setup\" in sbuild-setup(7)\n";
636
652
        exit(1);
637
653
    }
638
654
 
 
655
    $in_group = 0;
 
656
    my @groups = getgroups();
 
657
    push @groups, getgid();
 
658
    foreach (@groups) {
 
659
        ($name, $passwd, $gid, $members) = getgrgid($_);
 
660
        $in_group = 1 if defined($name) && $name eq 'sbuild';
 
661
    }
 
662
 
 
663
    if (!$in_group) {
 
664
        print STDERR "User $user is not currently a member of group sbuild, but is in the system group database\n";
 
665
        print STDERR "You need to log in again to gain sbuild group priveleges\n";
 
666
        exit(1);
 
667
    }
 
668
 
639
669
    return;
640
670
}
641
671