This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=103fb161b360a00e4ca97b891b199c8aeacc63c5

commit 103fb161b360a00e4ca97b891b199c8aeacc63c5
Author: Guillem Jover <[email protected]>
AuthorDate: Sat Oct 13 10:03:26 2018 +0200

    dpkg-source: Use new format argument for Dpkg::Source::Package->new()
    
    This makes the creation of the object more compact and easier to read.
---
 debian/changelog       |  1 +
 scripts/dpkg-source.pl | 12 ++++--------
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index fcb5e5f19..9713e9b60 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -44,6 +44,7 @@ dpkg (1.19.3) UNRELEASED; urgency=medium
     - Quote shell variables. Reported by Johannes Schauer <[email protected]>.
     - Switch perl code to use the new Dpkg::Source::Format module.
     - dpkg-source: Move source format selection earlier in the build.
+    - dpkg-source: Use new format argument for Dpkg::Source::Package->new().
   * Build system:
     - get-version: Use a format string with printf.
     - run-script: Use $() instead of deprecated ``.
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;

-- 
Dpkg.Org's dpkg

Reply via email to