[dpkg] 44/192: test: Use Module::Metadata instead of grepping for $VERSION

Ximin Luo infinity0 at debian.org
Tue Oct 17 11:03:56 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 f57835579cf70a7ed5569d84c30c25a901a18ca3
Author: Guillem Jover <guillem at debian.org>
Date:   Sat May 20 05:06:17 2017 +0200

    test: Use Module::Metadata instead of grepping for $VERSION
---
 debian/changelog | 1 +
 t/pod-coverage.t | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a8acb78..14cbdc8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,7 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
     - Add a new all_perl_modules function to Test::Dpkg.
     - Add a new module-version unit test to check that module $VERSION
       matches the newest entry in the CHANGES section.
+    - Use Module::Metadata instead of grepping for $VERSION in pod-coverage.
 
  -- Guillem Jover <guillem at debian.org>  Thu, 18 May 2017 05:27:31 +0200
 
diff --git a/t/pod-coverage.t b/t/pod-coverage.t
index 838ca74..3cecd8b 100644
--- a/t/pod-coverage.t
+++ b/t/pod-coverage.t
@@ -18,6 +18,7 @@ use warnings;
 
 use List::Util qw(any);
 use File::Find;
+use Module::Metadata;
 
 use Test::More;
 use Test::Dpkg qw(:needs);
@@ -36,9 +37,10 @@ sub all_pod_modules
         # Only chack modules, scripts are documented in man pages.
         return unless $module =~ s/\.pm$//;
 
+        my $mod = Module::Metadata->new_from_file($File::Find::name);
+
         # As a first step just check public modules (version > 0.xx).
-        return unless system('grep', '-q', '^our \$VERSION = \'[^0]\.',
-                                     $File::Find::name) == 0;
+        return if $mod->version() =~ m/^0\.\d\d$/;
 
         $module =~ s{^\Q$File::Find::topdir\E/}{};
         $module =~ s{/}{::}g;

-- 
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