~ubuntu-branches/ubuntu/karmic/sbuild/karmic-proposed

« back to all changes in this revision

Viewing changes to lib/Sbuild/Options.pm

  • Committer: Bazaar Package Importer
  • Author(s): Roger Leigh, Roger Leigh
  • Date: 2009-05-17 15:52:53 UTC
  • mfrom: (8.1.7 upstream) (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090517155253-fbxadfsyaf940ete
Tags: 0.58.3-1
[ Roger Leigh ]
* New release.
* debian/control:
  - Update to Standards Version 3.8.1.
  - Add buildd package.
  - Add libsbuild-perl package.
  - All packages depend upon libsbuild-perl.
* Add support for appending a tag to version numbers (Closes: #475777).
  Thanks to Timothy G Abbott for this patch.
* When using the --help or --version options, don't abort if not
  in the sbuild group (Closes: #523670).  Group membership is now
  only performed after options parsing, and only if required.
* Allow config files to use $HOME (Closes: #524564).  Thanks to
  James Vega for this patch.
* Restore buildd package.
* Split common library functions into new libsbuild-perl package.
* debian/sbuild.(preinst|postinst|postrm):
  - Remove special cases for versions older than oldstable.  Update
    addition and removal of sbuild group to use return value of getent
    rather than parsing getent output.
  - Use addgroup/delgroup in place of adduser/deluser.
  - Use --system when adding and deleting group, to ensure creation
    of a system group.  Migrate existing non-system group and group
    members if the system group is not present.
  - Handle removal of 50sbuild setup script.
* debian/buildd.(preinst|postinst|postrm): Add maintainer scripts for
  buildd package.  Move configuration file from /etc/buildd.conf to
  /etc/buildd/buildd.conf if present.  Also create buildd user and
  group for running the buildd daemon.
* Sbuild::Conf: Don't default MAINTAINER_NAME to $DEBEMAIL if unset
  in the configuration file (Closes: #520158).
* /etc/schroot/setup.d/50sbuild: Remove.  The setup tasks performed by
  this script are now handled internally by sbuild.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
use strict;
26
26
use warnings;
27
27
 
28
 
use Getopt::Long qw(:config no_ignore_case auto_abbrev gnu_getopt);
29
 
use Sbuild qw(help_text version_text usage_error);
30
 
use Sbuild::Base;
 
28
use Sbuild::OptionsBase;
31
29
use Sbuild::Conf;
32
30
 
33
31
BEGIN {
34
32
    use Exporter ();
35
33
    our (@ISA, @EXPORT);
36
34
 
37
 
    @ISA = qw(Exporter Sbuild::Base);
 
35
    @ISA = qw(Exporter Sbuild::OptionsBase);
38
36
 
39
37
    @EXPORT = qw();
40
38
}
41
39
 
42
 
sub new {
43
 
    my $class = shift;
44
 
    my $conf = shift;
45
 
 
46
 
    my $self = $class->SUPER::new($conf);
47
 
    bless($self, $class);
48
 
 
49
 
    if (!$self->parse_options()) {
50
 
        usage_error("sbuild", "Error parsing command-line options");
51
 
        return undef;
52
 
    }
53
 
    return $self;
54
 
}
55
 
 
56
 
sub parse_options {
 
40
sub set_options {
57
41
    my $self = shift;
58
42
 
59
 
    return GetOptions ("h|help" => sub { help_text("1", "sbuild"); },
60
 
                       "V|version" => sub {version_text("sbuild"); },
61
 
                       "arch=s" => sub {
 
43
    $self->add_options("arch=s" => sub {
62
44
                           $self->set_conf('ARCH', $_[1]);
63
45
                       },
64
46
                       "A|arch-all" => sub {
81
63
                                          $parts[$#parts]);
82
64
                           }
83
65
                       },
84
 
                       "f|force-depends=s" => sub {
85
 
                           push(@{$self->get_conf('MANUAL_SRCDEPS')},
86
 
                                "f".$_[1]);
87
 
                       },
88
 
                       "a|add-depends=s" => sub {
89
 
                           push(@{$self->get_conf('MANUAL_SRCDEPS')},
90
 
                                "a".$_[1] );
 
66
                       "add-depends=s" => sub {
 
67
                           push(@{$self->get_conf('MANUAL_DEPENDS')}, $_[1]);
 
68
                       },
 
69
                       "add-conflicts=s" => sub {
 
70
                           push(@{$self->get_conf('MANUAL_CONFLICTS')}, $_[1]);
 
71
                       },
 
72
                       "add-depends-indep=s" => sub {
 
73
                           push(@{$self->get_conf('MANUAL_DEPENDS_INDEP')}, $_[1]);
 
74
                       },
 
75
                       "add-conflicts-indep=s" => sub {
 
76
                           push(@{$self->get_conf('MANUAL_CONFLICTS_INDEP')}, $_[1]);
91
77
                       },
92
78
                       "check-depends-algorithm=s" => sub {
93
79
                           $self->set_conf('CHECK_DEPENDS_ALGORITHM', $_[1]);
103
89
                       "binNMU=i" => sub {
104
90
                           $self->set_conf('BIN_NMU_VERSION', $_[1]);
105
91
                       },
 
92
                       "append-to-version=s" => sub {
 
93
                           $self->set_conf('APPEND_TO_VERSION', $_[1]);
 
94
                       },
106
95
                       "c|chroot=s" => sub {
107
96
                           $self->set_conf('CHROOT', $_[1]);
108
97
                       },
109
98
                       "database=s" => sub {
110
99
                           $self->set_conf('WANNABUILD_DATABASE', $_[1]);
111
100
                       },
112
 
                       "D|debug" => sub {
113
 
                           $self->set_conf('DEBUG',
114
 
                                           $self->get_conf('DEBUG') + 1);
115
 
                       },
116
101
                       "apt-update" => sub {
117
102
                           $self->set_conf('APT_UPDATE', $_[1]);
118
103
                       },
143
128
                           $self->set_conf('UPLOADER_NAME', $_[1]);
144
129
                       },
145
130
                       "n|nolog" => sub {
146
 
                           $self->set('NOLOG', 1);
 
131
                           $self->set_conf('NOLOG', 1);
147
132
                       },
148
133
                       "p|purge=s" => sub {
149
134
                           $self->set_conf('PURGE_BUILD_DIRECTORY', $_[1]);
158
143
                           $self->set_conf('STATS_DIR', $_[1]);
159
144
                       },
160
145
                       "setup-hook=s" => sub {
161
 
                           $self->set_conf('SETUP_HOOK', $_[1]);
 
146
                           $self->set_conf('CHROOT_SETUP_SCRIPT', $_[1]);
162
147
                       },
163
148
                       "use-snapshot" => sub {
164
149
                           $self->set_conf('GCC_SNAPSHOT', 1);
168
153
                           $self->set_conf('PATH',
169
154
                                           '/usr/lib/gcc-snapshot/bin' .
170
155
                                           $self->get_conf('PATH') ne '' ? ':' . $self->get_conf('PATH') : '');
171
 
                       },
172
 
                       "v|verbose" => sub {
173
 
                           $self->set_conf('VERBOSE',
174
 
                                          $self->get_conf('VERBOSE') + 1);
175
 
                       },
176
 
                       "q|quiet" => sub {
177
 
                           $self->set_conf('VERBOSE',
178
 
                                           $self->get_conf('VERBOSE') - 1)
179
 
                               if $self->get_conf('VERBOSE');
180
 
                       },
 
156
                       }
181
157
        );
182
158
}
183
159