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=41a98902abdc32eddaa454422abe96f2948f9718 commit 41a98902abdc32eddaa454422abe96f2948f9718 Author: Guillem Jover <[email protected]> AuthorDate: Sun Nov 8 03:45:41 2020 +0100 Dpkg::Index: Add new item_opts option This option makes it possible to pass options to the item constructor in new_item() method. --- scripts/Dpkg/Index.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/Dpkg/Index.pm b/scripts/Dpkg/Index.pm index cfe86ba17..6dc46dad4 100644 --- a/scripts/Dpkg/Index.pm +++ b/scripts/Dpkg/Index.pm @@ -19,7 +19,7 @@ package Dpkg::Index; use strict; use warnings; -our $VERSION = '2.00'; +our $VERSION = '2.01'; use Dpkg::Gettext; use Dpkg::ErrorHandling; @@ -61,6 +61,7 @@ sub new { unique_tuple_key => 1, get_key_func => sub { return $_[0]->{Package} }, type => CTRL_UNKNOWN, + item_opts => {}, }; bless $self, $class; $self->set_options(%opts); @@ -77,7 +78,9 @@ The "type" option is checked first to define default values for other options. Here are the relevant options: "get_key_func" is a function returning a key for the item passed in parameters, "unique_tuple_key" is a boolean requesting whether the default key should be the unique tuple -(default to true). The index can only contain one item with a given key. +(default to true), "item_opts" is a hash reference that will be passed to +the item constructor in the new_item() method. +The index can only contain one item with a given key. The "get_key_func" function used depends on the type: =over @@ -264,7 +267,7 @@ object. sub new_item { my $self = shift; - return Dpkg::Control->new(type => $self->{type}); + return Dpkg::Control->new(%{$self->{item_opts}}, type => $self->{type}); } =item $item = $index->get_by_key($key) @@ -426,6 +429,10 @@ based on their extensions. =head1 CHANGES +=head2 Version 2.01 (dpkg 1.20.6) + +New option: Add new "item_opts" option. + =head2 Version 2.00 (dpkg 1.20.0) Change behavior: The "unique_tuple_key" option now defaults to true. -- Dpkg.Org's dpkg

