diff options
author | Guillem Jover <guillem@debian.org> | 2018-10-13 10:02:03 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2019-01-15 03:42:39 +0100 |
commit | e0b3b307decf60b2a4e39c511ad970d4a1abd2b6 (patch) | |
tree | 02f42b5753cece208b9387ddbbca4af40a749468 /scripts/Dpkg/Source | |
parent | 05f666b8e944e7e7cf06966e192f759fa83b4d02 (diff) | |
download | dpkg-e0b3b307decf60b2a4e39c511ad970d4a1abd2b6.tar.gz |
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 <jamesan@debian.org>
Ref: https://salsa.debian.org/debian/devscripts/merge_requests/61
Diffstat (limited to 'scripts/Dpkg/Source')
-rw-r--r-- | scripts/Dpkg/Source/Package.pm | 21 |
1 files changed, 16 insertions, 5 deletions
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(). |