From e0b3b307decf60b2a4e39c511ad970d4a1abd2b6 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sat, 13 Oct 2018 10:02:03 +0200 Subject: 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 Ref: https://salsa.debian.org/debian/devscripts/merge_requests/61 --- scripts/Dpkg/Source/Package.pm | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'scripts/Dpkg/Source') 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 is set to a F<.dsc> file, it will be used to initialize the +source package with its description. Otherwise if the B 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 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(). -- cgit v1.2.3