[Reproducible-commits] [dpkg] 14/74: Dpkg: Use warnings::warnif() instead of carp() for deprecated warnings

Mattia Rizzolo mattia at debian.org
Sun Jul 3 22:22:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to annotated tag 1.18.8
in repository dpkg.

commit e5b4e9a0c9ba1cd20f7f4f56e6c8bd6b3d9b0797
Author: Guillem Jover <guillem at debian.org>
Date:   Mon Jun 27 01:14:33 2016 +0200

    Dpkg: Use warnings::warnif() instead of carp() for deprecated warnings
    
    Suggested-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog                       | 2 ++
 scripts/Dpkg/Changelog/Entry/Debian.pm | 9 ++++++---
 scripts/Dpkg/Checksums.pm              | 9 ++++++---
 scripts/Dpkg/Deps.pm                   | 6 ++----
 scripts/Dpkg/Gettext.pm                | 4 ++--
 scripts/Dpkg/Substvars.pm              | 6 ++++--
 6 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a9e60d5..d73f88f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
 dpkg (1.18.8) UNRELEASED; urgency=medium
 
   [ Guillem Jover ]
+  * Perl modules:
+    - Use warnings::warnif() instead of carp() for deprecated warnings.
   * Documentation:
     - Improve dpkg-buildpackage(1) on environment expectations.
     - Clarify the format of the db:Status-Abbrev virtual field in
diff --git a/scripts/Dpkg/Changelog/Entry/Debian.pm b/scripts/Dpkg/Changelog/Entry/Debian.pm
index fce6e8d..cede27f 100644
--- a/scripts/Dpkg/Changelog/Entry/Debian.pm
+++ b/scripts/Dpkg/Changelog/Entry/Debian.pm
@@ -29,7 +29,6 @@ our @EXPORT_OK = qw(
 );
 
 use Exporter qw(import);
-use Carp;
 use Time::Piece;
 
 use Dpkg::Gettext;
@@ -250,7 +249,9 @@ Obsolete method. Use parse_header() instead.
 sub check_header {
     my $self = shift;
 
-    carp 'obsolete check_header(), use parse_header() instead';
+    warnings::warnif('deprecated',
+                     'obsolete check_header(), use parse_header() instead');
+
     return $self->parse_header();
 }
 
@@ -263,7 +264,9 @@ Obsolete method. Use parse_trailer() instead.
 sub check_trailer {
     my $self = shift;
 
-    carp 'obsolete check_trailer(), use parse_trailer() instead';
+    warnings::warnif('deprecated',
+                     'obsolete check_trailer(), use parse_trailer() instead');
+
     return $self->parse_header();
 }
 
diff --git a/scripts/Dpkg/Checksums.pm b/scripts/Dpkg/Checksums.pm
index 36eb615..d66c3c7 100644
--- a/scripts/Dpkg/Checksums.pm
+++ b/scripts/Dpkg/Checksums.pm
@@ -28,7 +28,6 @@ our @EXPORT = qw(
 );
 
 use Exporter qw(import);
-use Carp;
 use Digest;
 
 use Dpkg::Gettext;
@@ -106,7 +105,11 @@ whether the checksum algorithm is considered cryptographically strong.
 
 sub checksums_get_property($$) {
     my ($alg, $property) = @_;
-    carp 'obsolete checksums program property' if $property eq 'program';
+
+    if ($property eq 'program') {
+        warnings::warnif('deprecated', 'obsolete checksums program property');
+    }
+
     return unless checksums_is_supported($alg);
     return $CHECKSUMS->{lc($alg)}{$property};
 }
@@ -405,7 +408,7 @@ New member: $ck->has_strong_checksums().
 
 =head2 Version 1.02 (dpkg 1.18.0)
 
-Obsolete property: Getting the 'program' checksum property will carp() and
+Obsolete property: Getting the 'program' checksum property will warn and
 return undef, the Digest module is used internally now.
 
 New property: Add new 'name' property with the name of the Digest algorithm
diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index 0238fd4..aa2f9a0 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -1337,8 +1337,6 @@ Creates a new object.
 use strict;
 use warnings;
 
-use Carp;
-
 use Dpkg::Version;
 
 sub new {
@@ -1409,8 +1407,8 @@ methods where appropriate, but it should not be directly queried.
 sub check_package {
     my ($self, $pkg) = @_;
 
-    carp 'obsolete function, pass Dpkg::Deps::KnownFacts to Dpkg::Deps ' .
-         'methods instead';
+    warnings::warnif('deprecated', 'obsolete function, pass ' .
+                     'Dpkg::Deps::KnownFacts to Dpkg::Deps methods instead');
 
     if (exists $self->{pkg}{$pkg}) {
 	return (1, $self->{pkg}{$pkg}[0]{version});
diff --git a/scripts/Dpkg/Gettext.pm b/scripts/Dpkg/Gettext.pm
index 850162e..7be03d4 100644
--- a/scripts/Dpkg/Gettext.pm
+++ b/scripts/Dpkg/Gettext.pm
@@ -160,8 +160,8 @@ sub _g ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
 {
     my $msgid = shift;
 
-    require Carp;
-    Carp::carp('obsolete _g() function, please use g_() instead');
+    warnings::warnif('deprecated',
+                     'obsolete _g() function, please use g_() instead');
 
     return g_($msgid);
 }
diff --git a/scripts/Dpkg/Substvars.pm b/scripts/Dpkg/Substvars.pm
index 66bc401..949a784 100644
--- a/scripts/Dpkg/Substvars.pm
+++ b/scripts/Dpkg/Substvars.pm
@@ -22,7 +22,6 @@ use warnings;
 our $VERSION = '1.04';
 
 use POSIX qw(:errno_h);
-use Carp;
 
 use Dpkg ();
 use Dpkg::Arch qw(get_host_arch);
@@ -179,7 +178,10 @@ Obsolete function, use mark_as_used() instead.
 
 sub no_warn {
     my ($self, $key) = @_;
-    carp 'obsolete no_warn() function, use mark_as_used() instead';
+
+    warnings::warnif('deprecated',
+                     'obsolete no_warn() function, use mark_as_used() instead');
+
     $self->mark_as_used($key);
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list