| OLD | NEW |
| (Empty) |
| 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 package Dpkg::Source::Package::V3::Custom; | |
| 17 | |
| 18 use strict; | |
| 19 use warnings; | |
| 20 | |
| 21 our $VERSION = '0.01'; | |
| 22 | |
| 23 use parent qw(Dpkg::Source::Package); | |
| 24 | |
| 25 use Dpkg; | |
| 26 use Dpkg::Gettext; | |
| 27 use Dpkg::ErrorHandling; | |
| 28 | |
| 29 our $CURRENT_MINOR_VERSION = '0'; | |
| 30 | |
| 31 sub parse_cmdline_option { | |
| 32 my ($self, $opt) = @_; | |
| 33 if ($opt =~ /^--target-format=(.*)$/) { | |
| 34 $self->{options}{target_format} = $1; | |
| 35 return 1; | |
| 36 } | |
| 37 return 0; | |
| 38 } | |
| 39 sub do_extract { | |
| 40 error(_g("Format `3.0 (custom)' is only used to create source packages")); | |
| 41 } | |
| 42 | |
| 43 sub can_build { | |
| 44 my ($self, $dir) = @_; | |
| 45 | |
| 46 return (0, _g('no files indicated on command line')) | |
| 47 unless scalar(@{$self->{options}{ARGV}}); | |
| 48 return 1; | |
| 49 } | |
| 50 | |
| 51 sub do_build { | |
| 52 my ($self, $dir) = @_; | |
| 53 # Update real target format | |
| 54 my $format = $self->{options}{target_format}; | |
| 55 error(_g('--target-format option is missing')) unless $format; | |
| 56 $self->{fields}{'Format'} = $format; | |
| 57 # Add all files | |
| 58 foreach my $file (@{$self->{options}{ARGV}}) { | |
| 59 $self->add_file($file); | |
| 60 } | |
| 61 } | |
| 62 | |
| 63 1; | |
| OLD | NEW |