Просмотр исходного кода

Dpkg::Control::HashCore: Switch module to use Dpkg::Control::FieldsCore

Because Dpkg::Vendor is not entangled with Dpkg::Control::FieldsCore
anymore, Dpkg::Control::HashCore will be able to use it and
Dpkg::Control::HashCore::Tie can use it now instead of duplicating
field_capitalize().
Guillem Jover лет назад: 13
Родитель
Сommit
383dcd074e
1 измененных файлов с 4 добавлено и 13 удалено
  1. 4 13
      scripts/Dpkg/Control/HashCore.pm

+ 4 - 13
scripts/Dpkg/Control/HashCore.pm

@@ -23,10 +23,9 @@ our $VERSION = '1.00';
 use Dpkg::Gettext;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::ErrorHandling;
 
 
-# This module must absolutely not use Dpkg::Control::Fields
-# it's used by other modules that are required to compile
-# Dpkg::Control::Fields itself (Dpkg::Vendor)
-# That's why field_capitalize is duplicated
+# This module cannot use Dpkg::Control::Fields, because that one makes use
+# of Dpkg::Vendor which at the same time uses this module, which would turn
+# into a compilation error. We can use Dpkg::Control::FieldsCore instead.
 
 
 use parent qw(Dpkg::Interface::Storable);
 use parent qw(Dpkg::Interface::Storable);
 
 
@@ -399,19 +398,11 @@ package Dpkg::Control::HashCore::Tie;
 # type Dpkg::Control.
 # type Dpkg::Control.
 
 
 use Dpkg::Checksums;
 use Dpkg::Checksums;
+use Dpkg::Control::FieldsCore;
 
 
 use Tie::Hash;
 use Tie::Hash;
 use parent -norequire, qw(Tie::ExtraHash);
 use parent -norequire, qw(Tie::ExtraHash);
 
 
-sub field_capitalize($) {
-    my $field = lc(shift);
-    # Some special cases due to history
-    return 'MD5sum' if $field eq 'md5sum';
-    return uc($field) if checksums_is_supported($field);
-    # Generic case
-    return join '-', map { ucfirst } split /-/, $field;
-}
-
 # $self->[0] is the real hash
 # $self->[0] is the real hash
 # $self->[1] is a reference to the hash contained by the parent object.
 # $self->[1] is a reference to the hash contained by the parent object.
 # This reference bypasses the top-level scalar reference of a
 # This reference bypasses the top-level scalar reference of a