[Reproducible-commits] [dpkg] 19/24: dpkg-genbuildinfo et al: Perl::Critic fixes

Niko Tyni ntyni at moszumanska.debian.org
Tue May 3 21:38:24 UTC 2016


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

ntyni pushed a commit to branch ntyni/reproducible_builds
in repository dpkg.

commit d15fdd360a04b9f62dc15f299739bbbbafc9de6b
Author: Niko Tyni <ntyni at debian.org>
Date:   Tue May 3 22:13:48 2016 +0300

    dpkg-genbuildinfo et al: Perl::Critic fixes
    
    These tweaks are required to get t/critic.t to pass, which
    is a requirement for build a new version according to
    https://wiki.debian.org/Teams/Dpkg/GitUsage
    
    The only somewhat functional change is changing 'if grep { [...] }'
    to use 'any' (currently in Dpkg::Util) instead so that it short-circuits
    on the first match. This shouldn't affect the behaviour, though.
---
 scripts/Dpkg/Control/Types.pm | 2 +-
 scripts/dpkg-buildpackage.pl  | 2 +-
 scripts/dpkg-genbuildinfo.pl  | 9 ++++++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/scripts/Dpkg/Control/Types.pm b/scripts/Dpkg/Control/Types.pm
index e401019..5012e21 100644
--- a/scripts/Dpkg/Control/Types.pm
+++ b/scripts/Dpkg/Control/Types.pm
@@ -85,7 +85,7 @@ use constant {
     # License control block in debian/copyright.
     CTRL_COPYRIGHT_LICENSE => 8192,
     # .buildinfo file
-    CTRL_FILE_BUILDINFO => 16384,
+    CTRL_FILE_BUILDINFO => 16_384,
 };
 
 =head1 CHANGES
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 44af839..fa5d209 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -574,7 +574,7 @@ if (build_has_any(BUILD_BINARY)) {
 
     my $buildinfo = "${pv}_${buildinfo_identifier}.buildinfo";
 
-    open my $buildinfo_fh, ">../$buildinfo"
+    open my $buildinfo_fh, '>', "../$buildinfo"
         or syserr(g_('cannot open %s', "../$buildinfo"));
     print { $buildinfo_fh } @buildinfo_content;
     close $buildinfo_fh;
diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl
index 8062434..c42d574 100755
--- a/scripts/dpkg-genbuildinfo.pl
+++ b/scripts/dpkg-genbuildinfo.pl
@@ -41,6 +41,7 @@ use Dpkg::Control;
 use Dpkg::Changelog::Parse;
 use Dpkg::Deps;
 use Dpkg::Dist::Files;
+use Dpkg::Util qw(:list);
 use Dpkg::Version;
 use Dpkg::Vendor qw(run_vendor_hook);
 
@@ -122,11 +123,13 @@ sub parse_status {
             }
         }
 
+        ## no critic (RegularExpressions::ProhibitUnusedCapture)
         if (/^(?:Pre-)?Depends: (.*)$/m) {
             foreach (split(/,\s*/, $1)) {
                 push @{$depends{"$package:$arch"}}, $_;
             }
         }
+        ## use critic
     }
     close $status_fh;
 
@@ -321,7 +324,7 @@ while (my $pkg_name = shift @unprocessed_pkgs) {
     if ($pkg_name =~ /\A(.*):(.*)\z/) {
         $pkg_name = $1;
         my $arch = $2;
-        $required_architecture = $arch if $arch !~ /\A(all|any|native)\Z/
+        $required_architecture = $arch if $arch !~ /\A(?:all|any|native)\Z/
     }
     my $pkg;
     my $qualified_pkg_name;
@@ -347,7 +350,7 @@ while (my $pkg_name = shift @unprocessed_pkgs) {
             deps_iterate($new_deps, sub {
                 my $dep = shift;
                 $dep->{archqual} //= $architecture
-                    if grep sub { $_[0]->{architecture} eq $architecture }, @{$facts->{pkg}->{$dep->{package}}};
+                    if any { $_[0]->{architecture} eq $architecture }, @{$facts->{pkg}->{$dep->{package}}};
                 1;
             });
         }
@@ -402,7 +405,7 @@ my $environment_whitelist =
          | SOURCE_DATE_EPOCH # see https://reproducible-builds.org/specs/source-date-epoch
          )\z}x;
 
-my %environment = map { $_, $ENV{$_} } (grep /$environment_whitelist/, sort keys %ENV);
+my %environment = map { $_ => $ENV{$_} } (grep { /$environment_whitelist/ } sort keys %ENV);
 
 # Record flags from dpkg-buildflags
 my $bf = Dpkg::BuildFlags->new();

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