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=2c08a8a2a2503398c7d17b4ecb7f364ea4eb3aed

commit 2c08a8a2a2503398c7d17b4ecb7f364ea4eb3aed
Author: Guillem Jover <[email protected]>
AuthorDate: Sat Nov 16 00:33:52 2019 +0100

    Dpkg::Index: Change default value for unique_tuple_key to 1
    
    Bump module version to 2.00.
---
 debian/changelog      |  1 +
 scripts/Dpkg/Index.pm | 35 +++++++++++++++--------------------
 2 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0cf8c186d..93c9c2f08 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -64,6 +64,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
       @tar_ignore_default_pattern. Remove iternal lowercase variable alias
       $diff_ignore_default_regexp.
     - Dpkg::Substvars: Remove obsolete no_warn() method.
+    - Dpkg::Index: Change default value for unique_tuple_key to 1.
   * Documentation:
     - man: Fix uncommon wording constructs.
     - man: Use a minus sign for a literal string.
diff --git a/scripts/Dpkg/Index.pm b/scripts/Dpkg/Index.pm
index 682f16921..7859bf669 100644
--- a/scripts/Dpkg/Index.pm
+++ b/scripts/Dpkg/Index.pm
@@ -19,7 +19,7 @@ package Dpkg::Index;
 use strict;
 use warnings;
 
-our $VERSION = '1.01';
+our $VERSION = '2.00';
 
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
@@ -58,7 +58,7 @@ sub new {
     my $self = {
        items => {},
        order => [],
-       unique_tuple_key => 0,
+       unique_tuple_key => 1,
        get_key_func => sub { return $_[0]->{Package} },
        type => CTRL_UNKNOWN,
     };
@@ -77,8 +77,7 @@ 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 false for backwards compatibility, but it will change to true
-in dpkg 1.20.x). The index can only contain one item with a given key.
+(default to true). The index can only contain one item with a given key.
 The "get_key_func" function used depends on the type:
 
 =over
@@ -89,9 +88,9 @@ for CTRL_INFO_SRC, it is the Source field;
 
 =item *
 
-for CTRL_INDEX_SRC and CTRL_PKG_SRC it is the Package field by default,
-or the Package and Version fields (concatenated with "_") when
-"unique_tuple_key" is true;
+for CTRL_INDEX_SRC and CTRL_PKG_SRC it is the Package and Version fields
+(concatenated with "_") when "unique_tuple_key" is true (the default), or
+otherwise the Package field;
 
 =item *
 
@@ -99,9 +98,9 @@ for CTRL_INFO_PKG it is simply the Package field;
 
 =item *
 
-for CTRL_INDEX_PKG and CTRL_PKG_DEB it is the Package field by default,
-or the Package, Version and Architecture fields (concatenated with "_")
-when "unique_tuple_key" is true;
+for CTRL_INDEX_PKG and CTRL_PKG_DEB it is the Package, Version and
+Architecture fields (concatenated with "_") when "unique_tuple_key" is
+true (the default) or otherwise the Package field;
 
 =item *
 
@@ -165,14 +164,10 @@ sub set_options {
                 $self->{get_key_func} = sub {
                     return $_[0]->{Package} . '_' . $_[0]->{Version};
                 };
-            } elsif (not defined $opts{get_key_func}) {
+            } else {
                 $self->{get_key_func} = sub {
                     return $_[0]->{Package};
                 };
-                warnings::warnif('deprecated',
-                    'the default get_key_func for this control type will ' .
-                    'change semantics in dpkg 1.20.x , please set ' .
-                    'unique_tuple_key or get_key_func explicitly');
             }
         } elsif ($t == CTRL_INDEX_PKG or $t == CTRL_PKG_DEB) {
             if ($opts{unique_tuple_key} // $self->{unique_tuple_key}) {
@@ -180,14 +175,10 @@ sub set_options {
                     return $_[0]->{Package} . '_' . $_[0]->{Version} . '_' .
                            $_[0]->{Architecture};
                 };
-            } elsif (not defined $opts{get_key_func}) {
+            } else {
                 $self->{get_key_func} = sub {
                     return $_[0]->{Package};
                 };
-                warnings::warnif('deprecated',
-                    'the default get_key_func for this control type will ' .
-                    'change semantics in dpkg 1.20.x , please set ' .
-                    'unique_tuple_key or get_key_func explicitly');
             }
         } elsif ($t == CTRL_FILE_CHANGES) {
            $self->{get_key_func} = sub {
@@ -435,6 +426,10 @@ based on their extensions.
 
 =head1 CHANGES
 
+=head2 Version 2.00 (dpkg 1.20.0)
+
+Change behavior: The "unique_tuple_key" option now defaults to true.
+
 =head2 Version 1.01 (dpkg 1.19.0)
 
 New option: Add new "unique_tuple_key" option to $index->set_options() to set

-- 
Dpkg.Org's dpkg

Reply via email to