Dpkg/Source/Package/V3/Custom.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 55 CC 4 SCAR 13.5
CC
4
Cov
0%
parse_cmdline_option
6.0
can_build
6.0
do_build
6.0
CRAP 3.8
1 # Copyright © 2008 Raphaël Hertzog <hertzog@debian.org>
2 #
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.
7 #
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.
12 #
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/>.
15  
16 =encoding utf8
17  
18 =head1 NAME
19  
20 Dpkg::Source::Package::V3::Custom - class for source format 3.0 (custom)
21  
22 =head1 DESCRIPTION
23  
24 This module provides a class to handle the pseudo source package
25 format 3.0 (custom).
26  
27 B<Note>: This is a private module, its API can change at any time.
28  
29 =cut
30  
31 package Dpkg::Source::Package::V3::Custom 0.01;
32  
33 use v5.36;
34  
35 use Dpkg::Gettext;
36 use Dpkg::ErrorHandling;
37  
38 use parent qw(Dpkg::Source::Package);
39  
40 sub CURRENT_MINOR_VERSION {
41 '0';
42 }
43  
44 my @module_cmdline = (
45 {
46 name => '--target-format=<value>',
47 help => N_('Define the format of the generated source package.'),
48 when => 'build',
49 }
50 );
51  
52 sub describe_cmdline_options {
53 return @module_cmdline;
54 }
55  
56 sub parse_cmdline_option {
57 my ($self, $opt) = @_;
58 if ($opt =~ /^--target-format=(.*)$/) {
59 $self->{options}{target_format} = $1;
60 return 1;
61 }
62 return 0;
63 }
64 sub do_extract {
65 error(g_("Format '3.0 (custom)' is only used to create source packages"));
66 }
67  
68 sub can_build {
69 my ($self, $dir) = @_;
70  
71 return (0, g_('no files indicated on command line'))
72 unless scalar(@{$self->{options}{ARGV}});
73 return 1;
74 }
75  
76 sub do_build {
77 my ($self, $dir) = @_;
78 # Update real target format.
79 my $format = $self->{options}{target_format};
80 error(g_('--target-format option is missing')) unless $format;
81 $self->{fields}{'Format'} = $format;
82 # Add all files.
83 foreach my $file (@{$self->{options}{ARGV}}) {
84 $self->add_file($file);
85 }
86 }
87  
88 =head1 CHANGES
89  
90 =head2 Version 0.xx
91  
92 This is a private module.
93  
94 =cut
95  
96 1;