1 # Copyright © 2008 Raphaël Hertzog <hertzog@debian.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 package Dpkg::Source::Package::V3::Custom;
21 our $VERSION = '0.01';
24 use Dpkg::ErrorHandling;
26 use parent qw(Dpkg::Source::Package);
28 our $CURRENT_MINOR_VERSION = '0';
30 my @module_cmdline = (
32 name => '--target-format=<value>',
33 help => N_('define the format of the generated source package'),
38 sub describe_cmdline_options {
39 return @module_cmdline;
42 sub parse_cmdline_option {
43 my ($self, $opt) = @_;
44 if ($opt =~ /^--target-format=(.*)$/) {
45 $self->{options}{target_format} = $1;
51 error(g_("Format '3.0 (custom)' is only used to create source packages"));
55 my ($self, $dir) = @_;
57 return (0, g_('no files indicated on command line'))
58 unless scalar(@{$self->{options}{ARGV}});
63 my ($self, $dir) = @_;
64 # Update real target format
65 my $format = $self->{options}{target_format};
66 error(g_('--target-format option is missing')) unless $format;
67 $self->{fields}{'Format'} = $format;
69 foreach my $file (@{$self->{options}{ARGV}}) {
70 $self->add_file($file);