[dpkg] 35/192: Dpkg::Util: Remove and replace with core module List::Util
Ximin Luo
infinity0 at debian.org
Tue Oct 17 11:03:55 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit 7f779d971f1f9af460cb2286047ab97e854796ac
Author: Guillem Jover <guillem at debian.org>
Date: Thu May 18 06:25:26 2017 +0200
Dpkg::Util: Remove and replace with core module List::Util
Our current minimal Perl version contains a new enough List::Util module
implementing none and any, and several other functions.
---
debian/changelog | 3 ++
scripts/Dpkg/Arch.pm | 2 +-
scripts/Dpkg/BuildProfiles.pm | 2 +-
scripts/Dpkg/Changelog/Parse.pm | 2 +-
scripts/Dpkg/Deps.pm | 1 -
scripts/Dpkg/Shlibs.pm | 2 +-
scripts/Dpkg/Shlibs/Symbol.pm | 2 +-
scripts/Dpkg/Source/Package/V3/Quilt.pm | 2 +-
scripts/Dpkg/Source/Quilt.pm | 2 +-
scripts/Dpkg/Util.pm | 59 ---------------------------------
scripts/Makefile.am | 2 --
scripts/dpkg-genbuildinfo.pl | 2 +-
scripts/dpkg-genchanges.pl | 2 +-
scripts/dpkg-gencontrol.pl | 2 +-
scripts/dpkg-scanpackages.pl | 2 +-
scripts/dpkg-scansources.pl | 2 +-
scripts/dpkg-shlibdeps.pl | 2 +-
scripts/dpkg-source.pl | 2 +-
scripts/po/POTFILES.in | 1 -
scripts/t/Dpkg_Util.t | 38 ---------------------
t/critic/perlcriticrc | 3 --
t/pod-coverage.t | 2 +-
22 files changed, 18 insertions(+), 119 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index fbb052d..a1507a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,8 @@
dpkg (1.19.0) UNRELEASED; urgency=medium
+ * Perl modules:
+ - Switch from Dpkg::Util to List::Util, now that the module in the
+ new required Perl contains the needed functions.
* Build system:
- Require Perl 5.20.2, the version in Debian oldstable (jessie).
diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm
index 1720847..c6321a5 100644
--- a/scripts/Dpkg/Arch.pm
+++ b/scripts/Dpkg/Arch.pm
@@ -95,12 +95,12 @@ our %EXPORT_TAGS = (
use Exporter qw(import);
+use List::Util qw(any);
use POSIX qw(:errno_h);
use Dpkg ();
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
-use Dpkg::Util qw(:list);
use Dpkg::Build::Env;
my (@cpu, @os);
diff --git a/scripts/Dpkg/BuildProfiles.pm b/scripts/Dpkg/BuildProfiles.pm
index 6314f1e..3f8580b 100644
--- a/scripts/Dpkg/BuildProfiles.pm
+++ b/scripts/Dpkg/BuildProfiles.pm
@@ -27,8 +27,8 @@ our @EXPORT_OK = qw(
);
use Exporter qw(import);
+use List::Util qw(any);
-use Dpkg::Util qw(:list);
use Dpkg::Build::Env;
my $cache_profiles;
diff --git a/scripts/Dpkg/Changelog/Parse.pm b/scripts/Dpkg/Changelog/Parse.pm
index 68777b4..e26a090 100644
--- a/scripts/Dpkg/Changelog/Parse.pm
+++ b/scripts/Dpkg/Changelog/Parse.pm
@@ -41,9 +41,9 @@ our @EXPORT = qw(
);
use Exporter qw(import);
+use List::Util qw(none);
use Dpkg ();
-use Dpkg::Util qw(none);
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Control::Changelog;
diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index f4c3be5..0d5652b 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -573,7 +573,6 @@ use Dpkg::BuildProfiles qw(parse_build_profiles evaluate_restriction_formula);
use Dpkg::Version;
use Dpkg::ErrorHandling;
use Dpkg::Gettext;
-use Dpkg::Util qw(:list);
use parent qw(Dpkg::Interface::Storable);
diff --git a/scripts/Dpkg/Shlibs.pm b/scripts/Dpkg/Shlibs.pm
index 9816dbf..c8b43ab 100644
--- a/scripts/Dpkg/Shlibs.pm
+++ b/scripts/Dpkg/Shlibs.pm
@@ -30,12 +30,12 @@ our @EXPORT_OK = qw(
);
use Exporter qw(import);
+use List::Util qw(none);
use File::Spec;
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Shlibs::Objdump;
-use Dpkg::Util qw(:list);
use Dpkg::Path qw(resolve_symlink canonpath);
use Dpkg::Arch qw(get_build_arch get_host_arch :mappers);
diff --git a/scripts/Dpkg/Shlibs/Symbol.pm b/scripts/Dpkg/Shlibs/Symbol.pm
index 019e77e..6093e24 100644
--- a/scripts/Dpkg/Shlibs/Symbol.pm
+++ b/scripts/Dpkg/Shlibs/Symbol.pm
@@ -22,10 +22,10 @@ use warnings;
our $VERSION = '0.01';
use Storable ();
+use List::Util qw(any);
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
-use Dpkg::Util qw(:list);
use Dpkg::Arch qw(debarch_is_concerned debarch_to_cpuattrs);
use Dpkg::Version;
use Dpkg::Shlibs::Cppfilt;
diff --git a/scripts/Dpkg/Source/Package/V3/Quilt.pm b/scripts/Dpkg/Source/Package/V3/Quilt.pm
index fdb7635..9718ffa 100644
--- a/scripts/Dpkg/Source/Package/V3/Quilt.pm
+++ b/scripts/Dpkg/Source/Package/V3/Quilt.pm
@@ -20,12 +20,12 @@ use warnings;
our $VERSION = '0.01';
+use List::Util qw(any);
use File::Spec;
use File::Copy;
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
-use Dpkg::Util qw(:list);
use Dpkg::Version;
use Dpkg::Source::Patch;
use Dpkg::Source::Functions qw(erasedir fs_time);
diff --git a/scripts/Dpkg/Source/Quilt.pm b/scripts/Dpkg/Source/Quilt.pm
index a07abb2..55b3fba 100644
--- a/scripts/Dpkg/Source/Quilt.pm
+++ b/scripts/Dpkg/Source/Quilt.pm
@@ -20,6 +20,7 @@ use warnings;
our $VERSION = '0.02';
+use List::Util qw(any none);
use File::Spec;
use File::Copy;
use File::Find;
@@ -28,7 +29,6 @@ use File::Basename;
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
-use Dpkg::Util qw(:list);
use Dpkg::Source::Patch;
use Dpkg::Source::Functions qw(erasedir fs_time);
use Dpkg::Vendor qw(get_current_vendor);
diff --git a/scripts/Dpkg/Util.pm b/scripts/Dpkg/Util.pm
deleted file mode 100644
index 4b371a1..0000000
--- a/scripts/Dpkg/Util.pm
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright © 2013, 2015 Guillem Jover <guillem at debian.org>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-package Dpkg::Util;
-
-use strict;
-use warnings;
-
-our $VERSION = '0.01';
-our @EXPORT_OK = qw(
- any
- none
-);
-our %EXPORT_TAGS = (
- list => [ qw(any none) ],
-);
-
-use Exporter qw(import);
-
-# XXX: Ideally we would use List::MoreUtils, but that's not a core module,
-# so to avoid the additional dependency we'll make do with the following
-# trivial reimplementations.
-#
-# These got added to List::Util 1.33, which got merged into perl 5.20.0,
-# once that is in Debian oldstable we can switch to that core module.
-
-sub any(&@) {
- my $code = shift;
-
- foreach (@_) {
- return 1 if $code->();
- }
-
- return 0;
-}
-
-sub none(&@) {
- my $code = shift;
-
- foreach (@_) {
- return 0 if $code->();
- }
-
- return 1;
-}
-
-1;
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 16862cc..ba175b5 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -108,7 +108,6 @@ nobase_dist_perllib_DATA = \
Dpkg/Source/Patch.pm \
Dpkg/Source/Quilt.pm \
Dpkg/Substvars.pm \
- Dpkg/Util.pm \
Dpkg/Vars.pm \
Dpkg/Vendor.pm \
Dpkg/Vendor/Debian.pm \
@@ -223,7 +222,6 @@ test_scripts = \
t/Dpkg_Conf.t \
t/Dpkg_Deps.t \
t/Dpkg_Path.t \
- t/Dpkg_Util.t \
t/Dpkg_Vars.t \
t/Dpkg_Interface_Storable.t \
t/Dpkg_Vendor.t \
diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl
index c7d6cb1..be4ca97 100755
--- a/scripts/dpkg-genbuildinfo.pl
+++ b/scripts/dpkg-genbuildinfo.pl
@@ -25,6 +25,7 @@
use strict;
use warnings;
+use List::Util qw(any);
use Cwd;
use File::Basename;
use POSIX qw(:fcntl_h :locale_h strftime);
@@ -45,7 +46,6 @@ use Dpkg::Control;
use Dpkg::Changelog::Parse;
use Dpkg::Deps;
use Dpkg::Dist::Files;
-use Dpkg::Util qw(:list);
use Dpkg::File;
use Dpkg::Version;
use Dpkg::Vendor qw(get_current_vendor run_vendor_hook);
diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index 73213ee..e8c86fe 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -22,12 +22,12 @@
use strict;
use warnings;
+use List::Util qw(any none);
use Encode;
use POSIX qw(:errno_h :locale_h);
use Dpkg ();
use Dpkg::Gettext;
-use Dpkg::Util qw(:list);
use Dpkg::File;
use Dpkg::Checksums;
use Dpkg::ErrorHandling;
diff --git a/scripts/dpkg-gencontrol.pl b/scripts/dpkg-gencontrol.pl
index 94d6d2d..cf9529a 100755
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -22,13 +22,13 @@
use strict;
use warnings;
+use List::Util qw(none);
use POSIX qw(:errno_h :fcntl_h);
use File::Find;
use Dpkg ();
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
-use Dpkg::Util qw(:list);
use Dpkg::File;
use Dpkg::Arch qw(get_host_arch debarch_eq debarch_is debarch_list_parse);
use Dpkg::Package;
diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl
index b5d98e8..05710ae 100755
--- a/scripts/dpkg-scanpackages.pl
+++ b/scripts/dpkg-scanpackages.pl
@@ -21,12 +21,12 @@ use warnings;
use strict;
use Getopt::Long qw(:config posix_default bundling no_ignorecase);
+use List::Util qw(none);
use File::Find;
use Dpkg ();
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
-use Dpkg::Util qw(:list);
use Dpkg::Control;
use Dpkg::Version;
use Dpkg::Checksums;
diff --git a/scripts/dpkg-scansources.pl b/scripts/dpkg-scansources.pl
index 70f56a1..3c793b4 100755
--- a/scripts/dpkg-scansources.pl
+++ b/scripts/dpkg-scansources.pl
@@ -21,12 +21,12 @@ use strict;
use warnings;
use Getopt::Long qw(:config posix_default bundling no_ignorecase);
+use List::Util qw(any);
use File::Find;
use Dpkg ();
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
-use Dpkg::Util qw(:list);
use Dpkg::Control;
use Dpkg::Checksums;
use Dpkg::Compression::FileHandle;
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index f035093..1687414 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -24,6 +24,7 @@
use strict;
use warnings;
+use List::Util qw(any none);
use POSIX qw(:errno_h);
use Cwd qw(realpath);
use File::Basename qw(dirname);
@@ -31,7 +32,6 @@ use File::Basename qw(dirname);
use Dpkg ();
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
-use Dpkg::Util qw(:list);
use Dpkg::Path qw(relative_to_pkg_root guess_pkg_root_dir
check_files_are_the_same get_control_path);
use Dpkg::Version;
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index dbb182f..c7414eb 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -28,6 +28,7 @@
use strict;
use warnings;
+use List::Util qw(any none);
use Cwd;
use File::Basename;
use File::Spec;
@@ -35,7 +36,6 @@ use File::Spec;
use Dpkg ();
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
-use Dpkg::Util qw(:list);
use Dpkg::Arch qw(:operators);
use Dpkg::Deps;
use Dpkg::Compression;
diff --git a/scripts/po/POTFILES.in b/scripts/po/POTFILES.in
index 6782751..04b0549 100644
--- a/scripts/po/POTFILES.in
+++ b/scripts/po/POTFILES.in
@@ -70,7 +70,6 @@ scripts/Dpkg/Source/Package/V3/Quilt.pm
scripts/Dpkg/Source/Patch.pm
scripts/Dpkg/Source/Quilt.pm
scripts/Dpkg/Substvars.pm
-scripts/Dpkg/Util.pm
scripts/Dpkg/Vars.pm
scripts/Dpkg/Vendor.pm
scripts/Dpkg/Vendor/Debian.pm
diff --git a/scripts/t/Dpkg_Util.t b/scripts/t/Dpkg_Util.t
deleted file mode 100644
index 03a8898..0000000
--- a/scripts/t/Dpkg_Util.t
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/perl
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-use strict;
-use warnings;
-
-use Test::More tests => 7;
-
-BEGIN {
- use_ok('Dpkg::Util', qw(:list));
-}
-
-my @array = qw(foo bar quux baz);
-my %hash = (foo => 1, bar => 10, quux => 100, baz => 200);
-
-ok(any { 'bar' eq $_ } @array, 'array has item');
-
-ok(!any { 'notfound' eq $_ } @array, 'array does not have item');
-ok(none { 'notfound' eq $_ } @array, 'array lacks item');
-
-ok(any { m/^quu/ } @array, 'array has item matching regex');
-ok(none { m/^notfound/ } @array, 'array lacks item matching regex');
-
-ok(any { m/^quu/ } keys %hash, 'hash has item matching regex');
-
-1;
diff --git a/t/critic/perlcriticrc b/t/critic/perlcriticrc
index a968009..8dabccd 100644
--- a/t/critic/perlcriticrc
+++ b/t/critic/perlcriticrc
@@ -7,9 +7,6 @@ program-extensions = .pl .t
## Tune tests
##
-[ControlStructures::ProhibitMutatingListFunctions]
-add_list_funcs = Dpkg::Util::any Dpkg::Util::none
-
[RegularExpressions::ProhibitUnusualDelimiters]
allow_all_brackets = 1
diff --git a/t/pod-coverage.t b/t/pod-coverage.t
index 7b475e8..838ca74 100644
--- a/t/pod-coverage.t
+++ b/t/pod-coverage.t
@@ -16,8 +16,8 @@
use strict;
use warnings;
+use List::Util qw(any);
use File::Find;
-use Dpkg::Util qw(any);
use Test::More;
use Test::Dpkg qw(:needs);
--
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