[Reproducible-commits] [dpkg] 64/90: scripts: Use none instead of ah-hoc checks
Jérémy Bobbio
lunar at moszumanska.debian.org
Sat Aug 29 18:26:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.
commit 0ccd2f60fc794296e925ce5da242bc7aebefd0f8
Author: Guillem Jover <guillem at debian.org>
Date: Sat Aug 1 23:00:30 2015 +0200
scripts: Use none instead of ah-hoc checks
This simplifies the code, and fixes a false positive on perl critic
(ControlStructures::ProhibitUntilBlocks), due to the word "until"
appearing in the block.
---
scripts/Dpkg/Changelog/Parse.pm | 7 ++-----
scripts/changelog/debian.pl | 11 +++++------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/scripts/Dpkg/Changelog/Parse.pm b/scripts/Dpkg/Changelog/Parse.pm
index cc24ac7..51c20b3 100644
--- a/scripts/Dpkg/Changelog/Parse.pm
+++ b/scripts/Dpkg/Changelog/Parse.pm
@@ -43,6 +43,7 @@ our @EXPORT = qw(
use Exporter qw(import);
use Dpkg ();
+use Dpkg::Util qw(none);
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Changelog::Debian;
@@ -77,11 +78,7 @@ sub changelog_parse_debian {
$options{format} //= 'dpkg';
$options{all} = 1 if exists $options{all};
- unless (defined $options{since} or defined $options{until} or
- defined $options{from} or defined $options{to} or
- defined $options{offset} or defined $options{count} or
- defined $options{all})
- {
+ if (none { defined $options{$_} } qw(since until from to offset count all)) {
$options{count} = 1;
}
diff --git a/scripts/changelog/debian.pl b/scripts/changelog/debian.pl
index d3caae8..ad05170 100755
--- a/scripts/changelog/debian.pl
+++ b/scripts/changelog/debian.pl
@@ -25,6 +25,7 @@ use warnings;
use Getopt::Long qw(:config posix_default bundling no_ignorecase);
use Dpkg ();
+use Dpkg::Util qw(none);
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::Changelog::Debian;
@@ -117,18 +118,16 @@ if (@ARGV) {
$file //= $default_file;
$label //= $file;
-unless (defined($since) or defined($until) or defined($from) or
- defined($to) or defined($offset) or defined($count) or
- defined($all))
-{
- $count = 1;
-}
+
my %all = $all ? ( all => $all ) : ();
my $range = {
since => $since, until => $until, from => $from, to => $to,
count => $count, offset => $offset,
%all
};
+if (none { defined $range->{$_} } qw(since until from to offset count all)) {
+ $range->{count} = 1;
+}
my $changes = Dpkg::Changelog::Debian->new(reportfile => $label, range => $range);
--
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