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=e0b3b307decf60b2a4e39c511ad970d4a1abd2b6

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

    Dpkg::Source::Package: Add a new format option to the new constructor
    
    This makes it easier to construct a source package object with the
    desired object, and initialize it as required.
    
    Prompted-by: James McCoy <[email protected]>
    Ref: https://salsa.debian.org/debian/devscripts/merge_requests/61
---
 debian/changelog               |  2 ++
 scripts/Dpkg/Source/Package.pm | 21 ++++++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 5d9a187de..63c983e4b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ dpkg (1.19.3) UNRELEASED; urgency=medium
     - Dpkg::Source::Patch: Do not recommend --include-removal when not
       supported. Closes: #913012
     - Dpkg::Source::Package::V3::Bzr: Fix format name in output message.
+    - Dpkg::Source::Package: Add a new format option to the new constructor.
+      Prompted by James McCoy <[email protected]>.
   * Documentation:
     - dpkg(1): Clarify --remove action. Closes: #914478
     - dpkg-query(1): Clarify --list option behavior when no arguments are
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index c9f8d5e14..b3a80ba1d 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -34,7 +34,7 @@ is the one that supports the extraction of the source package.
 use strict;
 use warnings;
 
-our $VERSION = '1.02';
+our $VERSION = '1.03';
 our @EXPORT_OK = qw(
     get_default_diff_ignore_regex
     set_default_diff_ignore_regex
@@ -166,12 +166,15 @@ sub get_default_tar_ignore_pattern {
 
 =over 4
 
-=item $p = Dpkg::Source::Package->new(filename => $dscfile, options => {})
+=item $p = Dpkg::Source::Package->new(%opts, options => {})
 
-Creates a new object corresponding to the source package described
-by the file $dscfile.
+Creates a new object corresponding to a source package. When the key
+B<filename> is set to a F<.dsc> file, it will be used to initialize the
+source package with its description. Otherwise if the B<format> key is
+set to a valid value, the object will be initialized for that format
+(since dpkg 1.19.3).
 
-The options hash supports the following options:
+The B<options> key is a hash ref which supports the following options:
 
 =over 8
 
@@ -220,6 +223,10 @@ sub new {
     if (exists $args{filename}) {
         $self->initialize($args{filename});
         $self->init_options();
+    } elsif ($args{format}) {
+        $self->{fields}{Format} = $args{format};
+        $self->upgrade_object_type(0);
+        $self->init_options();
     }
     return $self;
 }
@@ -670,6 +677,10 @@ sub write_dsc {
 
 =head1 CHANGES
 
+=head2 Version 1.03 (dpkg 1.19.3)
+
+New option: format in new().
+
 =head2 Version 1.02 (dpkg 1.18.7)
 
 New option: require_strong_checksums in check_checksums().

-- 
Dpkg.Org's dpkg

Reply via email to