summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2018-10-13 10:03:26 +0200
committerGuillem Jover <guillem@debian.org>2019-01-15 03:42:39 +0100
commit103fb161b360a00e4ca97b891b199c8aeacc63c5 (patch)
treeb51307af6a1282e0ce1c9ec994a76a1e50be8b82 /scripts
parente989be905db9b9c4761124ce6ee75d4b8903c246 (diff)
downloaddpkg-103fb161b360a00e4ca97b891b199c8aeacc63c5.tar.gz
dpkg-source: Use new format argument for Dpkg::Source::Package->new()
This makes the creation of the object more compact and easier to read.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dpkg-source.pl12
1 files changed, 4 insertions, 8 deletions
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index e1124496c..5f553e122 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -47,6 +47,7 @@ use Dpkg::Substvars;
use Dpkg::Version;
use Dpkg::Vars;
use Dpkg::Changelog::Parse;
+use Dpkg::Source::Format;
use Dpkg::Source::Package qw(get_default_diff_ignore_regex
set_default_diff_ignore_regex
get_default_tar_ignore_pattern);
@@ -252,13 +253,10 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) {
}
}
- my $srcpkg = Dpkg::Source::Package->new(options => \%options);
+ my $srcpkg = Dpkg::Source::Package->new(format => $build_format,
+ options => \%options);
my $fields = $srcpkg->{fields};
- $fields->{'Format'} = $build_format;
- $srcpkg->upgrade_object_type(); # Fails if format is unsupported
- # Parse command line options
- $srcpkg->init_options();
$srcpkg->parse_cmdline_options(@cmdline_options);
my @sourcearch;
@@ -570,9 +568,7 @@ sub print_option {
sub get_format_help {
$build_format //= '1.0';
- my $srcpkg = Dpkg::Source::Package->new();
- $srcpkg->{fields}->{'Format'} = $build_format;
- $srcpkg->upgrade_object_type(); # Fails if format is unsupported
+ my $srcpkg = Dpkg::Source::Package->new(format => $build_format);
my @cmdline = $srcpkg->describe_cmdline_options();
return '' unless @cmdline;